diff --git a/Public/www/javascript/gxg.js b/Public/www/javascript/gxg.js index ea4f3cf..f1a7a2c 100644 --- a/Public/www/javascript/gxg.js +++ b/Public/www/javascript/gxg.js @@ -2750,15 +2750,15 @@ try{self.$log_error($hash2(["error","parameters"],{"error":the_error,"parameters function $rb_gt(lhs,rhs){return(typeof(lhs)==='number'&&typeof(rhs)==='number')?lhs>rhs:lhs['$>'](rhs);} function $rb_lt(lhs,rhs){return(typeof(lhs)==='number'&&typeof(rhs)==='number')?lhs','$size','$to_i','$<','$log_info','$inspect','$element','$body','$fail','$succeed','$+','$==','$pull_data','$base64?','$json?','$process_detached_import','$on','$to_proc','$push','$uuid','$format','$search','$constraint','$each','$clone','$gxg_export','$push_data','$open?','$set_busy','$encrypt','$id','$basename','$split','$index','$join','$post_event','$sleep','$navigate_to','$open','$gsub','$add_periodic_timer','$follow_up','$heartbeat']);return(function($base,$parent_nesting){var self=$module($base,'GxG');var $nesting=[self].concat($parent_nesting);(function($base,$parent_nesting){var self=$module($base,'Networking');var $nesting=[self].concat($parent_nesting);(function($base,$super,$parent_nesting){var self=$klass($base,$super,'SocketMonitor');var $nesting=[self].concat($parent_nesting),$SocketMonitor_initialize$1,$SocketMonitor_on$2,$SocketMonitor_follow_up$3;self.$$prototype.event_handlers=nil;Opal.def(self,'$initialize',$SocketMonitor_initialize$1=function $$initialize(){var self=this;self.event_handlers=$hash2([],{});return self;},$SocketMonitor_initialize$1.$$arity=0);Opal.def(self,'$on',$SocketMonitor_on$2=function $$on(the_operation){var $iter=$SocketMonitor_on$2.$$p,block=$iter||nil,self=this,$writer=nil;if($iter)$SocketMonitor_on$2.$$p=null;if($iter)$SocketMonitor_on$2.$$p=null;;if(the_operation==null){the_operation=nil;};if($truthy(the_operation['$is_any?']($$$('::','String'),$$$('::','Symbol')))){if($truthy(block['$respond_to?']("call"))){$writer=[the_operation.$to_s().$downcase().$to_sym(),block];$send(self.event_handlers,'[]=',Opal.to_a($writer));return $writer[$rb_minus($writer["length"],1)];}else{return nil}}else{return nil};},$SocketMonitor_on$2.$$arity=-1);return(Opal.def(self,'$follow_up',$SocketMonitor_follow_up$3=function $$follow_up(options){var self=this,operation_frame=nil,the_operation=nil;if(options==null){options=$hash2([],{});};operation_frame=$$$($$($nesting,'GxG'),'DISPLAY_DETAILS')['$[]']("socket").$next_message();if($truthy(operation_frame['$is_a?']($$$('::','Hash')))){the_operation=operation_frame.$keys()['$[]'](0);if($truthy(self.event_handlers['$[]'](the_operation)['$respond_to?']("call"))){return self.event_handlers['$[]'](the_operation).$call(operation_frame['$[]'](the_operation))}else{return nil};}else{return nil};},$SocketMonitor_follow_up$3.$$arity=-1),nil)&&'follow_up';})($nesting[0],null,$nesting);return(function($base,$super,$parent_nesting){var self=$klass($base,$super,'Socket');var $nesting=[self].concat($parent_nesting),$Socket_inbox$4,$Socket_add_to_inbox$5,$Socket_error_message$6,$Socket_next_message$7,$Socket_write$8,$Socket_close$9,$Socket_open$ques$10,$Socket_open$11,$Socket_set_remote_uuid$12,$Socket_initialize$13;self.$$prototype.inbox=self.$$prototype.socket=nil;Opal.def(self,'$inbox',$Socket_inbox$4=function $$inbox(){var self=this;return self.inbox},$Socket_inbox$4.$$arity=0);Opal.def(self,'$add_to_inbox',$Socket_add_to_inbox$5=function $$add_to_inbox(payload){var self=this,the_error=nil;if(payload==null){payload="";};try{return self.inbox['$<<']($$$('::','JSON').$parse(payload.$decode64(),$hash2(["symbolize_names"],{"symbolize_names":true})))}catch($err){if(Opal.rescue($err,[$$($nesting,'Exception')])){(the_error=$err) +var self=Opal.top,$nesting=[],nil=Opal.nil,$$$=Opal.$$$,$$=Opal.$$,$module=Opal.module,$klass=Opal.klass,$hash2=Opal.hash2,$truthy=Opal.truthy,$send=Opal.send;Opal.add_stubs(['$is_any?','$respond_to?','$to_sym','$downcase','$to_s','$[]=','$-','$next_message','$[]','$is_a?','$keys','$call','$<<','$parse','$decode64','$log_error','$new','$shift','$encode64','$generate','$export','$include?','$to_json','$valid_uuid?','$uuid_generate','$new_message','$pull','$cancel_timer','$get_attribute','$>','$size','$to_i','$<','$log_info','$inspect','$element','$open?','$pull_data','$to_proc','$body','$fail','$succeed','$+','$==','$base64?','$json?','$process_detached_import','$on','$push','$uuid','$format','$search','$constraint','$each','$clone','$gxg_export','$push_data','$set_busy','$encrypt','$id','$basename','$split','$index','$join','$post_event','$sleep','$navigate_to','$open','$gsub','$add_periodic_timer','$follow_up','$heartbeat']);return(function($base,$parent_nesting){var self=$module($base,'GxG');var $nesting=[self].concat($parent_nesting);(function($base,$parent_nesting){var self=$module($base,'Networking');var $nesting=[self].concat($parent_nesting);(function($base,$super,$parent_nesting){var self=$klass($base,$super,'SocketMonitor');var $nesting=[self].concat($parent_nesting),$SocketMonitor_initialize$1,$SocketMonitor_on$2,$SocketMonitor_follow_up$3;self.$$prototype.event_handlers=nil;Opal.def(self,'$initialize',$SocketMonitor_initialize$1=function $$initialize(){var self=this;self.event_handlers=$hash2([],{});return self;},$SocketMonitor_initialize$1.$$arity=0);Opal.def(self,'$on',$SocketMonitor_on$2=function $$on(the_operation){var $iter=$SocketMonitor_on$2.$$p,block=$iter||nil,self=this,$writer=nil;if($iter)$SocketMonitor_on$2.$$p=null;if($iter)$SocketMonitor_on$2.$$p=null;;if(the_operation==null){the_operation=nil;};if($truthy(the_operation['$is_any?']($$$('::','String'),$$$('::','Symbol')))){if($truthy(block['$respond_to?']("call"))){$writer=[the_operation.$to_s().$downcase().$to_sym(),block];$send(self.event_handlers,'[]=',Opal.to_a($writer));return $writer[$rb_minus($writer["length"],1)];}else{return nil}}else{return nil};},$SocketMonitor_on$2.$$arity=-1);return(Opal.def(self,'$follow_up',$SocketMonitor_follow_up$3=function $$follow_up(options){var self=this,operation_frame=nil,the_operation=nil;if(options==null){options=$hash2([],{});};operation_frame=$$$($$($nesting,'GxG'),'DISPLAY_DETAILS')['$[]']("socket").$next_message();if($truthy(operation_frame['$is_a?']($$$('::','Hash')))){the_operation=operation_frame.$keys()['$[]'](0);if($truthy(self.event_handlers['$[]'](the_operation)['$respond_to?']("call"))){return self.event_handlers['$[]'](the_operation).$call(operation_frame['$[]'](the_operation))}else{return nil};}else{return nil};},$SocketMonitor_follow_up$3.$$arity=-1),nil)&&'follow_up';})($nesting[0],null,$nesting);return(function($base,$super,$parent_nesting){var self=$klass($base,$super,'Socket');var $nesting=[self].concat($parent_nesting),$Socket_inbox$4,$Socket_add_to_inbox$5,$Socket_error_message$6,$Socket_next_message$7,$Socket_write$8,$Socket_close$9,$Socket_open$ques$10,$Socket_open$11,$Socket_set_remote_uuid$12,$Socket_initialize$13;self.$$prototype.inbox=self.$$prototype.socket=nil;Opal.def(self,'$inbox',$Socket_inbox$4=function $$inbox(){var self=this;return self.inbox},$Socket_inbox$4.$$arity=0);Opal.def(self,'$add_to_inbox',$Socket_add_to_inbox$5=function $$add_to_inbox(payload){var self=this,the_error=nil;if(payload==null){payload="";};try{return self.inbox['$<<']($$$('::','JSON').$parse(payload.$decode64(),$hash2(["symbolize_names"],{"symbolize_names":true})))}catch($err){if(Opal.rescue($err,[$$($nesting,'Exception')])){(the_error=$err) try{return self.$log_error($hash2(["error","parameters"],{"error":the_error,"parameters":payload.$decode64()}))}finally{Opal.pop_exception();}}else{throw $err;}};},$Socket_add_to_inbox$5.$$arity=-1);Opal.def(self,'$error_message',$Socket_error_message$6=function $$error_message(the_message){var self=this;return self.$log_error($hash2(["error"],{"error":$$($nesting,'Exception').$new(the_message)}))},$Socket_error_message$6.$$arity=1);Opal.def(self,'$next_message',$Socket_next_message$7=function $$next_message(){var self=this;return self.inbox.$shift()},$Socket_next_message$7.$$arity=0);Opal.def(self,'$write',$Socket_write$8=function $$write(the_data){var self=this,thesocket=nil;if(the_data==null){the_data="";};if($truthy(the_data['$is_any?']($$$('::','Hash'),$$$($$$($$$('::','GxG'),'Database'),'DetachedHash')))){if($truthy(the_data['$is_a?']($$$('::','Hash')))){the_data=$$($nesting,'JSON').$generate(the_data).$encode64()}else{the_data=$$($nesting,'JSON').$generate(the_data.$export()).$encode64()}};thesocket=self.socket;if($truthy(thesocket)){thesocket.send(the_data);return true;}else{return false};},$Socket_write$8.$$arity=-1);Opal.def(self,'$close',$Socket_close$9=function $$close(){var self=this,thesocket=nil;thesocket=self.socket;if($truthy(thesocket)){thesocket.close;self.socket=nil;return true;}else{return false};},$Socket_close$9.$$arity=0);Opal.def(self,'$open?',$Socket_open$ques$10=function(){var self=this;if($truthy(self.socket)){return true}else{return false}},$Socket_open$ques$10.$$arity=0);Opal.def(self,'$open',$Socket_open$11=function $$open(the_location){var self=this,the_url=nil,greeting=nil,the_socket=nil,the_error=nil,$writer=nil;self.socket=nil;if($truthy((window.location['href'])['$include?']("https://"))){the_url=""+"wss://"+(the_location)}else{the_url=""+"ws://"+(the_location)};try{greeting=$hash2(["attach_display"],{"attach_display":true}).$to_json().$encode64();the_socket=new WebSocket(the_url);the_socket.onopen=function(e){the_socket.send(greeting);};the_socket.onmessage=function(event){Opal.eval("GxG::DISPLAY_DETAILS[:socket].add_to_inbox('"+event.data+"')");};the_socket.onclose=function(event){Opal.eval("GxG::DISPLAY_DETAILS[:socket].close");};the_socket.onerror=function(error){Opal.eval("GxG::DISPLAY_DETAILS[:socket].error_message('"+error.message+"')");};;self.socket=the_socket;}catch($err){if(Opal.rescue($err,[$$($nesting,'Exception')])){(the_error=$err) -try{self.$log_error($hash2(["error","parameters"],{"error":the_error,"parameters":$hash2(["url"],{"url":the_url.$to_s()})}))}finally{Opal.pop_exception();}}else{throw $err;}};;if($truthy(self.socket)){$writer=["socket",self];$send($$$($$$('::','GxG'),'DISPLAY_DETAILS'),'[]=',Opal.to_a($writer));return $writer[$rb_minus($writer["length"],1)];}else{return nil};},$Socket_open$11.$$arity=1);Opal.def(self,'$set_remote_uuid',$Socket_set_remote_uuid$12=function $$set_remote_uuid(the_uuid){var self=this;if(the_uuid==null){the_uuid=nil;};if($truthy($$($nesting,'GxG')['$valid_uuid?'](the_uuid))){self.remote_uuid=the_uuid.$to_sym();return true;}else{return false};},$Socket_set_remote_uuid$12.$$arity=-1);return(Opal.def(self,'$initialize',$Socket_initialize$13=function $$initialize(){var self=this;self.uuid=$$($nesting,'GxG').$uuid_generate().$to_sym();self.remote_uuid=nil;self.inbox=[];return self;},$Socket_initialize$13.$$arity=0),nil)&&'initialize';})($nesting[0],null,$nesting);})($nesting[0],$nesting);return(function($base,$parent_nesting){var self=$module($base,'Networking');var $nesting=[self].concat($parent_nesting);(function($base,$super,$parent_nesting){var self=$klass($base,$super,'Channel');var $nesting=[self].concat($parent_nesting);return nil})($nesting[0],null,$nesting);return(function($base,$super,$parent_nesting){var self=$klass($base,$super,'Connector');var $nesting=[self].concat($parent_nesting),$Connector_remote_uuid$14,$Connector_open$ques$15,$Connector_close$16,$Connector_post$17,$Connector_push$20,$Connector_pull$23,$Connector_push_message$26,$Connector_pull_message$27,$Connector_process_pending$28,$Connector_push_object_portions$29,$Connector_search_database$30,$Connector_search_pull$32,$Connector_destroy_object$34,$Connector_push_data$36,$Connector_push_object$38,$Connector_pull_data$42,$Connector_pull_object$44,$Connector_load_format$46,$Connector_store_format$48,$Connector_get_permissions$52,$Connector_call_event$54,$Connector_library_pull$56,$Connector_format_pull$58,$Connector_format_push$60,$Connector_format_list$62,$Connector_admin$64,$Connector_vfs$66,$Connector_app_state_push$68,$Connector_app_state_pull$70,$Connector_application_open$72,$Connector_application_close$75,$Connector_application_list$77,$Connector_application_menu$79,$Connector_entries$81,$Connector_heartbeat$83,$Connector_update_credential$85,$Connector_downgrade_credential$88,$Connector_action$90,$Connector_relative_url$91,$Connector_query$92,$Connector_article$93,$Connector_display_path$94,$Connector_initialize$95;self.$$prototype.remote_uuid=self.$$prototype.active=self.$$prototype.uuid=self.$$prototype.heart_beat_timer=self.$$prototype.relative_url=self.$$prototype.host_prefix=self.$$prototype.display_path=self.$$prototype.csrf=self.$$prototype.query=self.$$prototype.article=nil;Opal.def(self,'$remote_uuid',$Connector_remote_uuid$14=function $$remote_uuid(){var self=this;return self.remote_uuid},$Connector_remote_uuid$14.$$arity=0);Opal.def(self,'$open?',$Connector_open$ques$15=function(){var self=this;return self.active},$Connector_open$ques$15.$$arity=0);Opal.def(self,'$close',$Connector_close$16=function $$close(){var self=this,the_message=nil,$writer=nil;the_message=self.$new_message($hash2(["close"],{"close":true}));$writer=["sender",self.uuid];$send(the_message,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$writer=["to",self.remote_uuid];$send(the_message,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;self.$pull(the_message,$hash2(["synchronous"],{"synchronous":true}));self.active=false;self.csrf=nil;if($truthy(self.heart_beat_timer['$is_a?']($$$('::','Hash')))){$$$($$($nesting,'GxG'),'DISPATCHER').$cancel_timer(self.heart_beat_timer)};return true;},$Connector_close$16.$$arity=0);Opal.def(self,'$post',$Connector_post$17=function $$post(form_data,options){var $iter=$Connector_post$17.$$p,handler=$iter||nil,$$18,$$19,self=this,action=nil,the_url=nil,the_xhr=nil,$ret_or_1=nil,failed=nil,succeeded=nil;if($iter)$Connector_post$17.$$p=null;if($iter)$Connector_post$17.$$p=null;;if(form_data==null){form_data="";};if(options==null){options=$hash2([],{});};if($truthy(self.active)){if($truthy(form_data['$is_a?']($$$($$$($$$('::','GxG'),'Gui'),'Form')))){action=form_data.$get_attribute("action").$to_s();if($truthy($rb_gt(action.$size(),0))){if($truthy($rb_gt(self.relative_url.$to_s().$size(),0))){the_url=""+(self.host_prefix)+(self.relative_url.$to_s())+(action.$to_s())+"?display="+(self.display_path.$to_s())}else{the_url=""+(self.host_prefix)+(action.$to_s())+"?display="+(self.display_path.$to_s())}}else if($truthy($rb_gt(self.relative_url.$to_s().$size(),0))){the_url=""+(self.host_prefix)+(self.relative_url.$to_s())+"?display="+(self.display_path.$to_s())}else{the_url=""+(self.host_prefix)+"?display="+(self.display_path.$to_s())};the_xhr=new XMLHttpRequest;the_xhr.open('POST',the_url,true);the_xhr.timeout=(function(){if($truthy(($ret_or_1=options['$[]']("timeout")))){return $ret_or_1}else{return 5000};return nil;})();the_xhr.setRequestHeader('X-Requested-With','XMLHttpRequest');the_xhr.setRequestHeader('Accept','application/json');the_xhr.setRequestHeader('X-CSRF-Token',self.csrf);the_xhr.setRequestHeader('Content-Type','multipart/form-data');failed=$send($$($nesting,'Proc'),'new',[],($$18=function(reason){var self=$$18.$$s==null?this:$$18.$$s;if(reason==null){reason=$hash2(["error"],{"error":"unknown"});};return self.$log_error(reason);},$$18.$$s=self,$$18.$$arity=-1,$$18));succeeded=$send($$($nesting,'Proc'),'new',[],($$19=function(){var self=$$19.$$s==null?this:$$19.$$s,response_code=nil,the_response=nil,the_error=nil;response_code=(the_xhr.status).$to_i();if($truthy($rb_lt(response_code,300))){try{the_response=$$$('::','JSON').$parse(the_xhr.response,$hash2(["symbolize_names"],{"symbolize_names":true}));self.$log_info(the_response.$inspect());if($truthy(handler['$respond_to?']("call"))){return handler.$call(the_response)}else{return nil};}catch($err){if(Opal.rescue($err,[$$($nesting,'Exception')])){(the_error=$err) +try{self.$log_error($hash2(["error","parameters"],{"error":the_error,"parameters":$hash2(["url"],{"url":the_url.$to_s()})}))}finally{Opal.pop_exception();}}else{throw $err;}};;if($truthy(self.socket)){$writer=["socket",self];$send($$$($$$('::','GxG'),'DISPLAY_DETAILS'),'[]=',Opal.to_a($writer));return $writer[$rb_minus($writer["length"],1)];}else{return nil};},$Socket_open$11.$$arity=1);Opal.def(self,'$set_remote_uuid',$Socket_set_remote_uuid$12=function $$set_remote_uuid(the_uuid){var self=this;if(the_uuid==null){the_uuid=nil;};if($truthy($$($nesting,'GxG')['$valid_uuid?'](the_uuid))){self.remote_uuid=the_uuid.$to_sym();return true;}else{return false};},$Socket_set_remote_uuid$12.$$arity=-1);return(Opal.def(self,'$initialize',$Socket_initialize$13=function $$initialize(){var self=this;self.uuid=$$($nesting,'GxG').$uuid_generate().$to_sym();self.remote_uuid=nil;self.inbox=[];return self;},$Socket_initialize$13.$$arity=0),nil)&&'initialize';})($nesting[0],null,$nesting);})($nesting[0],$nesting);return(function($base,$parent_nesting){var self=$module($base,'Networking');var $nesting=[self].concat($parent_nesting);(function($base,$super,$parent_nesting){var self=$klass($base,$super,'Channel');var $nesting=[self].concat($parent_nesting);return nil})($nesting[0],null,$nesting);return(function($base,$super,$parent_nesting){var self=$klass($base,$super,'Connector');var $nesting=[self].concat($parent_nesting),$Connector_remote_uuid$14,$Connector_open$ques$15,$Connector_close$16,$Connector_post$17,$Connector_download_file$20,$Connector_push$21,$Connector_pull$24,$Connector_push_message$27,$Connector_pull_message$28,$Connector_process_pending$29,$Connector_push_object_portions$30,$Connector_search_database$31,$Connector_search_pull$32,$Connector_destroy_object$34,$Connector_push_data$36,$Connector_push_object$38,$Connector_pull_data$42,$Connector_pull_object$44,$Connector_load_format$46,$Connector_store_format$48,$Connector_get_permissions$52,$Connector_call_event$54,$Connector_library_pull$55,$Connector_format_pull$57,$Connector_format_push$59,$Connector_format_list$61,$Connector_admin$63,$Connector_vfs$65,$Connector_app_state_push$67,$Connector_app_state_pull$69,$Connector_application_open$71,$Connector_application_close$74,$Connector_application_list$76,$Connector_application_menu$78,$Connector_entries$80,$Connector_heartbeat$82,$Connector_update_credential$84,$Connector_downgrade_credential$87,$Connector_action$89,$Connector_relative_url$90,$Connector_query$91,$Connector_article$92,$Connector_display_path$93,$Connector_initialize$94;self.$$prototype.remote_uuid=self.$$prototype.active=self.$$prototype.uuid=self.$$prototype.heart_beat_timer=self.$$prototype.relative_url=self.$$prototype.host_prefix=self.$$prototype.display_path=self.$$prototype.csrf=self.$$prototype.query=self.$$prototype.article=nil;Opal.def(self,'$remote_uuid',$Connector_remote_uuid$14=function $$remote_uuid(){var self=this;return self.remote_uuid},$Connector_remote_uuid$14.$$arity=0);Opal.def(self,'$open?',$Connector_open$ques$15=function(){var self=this;return self.active},$Connector_open$ques$15.$$arity=0);Opal.def(self,'$close',$Connector_close$16=function $$close(){var self=this,the_message=nil,$writer=nil;the_message=self.$new_message($hash2(["close"],{"close":true}));$writer=["sender",self.uuid];$send(the_message,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$writer=["to",self.remote_uuid];$send(the_message,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;self.$pull(the_message,$hash2(["synchronous"],{"synchronous":true}));self.active=false;self.csrf=nil;if($truthy(self.heart_beat_timer['$is_a?']($$$('::','Hash')))){$$$($$($nesting,'GxG'),'DISPATCHER').$cancel_timer(self.heart_beat_timer)};return true;},$Connector_close$16.$$arity=0);Opal.def(self,'$post',$Connector_post$17=function $$post(form_data,options){var $iter=$Connector_post$17.$$p,handler=$iter||nil,$$18,$$19,self=this,action=nil,the_url=nil,the_xhr=nil,$ret_or_1=nil,failed=nil,succeeded=nil;if($iter)$Connector_post$17.$$p=null;if($iter)$Connector_post$17.$$p=null;;if(form_data==null){form_data="";};if(options==null){options=$hash2([],{});};if($truthy(self.active)){if($truthy(form_data['$is_a?']($$$($$$($$$('::','GxG'),'Gui'),'Form')))){action=form_data.$get_attribute("action").$to_s();if($truthy($rb_gt(action.$size(),0))){if($truthy($rb_gt(self.relative_url.$to_s().$size(),0))){the_url=""+(self.host_prefix)+(self.relative_url.$to_s())+(action.$to_s())+"?display="+(self.display_path.$to_s())}else{the_url=""+(self.host_prefix)+(action.$to_s())+"?display="+(self.display_path.$to_s())}}else if($truthy($rb_gt(self.relative_url.$to_s().$size(),0))){the_url=""+(self.host_prefix)+(self.relative_url.$to_s())+"?display="+(self.display_path.$to_s())}else{the_url=""+(self.host_prefix)+"?display="+(self.display_path.$to_s())};the_xhr=new XMLHttpRequest;the_xhr.open('POST',the_url,true);the_xhr.timeout=(function(){if($truthy(($ret_or_1=options['$[]']("timeout")))){return $ret_or_1}else{return 5000};return nil;})();the_xhr.setRequestHeader('X-Requested-With','XMLHttpRequest');the_xhr.setRequestHeader('Accept','application/json');the_xhr.setRequestHeader('X-CSRF-Token',self.csrf);the_xhr.setRequestHeader('Content-Type','multipart/form-data');failed=$send($$($nesting,'Proc'),'new',[],($$18=function(reason){var self=$$18.$$s==null?this:$$18.$$s;if(reason==null){reason=$hash2(["error"],{"error":"unknown"});};return self.$log_error(reason);},$$18.$$s=self,$$18.$$arity=-1,$$18));succeeded=$send($$($nesting,'Proc'),'new',[],($$19=function(){var self=$$19.$$s==null?this:$$19.$$s,response_code=nil,the_response=nil,the_error=nil;response_code=(the_xhr.status).$to_i();if($truthy($rb_lt(response_code,300))){try{the_response=$$$('::','JSON').$parse(the_xhr.response,$hash2(["symbolize_names"],{"symbolize_names":true}));self.$log_info(the_response.$inspect());if($truthy(handler['$respond_to?']("call"))){return handler.$call(the_response)}else{return nil};}catch($err){if(Opal.rescue($err,[$$($nesting,'Exception')])){(the_error=$err) try{return self.$log_error($hash2(["error","parameters"],{"error":the_error,"parameters":the_xhr.response}))}finally{Opal.pop_exception();}}else{throw $err;}};}else{try{return failed.$call($$$('::','JSON').$parse(the_xhr.response,$hash2(["symbolize_names"],{"symbolize_names":true})))}catch($err){if(Opal.rescue($err,[$$($nesting,'Exception')])){(the_error=$err) -try{return self.$log_error($hash2(["error","parameters"],{"error":the_error,"parameters":the_xhr.response}))}finally{Opal.pop_exception();}}else{throw $err;}};};},$$19.$$s=self,$$19.$$arity=0,$$19));the_xhr.addEventListener('load',succeeded);the_xhr.addEventListener('error',failed);the_xhr.addEventListener('timeout',failed);the_xhr.addEventListener('abort',failed);the_xhr.send(form_data.$element());return true;}else{return false}}else{return nil};},$Connector_post$17.$$arity=-1);Opal.def(self,'$push',$Connector_push$20=function $$push(the_message,options){var $$21,$$22,self=this,the_url=nil,payload=nil,the_xhr=nil,$ret_or_2=nil,failed=nil,succeeded=nil;if(the_message==null){the_message=nil;};if(options==null){options=$hash2([],{});};if($truthy(self.active)){if($truthy(the_message['$is_a?']($$$($$$($$$('::','GxG'),'Events'),'Message')))){if($truthy($rb_gt(self.relative_url.$to_s().$size(),0))){the_url=""+(self.host_prefix)+(self.relative_url.$to_s())+"?display="+(self.display_path.$to_s())}else{the_url=""+(self.host_prefix)+"?display="+(self.display_path.$to_s())};payload=the_message.$body().$to_json().$to_s();the_xhr=new XMLHttpRequest;the_xhr.open('PUT',the_url,true);the_xhr.timeout=(function(){if($truthy(($ret_or_2=options['$[]']("timeout")))){return $ret_or_2}else{return 5000};return nil;})();the_xhr.setRequestHeader('X-Requested-With','XMLHttpRequest');the_xhr.setRequestHeader('Accept','application/json');the_xhr.setRequestHeader('X-CSRF-Token',self.csrf);the_xhr.setRequestHeader('Content-Type','application/json');failed=$send($$($nesting,'Proc'),'new',[],($$21=function(reason){var self=$$21.$$s==null?this:$$21.$$s;if(reason==null){reason=nil;};return the_message.$fail(reason);},$$21.$$s=self,$$21.$$arity=-1,$$21));succeeded=$send($$($nesting,'Proc'),'new',[],($$22=function(){var self=$$22.$$s==null?this:$$22.$$s,response_code=nil,the_error=nil;response_code=(the_xhr.status).$to_i();if($truthy($rb_lt(response_code,300))){try{return the_message.$succeed($$$('::','JSON').$parse(the_xhr.response,$hash2(["symbolize_names"],{"symbolize_names":true})))}catch($err){if(Opal.rescue($err,[$$($nesting,'Exception')])){(the_error=$err) -try{return self.$log_error($hash2(["error","parameters"],{"error":the_error,"parameters":the_xhr.response}))}finally{Opal.pop_exception();}}else{throw $err;}};}else{return failed.$call(response_code)};},$$22.$$s=self,$$22.$$arity=0,$$22));the_xhr.addEventListener('load',succeeded);the_xhr.addEventListener('error',failed);the_xhr.addEventListener('timeout',failed);the_xhr.addEventListener('abort',failed);the_xhr.send(payload);return true;}else{return false}}else{return nil};},$Connector_push$20.$$arity=-1);Opal.def(self,'$pull',$Connector_pull$23=function $$pull(the_message,options){var $$24,$$25,self=this,the_query=nil,the_url=nil,the_xhr=nil,$ret_or_3=nil,failed=nil,succeeded=nil;if(the_message==null){the_message=nil;};if(options==null){options=$hash2(["synchronous"],{"synchronous":false});};if($truthy(self.active)){if($truthy(the_message['$is_a?']($$$($$$($$$('::','GxG'),'Events'),'Message')))){the_query=""+"display="+(self.display_path.$to_s())+"&details="+(the_message.$body().$to_json().$encode64());if($truthy($rb_gt(self.relative_url.$to_s().$size(),0))){the_url=$rb_plus($rb_plus($rb_plus(self.host_prefix.$to_s(),self.relative_url.$to_s()),"?"),the_query)}else{the_url=$rb_plus($rb_plus(self.host_prefix.$to_s(),"?"),the_query)};the_xhr=new XMLHttpRequest;if(options['$[]']("synchronous")['$=='](true)){the_xhr.open('GET',the_url.$to_s(),false)}else{the_xhr.open('GET',the_url.$to_s(),true);the_xhr.timeout=(function(){if($truthy(($ret_or_3=options['$[]']("timeout")))){return $ret_or_3}else{return 600000};return nil;})();};the_xhr.setRequestHeader('X-Requested-With','XMLHttpRequest');the_xhr.setRequestHeader('Accept','application/json');failed=$send($$($nesting,'Proc'),'new',[],($$24=function(reason){var self=$$24.$$s==null?this:$$24.$$s;if(reason==null){reason=nil;};return the_message.$fail(reason);},$$24.$$s=self,$$24.$$arity=-1,$$24));succeeded=$send($$($nesting,'Proc'),'new',[],($$25=function(){var self=$$25.$$s==null?this:$$25.$$s,response_code=nil,the_error=nil;response_code=(the_xhr.status).$to_i();if($truthy($rb_lt(response_code,300))){try{return the_message.$succeed($$$('::','JSON').$parse(the_xhr.response,$hash2(["symbolize_names"],{"symbolize_names":true})))}catch($err){if(Opal.rescue($err,[$$($nesting,'Exception')])){(the_error=$err) -try{return self.$log_error($hash2(["error","parameters"],{"error":the_error,"parameters":the_xhr.response}))}finally{Opal.pop_exception();}}else{throw $err;}};}else{return failed.$call(response_code)};},$$25.$$s=self,$$25.$$arity=0,$$25));the_xhr.addEventListener('load',succeeded);the_xhr.addEventListener('error',failed);the_xhr.addEventListener('timeout',failed);the_xhr.addEventListener('abort',failed);the_xhr.send(null);return true;}else{return false}}else{return nil};},$Connector_pull$23.$$arity=-1);Opal.def(self,'$push_message',$Connector_push_message$26=function $$push_message(the_message){var self=this;if(the_message==null){the_message=nil;};return nil;},$Connector_push_message$26.$$arity=-1);Opal.def(self,'$pull_message',$Connector_pull_message$27=function $$pull_message(options){var self=this;if(options==null){options=$hash2([],{});};return nil;},$Connector_pull_message$27.$$arity=-1);Opal.def(self,'$process_pending',$Connector_process_pending$28=function $$process_pending(options){var self=this;if(options==null){options=$hash2([],{});};return nil;},$Connector_process_pending$28.$$arity=-1);Opal.def(self,'$push_object_portions',$Connector_push_object_portions$29=function $$push_object_portions(details,error_handler){var $iter=$Connector_push_object_portions$29.$$p,the_handler=$iter||nil,self=this;if($iter)$Connector_push_object_portions$29.$$p=null;if($iter)$Connector_push_object_portions$29.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};return nil;},$Connector_push_object_portions$29.$$arity=-1);Opal.def(self,'$search_database',$Connector_search_database$30=function $$search_database(details,error_handler){var $iter=$Connector_search_database$30.$$p,the_handler=$iter||nil,$$31,self=this,$ret_or_4=nil;if($iter)$Connector_search_database$30.$$p=null;if($iter)$Connector_search_database$30.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy((function(){if($truthy(($ret_or_4=details['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_4};return nil;})())){$send(self,'pull_data',[$hash2(["search_database"],{"search_database":$hash2(["criteria"],{"criteria":details})}),error_handler],($$31=function(data){var self=$$31.$$s==null?this:$$31.$$s;if(data==null){data=nil;};if($truthy(data['$is_a?']($$$('::','Hash')))){return the_handler.$call(data)}else{return nil};},$$31.$$s=self,$$31.$$arity=1,$$31));return true;}else{return false};},$Connector_search_database$30.$$arity=-1);Opal.def(self,'$search_pull',$Connector_search_pull$32=function $$search_pull(details,error_handler){var $iter=$Connector_search_pull$32.$$p,the_handler=$iter||nil,$$33,self=this,$ret_or_5=nil;if($iter)$Connector_search_pull$32.$$p=null;if($iter)$Connector_search_pull$32.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy((function(){if($truthy(($ret_or_5=details['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_5};return nil;})())){$send(self,'pull_data',[$hash2(["search_pull"],{"search_pull":$hash2(["criteria"],{"criteria":details})}),error_handler],($$33=function(data){var self=$$33.$$s==null?this:$$33.$$s,the_error=nil;if(data==null){data=nil;};if($truthy(data['$is_a?']($$$('::','Hash')))){if($truthy(data['$[]']("result"))){if($truthy(data['$[]']("result")['$is_a?']($$$('::','String')))){if($truthy(data['$[]']("result").$to_s()['$base64?']())){data=data['$[]']("result").$decode64()};if($truthy(data.$to_s()['$json?']())){try{data=$$$('::','JSON').$parse(data.$to_s(),$hash2(["symbolize_names"],{"symbolize_names":true}));return the_handler.$call($$$($$$('::','GxG'),'Database').$process_detached_import(data));}catch($err){if(Opal.rescue($err,[$$($nesting,'Exception')])){(the_error=$err) -try{return self.$log_error($hash2(["error","parameters"],{"error":the_error,"parameters":$hash2(["data"],{"data":data})}))}finally{Opal.pop_exception();}}else{throw $err;}};}else{return nil};}else{return self.$log_error($hash2(["error","parameters"],{"error":$$($nesting,'Exception').$new("Malformed Response Data"),"parameters":$hash2(["data"],{"data":data['$[]']("result")})}))}}else if($truthy(data['$[]']("error"))){if($truthy(error_handler['$respond_to?']("call"))){return error_handler.$call(data)}else{return nil}}else{return nil}}else{return nil};},$$33.$$s=self,$$33.$$arity=1,$$33));return true;}else{return false};},$Connector_search_pull$32.$$arity=-1);Opal.def(self,'$destroy_object',$Connector_destroy_object$34=function $$destroy_object(the_specifier,error_handler){var $iter=$Connector_destroy_object$34.$$p,the_handler=$iter||nil,$$35,self=this,$ret_or_6=nil;if($iter)$Connector_destroy_object$34.$$p=null;if($iter)$Connector_destroy_object$34.$$p=null;;if(the_specifier==null){the_specifier=nil;};if(error_handler==null){error_handler=nil;};if($truthy((function(){if($truthy(($ret_or_6=the_specifier))){return the_handler}else{return $ret_or_6};return nil;})())){$send(self,'pull_data',[$hash2(["destroy_object"],{"destroy_object":$hash2(["path"],{"path":the_specifier})}),error_handler],($$35=function(data){var self=$$35.$$s==null?this:$$35.$$s;if(data==null){data=nil;};if($truthy(data['$is_a?']($$$('::','Hash')))){return the_handler.$call(data)}else{return nil};},$$35.$$s=self,$$35.$$arity=1,$$35));return true;}else{return false};},$Connector_destroy_object$34.$$arity=-1);Opal.def(self,'$push_data',$Connector_push_data$36=function $$push_data(details,error_handler){var $iter=$Connector_push_data$36.$$p,the_handler=$iter||nil,$$37,self=this,$ret_or_7=nil,the_message=nil,$writer=nil;if($iter)$Connector_push_data$36.$$p=null;if($iter)$Connector_push_data$36.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy((function(){if($truthy(($ret_or_7=details['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_7};return nil;})())){the_message=self.$new_message(details);$writer=["sender",self.uuid];$send(the_message,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$writer=["to",self.remote_uuid];$send(the_message,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;if($truthy(error_handler['$respond_to?']("call"))){$send(the_message,'on',["fail"],error_handler.$to_proc())};$send(the_message,'on',["success"],($$37=function(response){var self=$$37.$$s==null?this:$$37.$$s;if(response==null){response=nil;};return the_handler.$call(response);},$$37.$$s=self,$$37.$$arity=1,$$37));$$$($$($nesting,'GxG'),'CONNECTION').$push(the_message);return true;}else{return false};},$Connector_push_data$36.$$arity=-1);Opal.def(self,'$push_object',$Connector_push_object$38=function $$push_object(details,error_handler){var $iter=$Connector_push_object$38.$$p,the_handler=$iter||nil,$$39,$$40,$$41,self=this,$ret_or_8=nil,exception=nil,payload=nil,$writer=nil,format_list=nil,importation_record=nil;if($iter)$Connector_push_object$38.$$p=null;if($iter)$Connector_push_object$38.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy((function(){if($truthy(($ret_or_8=details['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_8};return nil;})())){exception=nil;payload=$hash2([],{});if($truthy(details['$[]']("object")['$is_any?']($$$($$$('::','GxG'),'BinaryArray'),$$$('::','String')))){if($truthy($rb_gt(details['$[]']("path").$to_s().$size(),0))){$writer=["path",details['$[]']("path")];$send(payload,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$writer=["object",details['$[]']("object").$to_s().$encode64()];$send(payload,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;}else{exception="You MUST specify a :path to store the data into."}}else if($truthy(details['$[]']("object")['$is_a?']($$$($$$($$$('::','GxG'),'Database'),'DetachedHash')))){if($truthy($rb_gt(details['$[]']("path").$to_s().$size(),0))){$writer=["path",details['$[]']("path")];$send(payload,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];};$writer=["uuid",details['$[]']("object").$uuid().$to_s()];$send(payload,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;format_list=[];importation_record=$hash2(["formats","records"],{"formats":$hash2([],{}),"records":[]});if($truthy($rb_gt(details['$[]']("object").$format().$to_s().$size(),0))){format_list['$<<'](details['$[]']("object").$format())};$send(details['$[]']("object"),'search',[],($$39=function(value,selector,container){var self=$$39.$$s==null?this:$$39.$$s;if(value==null){value=nil;};if(selector==null){selector=nil;};if(container==null){container=nil;};if($truthy(value['$is_a?']($$$($$$($$$('::','GxG'),'Database'),'DetachedHash')))){if($truthy($rb_gt(value.$format().$to_s().$size(),0))){format_list['$<<'](value.$format())}};if($truthy(value['$is_a?']($$$($$$($$$('::','GxG'),'Database'),'PersistedArray')))){if($truthy($rb_gt(value.$constraint().$to_s().$size(),0))){return format_list['$<<'](value.$constraint())}else{return nil}}else{return nil};},$$39.$$s=self,$$39.$$arity=3,$$39));$send(format_list,'each',[],($$40=function(the_specifier){var self=$$40.$$s==null?this:$$40.$$s,format_record=nil;if(the_specifier==null){the_specifier=nil;};format_record=$$$($$($nesting,'GxG'),'DB')['$[]']("formats")['$[]'](the_specifier.$to_s().$to_sym()).$clone();if($truthy(format_record['$is_a?']($$$('::','Hash')))){$writer=["content",format_record['$[]']("content").$gxg_export()];$send(format_record,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$writer=[the_specifier.$to_s().$to_sym(),format_record];$send(importation_record['$[]']("formats"),'[]=',Opal.to_a($writer));return $writer[$rb_minus($writer["length"],1)];;}else{return nil};},$$40.$$s=self,$$40.$$arity=1,$$40));importation_record['$[]']("records")['$<<'](details['$[]']("object").$export());$writer=["object",importation_record];$send(payload,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;}else{exception="Invalid Data Type"};if($truthy(exception)){if($truthy(error_handler['$respond_to?']("call"))){error_handler.$call($hash2(["result","error"],{"result":nil,"error":exception}))};return false;}else{$send(self,'push_data',[$hash2(["put_object"],{"put_object":payload}),error_handler],($$41=function(data){var self=$$41.$$s==null?this:$$41.$$s;if(data==null){data=nil;};if($truthy(data['$is_a?']($$$('::','Hash')))){return the_handler.$call(data)}else{return nil};},$$41.$$s=self,$$41.$$arity=1,$$41));return true;};}else{return false};},$Connector_push_object$38.$$arity=-1);Opal.def(self,'$pull_data',$Connector_pull_data$42=function $$pull_data(the_specifier,error_handler){var $iter=$Connector_pull_data$42.$$p,the_handler=$iter||nil,$$43,self=this,$ret_or_9=nil,the_message=nil,$writer=nil;if($iter)$Connector_pull_data$42.$$p=null;if($iter)$Connector_pull_data$42.$$p=null;;if(the_specifier==null){the_specifier=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy((function(){if($truthy(($ret_or_9=the_specifier))){return the_handler}else{return $ret_or_9};return nil;})())){the_message=self.$new_message(the_specifier);$writer=["sender",self.uuid];$send(the_message,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$writer=["to",self.remote_uuid];$send(the_message,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;if($truthy(error_handler['$respond_to?']("call"))){$send(the_message,'on',["fail"],error_handler.$to_proc())};$send(the_message,'on',["success"],($$43=function(response){var self=$$43.$$s==null?this:$$43.$$s,data=nil,the_error=nil;if(response==null){response=nil;};if($truthy(response['$is_a?']($$$('::','Hash')))){data=nil;if($truthy(response['$[]']("result")['$is_a?']($$$('::','String')))){if($truthy(response['$[]']("result").$to_s()['$base64?']())){data=response['$[]']("result").$decode64()};if($truthy(data.$to_s()['$json?']())){try{data=$$$('::','JSON').$parse(data.$to_s(),$hash2(["symbolize_names"],{"symbolize_names":true}))}catch($err){if(Opal.rescue($err,[$$($nesting,'Exception')])){(the_error=$err) -try{self.$log_error($hash2(["error","parameters"],{"error":the_error,"parameters":$hash2(["data"],{"data":data})}))}finally{Opal.pop_exception();}}else{throw $err;}};};return the_handler.$call(data);}else{return self.$log_error($hash2(["error","parameters"],{"error":$$($nesting,'Exception').$new("Malformed Response Data"),"parameters":$hash2(["data"],{"data":response['$[]']("result")})}))};}else{return nil};},$$43.$$s=self,$$43.$$arity=1,$$43));return $$$($$($nesting,'GxG'),'CONNECTION').$pull(the_message);}else{return nil};},$Connector_pull_data$42.$$arity=-1);Opal.def(self,'$pull_object',$Connector_pull_object$44=function $$pull_object(the_specifier,error_handler){var $iter=$Connector_pull_object$44.$$p,the_handler=$iter||nil,$$45,self=this,$ret_or_10=nil,op_frame=nil;if($iter)$Connector_pull_object$44.$$p=null;if($iter)$Connector_pull_object$44.$$p=null;;if(the_specifier==null){the_specifier=nil;};if(error_handler==null){error_handler=nil;};if($truthy((function(){if($truthy(($ret_or_10=the_specifier))){return the_handler}else{return $ret_or_10};return nil;})())){if($truthy($$($nesting,'GxG')['$valid_uuid?'](the_specifier.$to_s()))){op_frame=$hash2(["get_object"],{"get_object":$hash2(["uuid"],{"uuid":the_specifier})})}else{op_frame=$hash2(["get_object"],{"get_object":$hash2(["path"],{"path":the_specifier})})};$send(self,'pull_data',[op_frame,error_handler],($$45=function(data){var self=$$45.$$s==null?this:$$45.$$s;if(data==null){data=nil;};if($truthy(data['$is_a?']($$$('::','Hash')))){return the_handler.$call($$$($$$('::','GxG'),'Database').$process_detached_import(data))}else{return nil};},$$45.$$s=self,$$45.$$arity=1,$$45));return true;}else{return false};},$Connector_pull_object$44.$$arity=-1);Opal.def(self,'$load_format',$Connector_load_format$46=function $$load_format(details,error_handler){var $iter=$Connector_load_format$46.$$p,the_handler=$iter||nil,$$47,self=this,$ret_or_11=nil;if($iter)$Connector_load_format$46.$$p=null;if($iter)$Connector_load_format$46.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy((function(){if($truthy(($ret_or_11=details))){return the_handler}else{return $ret_or_11};return nil;})())){$send(self,'pull_data',[$hash2(["get_format"],{"get_format":details}),error_handler],($$47=function(data){var self=$$47.$$s==null?this:$$47.$$s,the_error=nil;if(data==null){data=nil;};if($truthy(data['$is_a?']($$$('::','Hash')))){if($truthy(data['$[]']("result"))){if($truthy(data['$[]']("result")['$is_a?']($$$('::','String')))){if($truthy(data['$[]']("result").$to_s()['$base64?']())){data=data['$[]']("result").$decode64()};if($truthy(data.$to_s()['$json?']())){try{data=$$$('::','JSON').$parse(data.$to_s(),$hash2(["symbolize_names"],{"symbolize_names":true}));$$$($$$('::','GxG'),'Database').$process_detached_import(data);return the_handler.$call($hash2(["result"],{"result":true}));}catch($err){if(Opal.rescue($err,[$$($nesting,'Exception')])){(the_error=$err) -try{return self.$log_error($hash2(["error","parameters"],{"error":the_error,"parameters":$hash2(["data"],{"data":data})}))}finally{Opal.pop_exception();}}else{throw $err;}};}else{return nil};}else{return self.$log_error($hash2(["error","parameters"],{"error":$$($nesting,'Exception').$new("Malformed Response Data"),"parameters":$hash2(["data"],{"data":data['$[]']("result")})}))}}else if($truthy(data['$[]']("error"))){if($truthy(error_handler['$respond_to?']("call"))){return error_handler.$call(data)}else{return nil}}else{return nil}}else{return nil};},$$47.$$s=self,$$47.$$arity=1,$$47));return true;}else{return false};},$Connector_load_format$46.$$arity=-1);Opal.def(self,'$store_format',$Connector_store_format$48=function $$store_format(details,error_handler){var $iter=$Connector_store_format$48.$$p,the_handler=$iter||nil,$$49,$$50,$$51,self=this,$ret_or_12=nil,format_list=nil,importation_record=nil;if($iter)$Connector_store_format$48.$$p=null;if($iter)$Connector_store_format$48.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy((function(){if($truthy(($ret_or_12=details))){return the_handler}else{return $ret_or_12};return nil;})())){if(details.$keys().$size()['$=='](0)){format_list=$$$($$$('::','GxG'),'DB')['$[]']("formats").$keys()}else{format_list=[];$send($$$($$$('::','GxG'),'DB')['$[]']("formats").$keys(),'each',[],($$49=function(the_uuid){var self=$$49.$$s==null?this:$$49.$$s;if(the_uuid==null){the_uuid=nil;};if($truthy($rb_gt(details['$[]']("uuid").$to_s().$size(),0))){if(the_uuid['$=='](details['$[]']("uuid"))){if($truthy(format_list['$include?'](the_uuid))){}else{format_list['$<<'](the_uuid)}}};if($truthy($rb_gt(details['$[]']("type").$to_s().$size(),0))){if($$$($$$('::','GxG'),'DB')['$[]']("formats")['$[]'](the_uuid)['$[]']("type")['$=='](details['$[]']("type"))){if($truthy(format_list['$include?'](the_uuid))){}else{format_list['$<<'](the_uuid)}}};if($truthy($rb_gt(details['$[]']("ufs").$to_s().$size(),0))){if($$$($$$('::','GxG'),'DB')['$[]']("formats")['$[]'](the_uuid)['$[]']("ufs")['$=='](details['$[]']("ufs"))){if($truthy(format_list['$include?'](the_uuid))){}else{format_list['$<<'](the_uuid)}}};if($truthy($rb_gt(details['$[]']("title").$to_s().$size(),0))){if($$$($$$('::','GxG'),'DB')['$[]']("formats")['$[]'](the_uuid)['$[]']("title")['$=='](details['$[]']("title"))){if($truthy(format_list['$include?'](the_uuid))){}else{format_list['$<<'](the_uuid)}}};if($truthy($rb_gt(details['$[]']("version").$to_s().$size(),0))){if($$$($$$('::','GxG'),'DB')['$[]']("formats")['$[]'](the_uuid)['$[]']("version")['$=='](details['$[]']("version"))){if($truthy(format_list['$include?'](the_uuid))){return nil}else{return format_list['$<<'](the_uuid)}}else{return nil}}else{return nil};},$$49.$$s=self,$$49.$$arity=1,$$49));};importation_record=$hash2(["formats","records"],{"formats":$hash2([],{}),"records":[]});$send(format_list,'each',[],($$50=function(the_uuid){var self=$$50.$$s==null?this:$$50.$$s,format_record=nil,$writer=nil;if(the_uuid==null){the_uuid=nil;};format_record=$$$($$$('::','GxG'),'DB')['$[]']("formats")['$[]'](the_uuid.$to_s().$to_sym()).$clone();$writer=["content",format_record['$[]']("content").$gxg_export()];$send(format_record,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$writer=[the_uuid.$to_s().$to_sym(),format_record];$send(importation_record['$[]']("formats"),'[]=',Opal.to_a($writer));return $writer[$rb_minus($writer["length"],1)];;},$$50.$$s=self,$$50.$$arity=1,$$50));$send(self,'push_data',[$hash2(["put_format"],{"put_format":importation_record}),error_handler],($$51=function(data){var self=$$51.$$s==null?this:$$51.$$s;if(data==null){data=nil;};if($truthy(data['$is_a?']($$$('::','Hash')))){return the_handler.$call(data)}else{return nil};},$$51.$$s=self,$$51.$$arity=1,$$51));return true;}else{return false};},$Connector_store_format$48.$$arity=-1);Opal.def(self,'$get_permissions',$Connector_get_permissions$52=function $$get_permissions(the_specifier,error_handler){var $iter=$Connector_get_permissions$52.$$p,the_handler=$iter||nil,$$53,self=this,$ret_or_13=nil;if($iter)$Connector_get_permissions$52.$$p=null;if($iter)$Connector_get_permissions$52.$$p=null;;if(the_specifier==null){the_specifier=nil;};if(error_handler==null){error_handler=nil;};if($truthy((function(){if($truthy(($ret_or_13=the_specifier))){return the_handler}else{return $ret_or_13};return nil;})())){$send(self,'pull_data',[$hash2(["get_permissions"],{"get_permissions":$hash2(["path"],{"path":the_specifier})}),error_handler],($$53=function(data){var self=$$53.$$s==null?this:$$53.$$s;if(data==null){data=nil;};if($truthy(data['$is_a?']($$$('::','Hash')))){return the_handler.$call(data)}else{return nil};},$$53.$$s=self,$$53.$$arity=1,$$53));return true;}else{return false};},$Connector_get_permissions$52.$$arity=-1);Opal.def(self,'$call_event',$Connector_call_event$54=function $$call_event(service,op_frame,error_handler){var $iter=$Connector_call_event$54.$$p,the_handler=$iter||nil,$$55,self=this,$ret_or_14=nil;if($iter)$Connector_call_event$54.$$p=null;if($iter)$Connector_call_event$54.$$p=null;;if(service==null){service="core";};if(op_frame==null){op_frame=$hash2(["interface"],{"interface":true});};if(error_handler==null){error_handler=nil;};if($truthy(self['$open?']())){if($truthy((function(){if($truthy(($ret_or_14=op_frame['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_14};return nil;})())){$send(self,'pull_data',[$hash2(["call_event"],{"call_event":$hash2(["service","op_frame"],{"service":service.$to_s(),"op_frame":op_frame})}),error_handler],($$55=function(data){var self=$$55.$$s==null?this:$$55.$$s;if(data==null){data=nil;};return the_handler.$call(data);},$$55.$$s=self,$$55.$$arity=1,$$55));return true;}else{return false}}else{return nil};},$Connector_call_event$54.$$arity=-1);Opal.def(self,'$library_pull',$Connector_library_pull$56=function $$library_pull(details,error_handler){var $iter=$Connector_library_pull$56.$$p,the_handler=$iter||nil,$$57,self=this,$ret_or_15=nil;if($iter)$Connector_library_pull$56.$$p=null;if($iter)$Connector_library_pull$56.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy(self['$open?']())){if($truthy((function(){if($truthy(($ret_or_15=details['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_15};return nil;})())){$send(self,'pull_data',[$hash2(["get_library"],{"get_library":details}),error_handler],($$57=function(data){var self=$$57.$$s==null?this:$$57.$$s;if(data==null){data=nil;};return the_handler.$call(data);},$$57.$$s=self,$$57.$$arity=1,$$57));return true;}else{return false}}else{return nil};},$Connector_library_pull$56.$$arity=-1);Opal.def(self,'$format_pull',$Connector_format_pull$58=function $$format_pull(details,error_handler){var $iter=$Connector_format_pull$58.$$p,the_handler=$iter||nil,$$59,self=this,$ret_or_16=nil;if($iter)$Connector_format_pull$58.$$p=null;if($iter)$Connector_format_pull$58.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy(self['$open?']())){if($truthy((function(){if($truthy(($ret_or_16=details['$is_any?']($$$('::','Array'),$$$('::','Hash'))))){return the_handler}else{return $ret_or_16};return nil;})())){$send(self,'pull_data',[$hash2(["format_pull"],{"format_pull":details}),error_handler],($$59=function(data){var self=$$59.$$s==null?this:$$59.$$s;if(data==null){data=nil;};return the_handler.$call(data);},$$59.$$s=self,$$59.$$arity=1,$$59));return true;}else{return false}}else{return nil};},$Connector_format_pull$58.$$arity=-1);Opal.def(self,'$format_push',$Connector_format_push$60=function $$format_push(details,error_handler){var $iter=$Connector_format_push$60.$$p,the_handler=$iter||nil,$$61,self=this,$ret_or_17=nil;if($iter)$Connector_format_push$60.$$p=null;if($iter)$Connector_format_push$60.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy(self['$open?']())){if($truthy((function(){if($truthy(($ret_or_17=details['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_17};return nil;})())){$send(self,'push_data',[$hash2(["format_push"],{"format_push":details}),error_handler],($$61=function(data){var self=$$61.$$s==null?this:$$61.$$s;if(data==null){data=nil;};return the_handler.$call(data);},$$61.$$s=self,$$61.$$arity=1,$$61));return true;}else{return false}}else{return nil};},$Connector_format_push$60.$$arity=-1);Opal.def(self,'$format_list',$Connector_format_list$62=function $$format_list(details,error_handler){var $iter=$Connector_format_list$62.$$p,the_handler=$iter||nil,$$63,self=this,$ret_or_18=nil;if($iter)$Connector_format_list$62.$$p=null;if($iter)$Connector_format_list$62.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy(self['$open?']())){if($truthy((function(){if($truthy(($ret_or_18=details['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_18};return nil;})())){$send(self,'pull_data',[$hash2(["format_list"],{"format_list":details}),error_handler],($$63=function(data){var self=$$63.$$s==null?this:$$63.$$s;if(data==null){data=nil;};return the_handler.$call(data);},$$63.$$s=self,$$63.$$arity=1,$$63));return true;}else{return false}}else{return nil};},$Connector_format_list$62.$$arity=-1);Opal.def(self,'$admin',$Connector_admin$64=function $$admin(details,error_handler){var $iter=$Connector_admin$64.$$p,the_handler=$iter||nil,$$65,self=this,$ret_or_19=nil;if($iter)$Connector_admin$64.$$p=null;if($iter)$Connector_admin$64.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy(self['$open?']())){if($truthy((function(){if($truthy(($ret_or_19=details['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_19};return nil;})())){$send(self,'pull_data',[$hash2(["admin"],{"admin":details}),error_handler],($$65=function(data){var self=$$65.$$s==null?this:$$65.$$s;if(data==null){data=nil;};return the_handler.$call(data);},$$65.$$s=self,$$65.$$arity=1,$$65));return true;}else{return false}}else{return nil};},$Connector_admin$64.$$arity=-1);Opal.def(self,'$vfs',$Connector_vfs$66=function $$vfs(details,error_handler){var $iter=$Connector_vfs$66.$$p,the_handler=$iter||nil,$$67,self=this,$ret_or_20=nil;if($iter)$Connector_vfs$66.$$p=null;if($iter)$Connector_vfs$66.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy(self['$open?']())){if($truthy((function(){if($truthy(($ret_or_20=details['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_20};return nil;})())){if($truthy(["vfs_mkfile","vfs_mkdir","vfs_rename","vfs_destroy","vfs_copy","vfs_move","set_permissions"]['$include?'](details.$keys()['$[]'](0)))){$send(self,'pull_data',[details,error_handler],($$67=function(data){var self=$$67.$$s==null?this:$$67.$$s;if(data==null){data=nil;};return the_handler.$call(data);},$$67.$$s=self,$$67.$$arity=1,$$67));return true;}else{return false}}else{return false}}else{return false};},$Connector_vfs$66.$$arity=-1);Opal.def(self,'$app_state_push',$Connector_app_state_push$68=function $$app_state_push(details,error_handler){var $iter=$Connector_app_state_push$68.$$p,the_handler=$iter||nil,$$69,self=this,$ret_or_21=nil;if($iter)$Connector_app_state_push$68.$$p=null;if($iter)$Connector_app_state_push$68.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy((function(){if($truthy(($ret_or_21=details['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_21};return nil;})())){$send(self,'push_data',[$hash2(["app_state_push"],{"app_state_push":$hash2(["application","data"],{"application":details['$[]']("application"),"data":details['$[]']("data")})}),error_handler],($$69=function(data){var self=$$69.$$s==null?this:$$69.$$s;if(data==null){data=nil;};if($truthy(data['$is_a?']($$$('::','Hash')))){return the_handler.$call(data)}else{return nil};},$$69.$$s=self,$$69.$$arity=1,$$69));return true;}else{return false};},$Connector_app_state_push$68.$$arity=-1);Opal.def(self,'$app_state_pull',$Connector_app_state_pull$70=function $$app_state_pull(details,error_handler){var $iter=$Connector_app_state_pull$70.$$p,the_handler=$iter||nil,$$71,self=this,$ret_or_22=nil;if($iter)$Connector_app_state_pull$70.$$p=null;if($iter)$Connector_app_state_pull$70.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy(self['$open?']())){if($truthy((function(){if($truthy(($ret_or_22=details['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_22};return nil;})())){$send(self,'pull_data',[$hash2(["app_state_pull"],{"app_state_pull":$hash2(["application"],{"application":details['$[]']("application")})}),error_handler],($$71=function(data){var self=$$71.$$s==null?this:$$71.$$s;if(data==null){data=nil;};return the_handler.$call(data);},$$71.$$s=self,$$71.$$arity=1,$$71));return true;}else{return false}}else{return nil};},$Connector_app_state_pull$70.$$arity=-1);Opal.def(self,'$application_open',$Connector_application_open$72=function $$application_open(details,error_handler){var $iter=$Connector_application_open$72.$$p,the_handler=$iter||nil,$$73,$$74,self=this,$ret_or_23=nil,$ret_or_24=nil,$ret_or_25=nil;if($iter)$Connector_application_open$72.$$p=null;if($iter)$Connector_application_open$72.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy(self['$open?']())){if($truthy((function(){if($truthy(($ret_or_23=details['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_23};return nil;})())){if($truthy(details['$[]']("name"))){$send(self,'pull_data',[$hash2(["application_open"],{"application_open":$hash2(["restore","name"],{"restore":(function(){if($truthy(($ret_or_24=details['$[]']("restore")))){return $ret_or_24}else{return false};return nil;})(),"name":details['$[]']("name")})}),error_handler],($$73=function(data){var self=$$73.$$s==null?this:$$73.$$s;if(data==null){data=nil;};return the_handler.$call(data);},$$73.$$s=self,$$73.$$arity=1,$$73))}else{$send(self,'pull_data',[$hash2(["application_open"],{"application_open":$hash2(["restore","path"],{"restore":(function(){if($truthy(($ret_or_25=details['$[]']("restore")))){return $ret_or_25}else{return false};return nil;})(),"path":details['$[]']("path")})}),error_handler],($$74=function(data){var self=$$74.$$s==null?this:$$74.$$s;if(data==null){data=nil;};return the_handler.$call(data);},$$74.$$s=self,$$74.$$arity=1,$$74))};return true;}else{return false}}else{return nil};},$Connector_application_open$72.$$arity=-1);Opal.def(self,'$application_close',$Connector_application_close$75=function $$application_close(details,error_handler){var $iter=$Connector_application_close$75.$$p,the_handler=$iter||nil,$$76,self=this,$ret_or_26=nil;if($iter)$Connector_application_close$75.$$p=null;if($iter)$Connector_application_close$75.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy(self['$open?']())){if($truthy((function(){if($truthy(($ret_or_26=details['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_26};return nil;})())){$send(self,'pull_data',[$hash2(["application_close"],{"application_close":$hash2(["application"],{"application":details['$[]']("application")})}),error_handler],($$76=function(data){var self=$$76.$$s==null?this:$$76.$$s;if(data==null){data=nil;};return the_handler.$call(data);},$$76.$$s=self,$$76.$$arity=1,$$76));return true;}else{return false}}else{return nil};},$Connector_application_close$75.$$arity=-1);Opal.def(self,'$application_list',$Connector_application_list$77=function $$application_list(error_handler){var $iter=$Connector_application_list$77.$$p,the_handler=$iter||nil,$$78,self=this;if($iter)$Connector_application_list$77.$$p=null;if($iter)$Connector_application_list$77.$$p=null;;if(error_handler==null){error_handler=nil;};if($truthy(self['$open?']())){if($truthy(the_handler)){$send(self,'pull_data',[$hash2(["application_list"],{"application_list":true}),error_handler],($$78=function(data){var self=$$78.$$s==null?this:$$78.$$s;if(data==null){data=nil;};return the_handler.$call(data);},$$78.$$s=self,$$78.$$arity=1,$$78));return true;}else{return false}}else{return nil};},$Connector_application_list$77.$$arity=-1);Opal.def(self,'$application_menu',$Connector_application_menu$79=function $$application_menu(error_handler){var $iter=$Connector_application_menu$79.$$p,the_handler=$iter||nil,$$80,self=this;if($iter)$Connector_application_menu$79.$$p=null;if($iter)$Connector_application_menu$79.$$p=null;;if(error_handler==null){error_handler=nil;};if($truthy(self['$open?']())){if($truthy(the_handler)){$send(self,'pull_data',[$hash2(["application_menu"],{"application_menu":true}),error_handler],($$80=function(data){var self=$$80.$$s==null?this:$$80.$$s;if(data==null){data=nil;};return the_handler.$call(data);},$$80.$$s=self,$$80.$$arity=1,$$80));return true;}else{return false}}else{return nil};},$Connector_application_menu$79.$$arity=-1);Opal.def(self,'$entries',$Connector_entries$81=function $$entries(details,error_handler){var $iter=$Connector_entries$81.$$p,the_handler=$iter||nil,$$82,self=this,$ret_or_27=nil;if($iter)$Connector_entries$81.$$p=null;if($iter)$Connector_entries$81.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy(self['$open?']())){if($truthy((function(){if($truthy(($ret_or_27=details['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_27};return nil;})())){$$$($$($nesting,'GxG'),'DISPLAY_DETAILS')['$[]']("object").$set_busy(true);$send(self,'pull_data',[$hash2(["entries"],{"entries":$hash2(["path"],{"path":details['$[]']("path")})}),error_handler],($$82=function(data){var self=$$82.$$s==null?this:$$82.$$s;if(data==null){data=nil;};the_handler.$call(data);return $$$($$($nesting,'GxG'),'DISPLAY_DETAILS')['$[]']("object").$set_busy(false);},$$82.$$s=self,$$82.$$arity=1,$$82));return true;}else{return false}}else{return nil};},$Connector_entries$81.$$arity=-1);Opal.def(self,'$heartbeat',$Connector_heartbeat$83=function $$heartbeat(){var $$84,self=this,heartbeat_message=nil,$writer=nil;if($truthy(self.active)){heartbeat_message=self.$new_message($hash2(["heartbeat"],{"heartbeat":true}));$writer=["sender",self.uuid.$to_s()];$send(heartbeat_message,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$writer=["to",self.remote_uuid.$to_s()];$send(heartbeat_message,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$send(heartbeat_message,'on',["success"],($$84=function(response){var self=$$84.$$s==null?this:$$84.$$s;if(response==null){response=nil;};if($truthy(response['$is_a?']($$$('::','Hash')))){if(response['$[]']("result")['$[]']("status")['$==']("credentialed")){};$writer=["server_status",response['$[]']("result")['$[]']("server").$to_s().$to_sym()];$send($$$($$($nesting,'GxG'),'DISPLAY_DETAILS'),'[]=',Opal.to_a($writer));return $writer[$rb_minus($writer["length"],1)];;}else{return nil};},$$84.$$s=self,$$84.$$arity=1,$$84));return $$$($$($nesting,'GxG'),'CONNECTION').$pull(heartbeat_message);}else{return nil}},$Connector_heartbeat$83.$$arity=0);Opal.def(self,'$update_credential',$Connector_update_credential$85=function $$update_credential(details,error_handler){var $iter=$Connector_update_credential$85.$$p,the_handler=$iter||nil,$$86,$$87,self=this,$ret_or_28=nil,content=nil,the_message=nil,$writer=nil;if($iter)$Connector_update_credential$85.$$p=null;if($iter)$Connector_update_credential$85.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy(self['$open?']())){if($truthy((function(){if($truthy(($ret_or_28=details['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_28};return nil;})())){content=details.$to_json().$to_s().$encrypt(self.csrf.$to_s()).$encode64();the_message=self.$new_message($hash2(["update_credential"],{"update_credential":content}));$writer=["sender",self.uuid];$send(the_message,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$writer=["to",self.remote_uuid];$send(the_message,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$writer=["thread",the_message.$id().$to_s()];$send(the_message['$[]']("body"),'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$send(the_message,'on',["success"],($$86=function(the_response){var self=$$86.$$s==null?this:$$86.$$s;if(the_response==null){the_response=nil;};if($truthy(the_response['$is_a?']($$$('::','Hash')))){if(the_response['$[]']("status")['$==']("credentialed")){$writer=["logged_in",true];$send($$$($$($nesting,'GxG'),'DISPLAY_DETAILS'),'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];}};return the_handler.$call(the_response);},$$86.$$s=self,$$86.$$arity=1,$$86));if($truthy(error_handler)){$send(the_message,'on',["fail"],($$87=function(the_response){var self=$$87.$$s==null?this:$$87.$$s;if(the_response==null){the_response=nil;};return error_handler.$call(the_response);},$$87.$$s=self,$$87.$$arity=1,$$87))};return $$$($$($nesting,'GxG'),'CONNECTION').$push(the_message);}else{return nil}}else{return nil};},$Connector_update_credential$85.$$arity=-1);Opal.def(self,'$downgrade_credential',$Connector_downgrade_credential$88=function $$downgrade_credential(){var $iter=$Connector_downgrade_credential$88.$$p,the_handler=$iter||nil,$$89,self=this,downgrade_message=nil,$writer=nil;if($iter)$Connector_downgrade_credential$88.$$p=null;if($iter)$Connector_downgrade_credential$88.$$p=null;;if($truthy(self.active)){downgrade_message=self.$new_message($hash2(["downgrade_credential"],{"downgrade_credential":true}));$writer=["sender",self.uuid.$to_s()];$send(downgrade_message,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$writer=["to",self.remote_uuid.$to_s()];$send(downgrade_message,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$send(downgrade_message,'on',["success"],($$89=function(response){var self=$$89.$$s==null?this:$$89.$$s,new_event=nil;if(response==null){response=nil;};if($truthy(response['$is_a?']($$$('::','Hash')))){if(response['$[]']("status")['$==']("uncredentialed")){$writer=["logged_in",false];$send($$$($$($nesting,'GxG'),'DISPLAY_DETAILS'),'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;if($truthy(the_handler['$respond_to?']("call"))){the_handler.$call(response)};new_event=new CustomEvent('credentialchanged',{detail:response['$[]']("status").$to_s()});return window.dispatchEvent(new_event);}else{return nil}}else{return nil};},$$89.$$s=self,$$89.$$arity=1,$$89));return $$$($$($nesting,'GxG'),'CONNECTION').$pull(downgrade_message);}else{return nil};},$Connector_downgrade_credential$88.$$arity=0);Opal.def(self,'$action',$Connector_action$90=function $$action(details,error_handler){var $iter=$Connector_action$90.$$p,the_handler=$iter||nil,self=this;if($iter)$Connector_action$90.$$p=null;if($iter)$Connector_action$90.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};return nil;},$Connector_action$90.$$arity=-1);Opal.def(self,'$relative_url',$Connector_relative_url$91=function $$relative_url(){var self=this;return self.relative_url},$Connector_relative_url$91.$$arity=0);Opal.def(self,'$query',$Connector_query$92=function $$query(){var self=this;return self.query},$Connector_query$92.$$arity=0);Opal.def(self,'$article',$Connector_article$93=function $$article(){var self=this;return self.article},$Connector_article$93.$$arity=0);Opal.def(self,'$display_path',$Connector_display_path$94=function $$display_path(){var self=this;return self.display_path},$Connector_display_path$94.$$arity=0);return(Opal.def(self,'$initialize',$Connector_initialize$95=function $$initialize(){var $$96,$$97,$$102,$$103,self=this,page_name=nil,subpath_array=nil,found_at=nil,query_string=nil,query_array=nil,the_introduction=nil,$writer=nil;if($truthy((window.location['href'])['$include?']("https://"))){self.host_prefix=$rb_plus("https://",window.location['host'])}else{self.host_prefix=$rb_plus("http://",window.location['host'])};self.relative_url="";page_name=$$($nesting,'File').$basename(window.location['pathname']);subpath_array=(window.location['pathname']).$split("/");found_at=subpath_array.$index(page_name);if($truthy(found_at['$is_a?']($$$('::','Numeric')))){if($truthy($rb_gt(found_at,1))){self.relative_url=subpath_array['$[]'](Opal.Range.$new(0,$rb_minus(found_at,1),false)).$join("/")}};self.article=nil;self.query=$hash2([],{});query_string=(window.location.href).$split("?")['$[]'](1);if($truthy(query_string)){self.article=query_string.$split("#")['$[]'](1);query_string=query_string.$split("#")['$[]'](0);if($truthy(query_string['$include?']("&"))){query_array=query_string.$split("&")}else{query_array=query_string.$split("&")};$send(query_array,'each',[],($$96=function(entry){var self=$$96.$$s==null?this:$$96.$$s,buffer=nil,$writer=nil;if(self.query==null)self.query=nil;if(entry==null){entry=nil;};buffer=entry.$split("=");$writer=[buffer['$[]'](0).$to_s().$to_sym(),buffer['$[]'](1)];$send(self.query,'[]=',Opal.to_a($writer));return $writer[$rb_minus($writer["length"],1)];;},$$96.$$s=self,$$96.$$arity=1,$$96));}else{self.article=(window.location.href).$split("#")['$[]'](1)};self.uuid=$$($nesting,'GxG').$uuid_generate().$to_sym();self.remote_uuid=nil;self.active=true;self.display_path=nil;self.in_busy=false;self.out_busy=false;self.pending=$hash2([],{});self.channels=$hash2([],{});self.buffers=$hash2([],{});self.csrf=nil;self.the_connector=self;the_introduction=self.$new_message($hash2(["introduction"],{"introduction":self.uuid.$to_s()}));$writer=["sender",self.uuid.$to_s()];$send(the_introduction,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$writer=["to",self.host_prefix.$to_s()];$send(the_introduction,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$send(the_introduction,'on',["success"],($$97=function(response){var self=$$97.$$s==null?this:$$97.$$s,$$98;if(response==null){response=nil;};if(response['$[]']("result")['$==']("OK")){if($truthy(response['$[]']("csrf"))){self.csrf=response['$[]']("csrf")};if(response['$[]']("status")['$==']("credentialed")){$writer=["logged_in",true];$send($$$($$($nesting,'GxG'),'DISPLAY_DETAILS'),'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];}else{$writer=["logged_in",false];$send($$$($$($nesting,'GxG'),'DISPLAY_DETAILS'),'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];};if($truthy(response['$[]']("relative_url"))){self.relative_url=response['$[]']("relative_url")};if(response['$[]']("display")['$==']("unavailable")){return alert('Display Resource Unavailable');}else{self.display_path=response['$[]']("display");self.active=true;return $send($$$($$($nesting,'GxG'),'DISPATCHER'),'post_event',["display"],($$98=function(){var self=$$98.$$s==null?this:$$98.$$s,$a,$$99,$$100,$$101;if(self.query==null)self.query=nil;if(self.article==null)self.article=nil;if(self.relative_url==null)self.relative_url=nil;while(!($truthy((document.readyState).$to_s()['$==']("complete")))){self.$sleep(0.5)};$writer=["query",self.query];$send($$$($$$('::','GxG'),'DISPLAY_DETAILS'),'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$writer=["article",self.article];$send($$$($$$('::','GxG'),'DISPLAY_DETAILS'),'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;var do_unload=function(the_event){Opal.GxG.$eval("GxG::DISPLAY_DETAILS[:socket].close");if(the_event){the_event.returnValue="closing...";} +try{return self.$log_error($hash2(["error","parameters"],{"error":the_error,"parameters":the_xhr.response}))}finally{Opal.pop_exception();}}else{throw $err;}};};},$$19.$$s=self,$$19.$$arity=0,$$19));the_xhr.addEventListener('load',succeeded);the_xhr.addEventListener('error',failed);the_xhr.addEventListener('timeout',failed);the_xhr.addEventListener('abort',failed);the_xhr.send(form_data.$element());return true;}else{return false}}else{return nil};},$Connector_post$17.$$arity=-1);Opal.def(self,'$download_file',$Connector_download_file$20=function $$download_file(the_vfs_path,error_handler){var $iter=$Connector_download_file$20.$$p,the_handler=$iter||nil,self=this,$ret_or_2=nil;if($iter)$Connector_download_file$20.$$p=null;if($iter)$Connector_download_file$20.$$p=null;;if(the_vfs_path==null){the_vfs_path="";};if(error_handler==null){error_handler=nil;};if($truthy(self['$open?']())){if($truthy((function(){if($truthy(($ret_or_2=the_vfs_path['$is_a?']($$$('::','String'))))){return the_handler}else{return $ret_or_2};return nil;})())){$send(self,'pull_data',[$hash2(["download_file"],{"download_file":$hash2(["path"],{"path":the_vfs_path})}),error_handler],the_handler.$to_proc());return true;}else{return false}}else{return nil};},$Connector_download_file$20.$$arity=-1);Opal.def(self,'$push',$Connector_push$21=function $$push(the_message,options){var $$22,$$23,self=this,the_url=nil,payload=nil,the_xhr=nil,$ret_or_3=nil,failed=nil,succeeded=nil;if(the_message==null){the_message=nil;};if(options==null){options=$hash2([],{});};if($truthy(self.active)){if($truthy(the_message['$is_a?']($$$($$$($$$('::','GxG'),'Events'),'Message')))){if($truthy($rb_gt(self.relative_url.$to_s().$size(),0))){the_url=""+(self.host_prefix)+(self.relative_url.$to_s())+"?display="+(self.display_path.$to_s())}else{the_url=""+(self.host_prefix)+"?display="+(self.display_path.$to_s())};payload=the_message.$body().$to_json().$to_s();the_xhr=new XMLHttpRequest;the_xhr.open('PUT',the_url,true);the_xhr.timeout=(function(){if($truthy(($ret_or_3=options['$[]']("timeout")))){return $ret_or_3}else{return 5000};return nil;})();the_xhr.setRequestHeader('X-Requested-With','XMLHttpRequest');the_xhr.setRequestHeader('Accept','application/json');the_xhr.setRequestHeader('X-CSRF-Token',self.csrf);the_xhr.setRequestHeader('Content-Type','application/json');failed=$send($$($nesting,'Proc'),'new',[],($$22=function(reason){var self=$$22.$$s==null?this:$$22.$$s;if(reason==null){reason=nil;};return the_message.$fail(reason);},$$22.$$s=self,$$22.$$arity=-1,$$22));succeeded=$send($$($nesting,'Proc'),'new',[],($$23=function(){var self=$$23.$$s==null?this:$$23.$$s,response_code=nil,the_error=nil;response_code=(the_xhr.status).$to_i();if($truthy($rb_lt(response_code,300))){try{return the_message.$succeed($$$('::','JSON').$parse(the_xhr.response,$hash2(["symbolize_names"],{"symbolize_names":true})))}catch($err){if(Opal.rescue($err,[$$($nesting,'Exception')])){(the_error=$err) +try{return self.$log_error($hash2(["error","parameters"],{"error":the_error,"parameters":the_xhr.response}))}finally{Opal.pop_exception();}}else{throw $err;}};}else{return failed.$call(response_code)};},$$23.$$s=self,$$23.$$arity=0,$$23));the_xhr.addEventListener('load',succeeded);the_xhr.addEventListener('error',failed);the_xhr.addEventListener('timeout',failed);the_xhr.addEventListener('abort',failed);the_xhr.send(payload);return true;}else{return false}}else{return nil};},$Connector_push$21.$$arity=-1);Opal.def(self,'$pull',$Connector_pull$24=function $$pull(the_message,options){var $$25,$$26,self=this,the_query=nil,the_url=nil,the_xhr=nil,$ret_or_4=nil,failed=nil,succeeded=nil;if(the_message==null){the_message=nil;};if(options==null){options=$hash2(["synchronous"],{"synchronous":false});};if($truthy(self.active)){if($truthy(the_message['$is_a?']($$$($$$($$$('::','GxG'),'Events'),'Message')))){the_query=""+"display="+(self.display_path.$to_s())+"&details="+(the_message.$body().$to_json().$encode64());if($truthy($rb_gt(self.relative_url.$to_s().$size(),0))){the_url=$rb_plus($rb_plus($rb_plus(self.host_prefix.$to_s(),self.relative_url.$to_s()),"?"),the_query)}else{the_url=$rb_plus($rb_plus(self.host_prefix.$to_s(),"?"),the_query)};the_xhr=new XMLHttpRequest;if(options['$[]']("synchronous")['$=='](true)){the_xhr.open('GET',the_url.$to_s(),false)}else{the_xhr.open('GET',the_url.$to_s(),true);the_xhr.timeout=(function(){if($truthy(($ret_or_4=options['$[]']("timeout")))){return $ret_or_4}else{return 600000};return nil;})();};the_xhr.setRequestHeader('X-Requested-With','XMLHttpRequest');the_xhr.setRequestHeader('Accept','application/json');failed=$send($$($nesting,'Proc'),'new',[],($$25=function(reason){var self=$$25.$$s==null?this:$$25.$$s;if(reason==null){reason=nil;};return the_message.$fail(reason);},$$25.$$s=self,$$25.$$arity=-1,$$25));succeeded=$send($$($nesting,'Proc'),'new',[],($$26=function(){var self=$$26.$$s==null?this:$$26.$$s,response_code=nil,the_error=nil;response_code=(the_xhr.status).$to_i();if($truthy($rb_lt(response_code,300))){try{return the_message.$succeed($$$('::','JSON').$parse(the_xhr.response,$hash2(["symbolize_names"],{"symbolize_names":true})))}catch($err){if(Opal.rescue($err,[$$($nesting,'Exception')])){(the_error=$err) +try{return self.$log_error($hash2(["error","parameters"],{"error":the_error,"parameters":the_xhr.response}))}finally{Opal.pop_exception();}}else{throw $err;}};}else{return failed.$call(response_code)};},$$26.$$s=self,$$26.$$arity=0,$$26));the_xhr.addEventListener('load',succeeded);the_xhr.addEventListener('error',failed);the_xhr.addEventListener('timeout',failed);the_xhr.addEventListener('abort',failed);the_xhr.send(null);return true;}else{return false}}else{return nil};},$Connector_pull$24.$$arity=-1);Opal.def(self,'$push_message',$Connector_push_message$27=function $$push_message(the_message){var self=this;if(the_message==null){the_message=nil;};return nil;},$Connector_push_message$27.$$arity=-1);Opal.def(self,'$pull_message',$Connector_pull_message$28=function $$pull_message(options){var self=this;if(options==null){options=$hash2([],{});};return nil;},$Connector_pull_message$28.$$arity=-1);Opal.def(self,'$process_pending',$Connector_process_pending$29=function $$process_pending(options){var self=this;if(options==null){options=$hash2([],{});};return nil;},$Connector_process_pending$29.$$arity=-1);Opal.def(self,'$push_object_portions',$Connector_push_object_portions$30=function $$push_object_portions(details,error_handler){var $iter=$Connector_push_object_portions$30.$$p,the_handler=$iter||nil,self=this;if($iter)$Connector_push_object_portions$30.$$p=null;if($iter)$Connector_push_object_portions$30.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};return nil;},$Connector_push_object_portions$30.$$arity=-1);Opal.def(self,'$search_database',$Connector_search_database$31=function $$search_database(details,error_handler){var $iter=$Connector_search_database$31.$$p,the_handler=$iter||nil,self=this,$ret_or_5=nil;if($iter)$Connector_search_database$31.$$p=null;if($iter)$Connector_search_database$31.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy((function(){if($truthy(($ret_or_5=details['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_5};return nil;})())){$send(self,'pull_data',[$hash2(["search_database"],{"search_database":$hash2(["criteria"],{"criteria":details})}),error_handler],the_handler.$to_proc());return true;}else{return false};},$Connector_search_database$31.$$arity=-1);Opal.def(self,'$search_pull',$Connector_search_pull$32=function $$search_pull(details,error_handler){var $iter=$Connector_search_pull$32.$$p,the_handler=$iter||nil,$$33,self=this,$ret_or_6=nil;if($iter)$Connector_search_pull$32.$$p=null;if($iter)$Connector_search_pull$32.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy((function(){if($truthy(($ret_or_6=details['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_6};return nil;})())){$send(self,'pull_data',[$hash2(["search_pull"],{"search_pull":$hash2(["criteria"],{"criteria":details})}),error_handler],($$33=function(data){var self=$$33.$$s==null?this:$$33.$$s,the_error=nil;if(data==null){data=nil;};if($truthy(data['$is_a?']($$$('::','Hash')))){if($truthy(data['$[]']("result"))){if($truthy(data['$[]']("result")['$is_a?']($$$('::','String')))){if($truthy(data['$[]']("result").$to_s()['$base64?']())){data=data['$[]']("result").$decode64()};if($truthy(data.$to_s()['$json?']())){try{data=$$$('::','JSON').$parse(data.$to_s(),$hash2(["symbolize_names"],{"symbolize_names":true}));return the_handler.$call($$$($$$('::','GxG'),'Database').$process_detached_import(data));}catch($err){if(Opal.rescue($err,[$$($nesting,'Exception')])){(the_error=$err) +try{return self.$log_error($hash2(["error","parameters"],{"error":the_error,"parameters":$hash2(["data"],{"data":data})}))}finally{Opal.pop_exception();}}else{throw $err;}};}else{return nil};}else{return self.$log_error($hash2(["error","parameters"],{"error":$$($nesting,'Exception').$new("Malformed Response Data"),"parameters":$hash2(["data"],{"data":data['$[]']("result")})}))}}else if($truthy(data['$[]']("error"))){if($truthy(error_handler['$respond_to?']("call"))){return error_handler.$call(data)}else{return nil}}else{return nil}}else{return nil};},$$33.$$s=self,$$33.$$arity=1,$$33));return true;}else{return false};},$Connector_search_pull$32.$$arity=-1);Opal.def(self,'$destroy_object',$Connector_destroy_object$34=function $$destroy_object(the_specifier,error_handler){var $iter=$Connector_destroy_object$34.$$p,the_handler=$iter||nil,$$35,self=this,$ret_or_7=nil;if($iter)$Connector_destroy_object$34.$$p=null;if($iter)$Connector_destroy_object$34.$$p=null;;if(the_specifier==null){the_specifier=nil;};if(error_handler==null){error_handler=nil;};if($truthy((function(){if($truthy(($ret_or_7=the_specifier))){return the_handler}else{return $ret_or_7};return nil;})())){$send(self,'pull_data',[$hash2(["destroy_object"],{"destroy_object":$hash2(["path"],{"path":the_specifier})}),error_handler],($$35=function(data){var self=$$35.$$s==null?this:$$35.$$s;if(data==null){data=nil;};if($truthy(data['$is_a?']($$$('::','Hash')))){return the_handler.$call(data)}else{return nil};},$$35.$$s=self,$$35.$$arity=1,$$35));return true;}else{return false};},$Connector_destroy_object$34.$$arity=-1);Opal.def(self,'$push_data',$Connector_push_data$36=function $$push_data(details,error_handler){var $iter=$Connector_push_data$36.$$p,the_handler=$iter||nil,$$37,self=this,$ret_or_8=nil,the_message=nil,$writer=nil;if($iter)$Connector_push_data$36.$$p=null;if($iter)$Connector_push_data$36.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy((function(){if($truthy(($ret_or_8=details['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_8};return nil;})())){the_message=self.$new_message(details);$writer=["sender",self.uuid];$send(the_message,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$writer=["to",self.remote_uuid];$send(the_message,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;if($truthy(error_handler['$respond_to?']("call"))){$send(the_message,'on',["fail"],error_handler.$to_proc())};$send(the_message,'on',["success"],($$37=function(response){var self=$$37.$$s==null?this:$$37.$$s;if(response==null){response=nil;};return the_handler.$call(response);},$$37.$$s=self,$$37.$$arity=1,$$37));$$$($$($nesting,'GxG'),'CONNECTION').$push(the_message);return true;}else{return false};},$Connector_push_data$36.$$arity=-1);Opal.def(self,'$push_object',$Connector_push_object$38=function $$push_object(details,error_handler){var $iter=$Connector_push_object$38.$$p,the_handler=$iter||nil,$$39,$$40,$$41,self=this,$ret_or_9=nil,exception=nil,payload=nil,$writer=nil,format_list=nil,importation_record=nil;if($iter)$Connector_push_object$38.$$p=null;if($iter)$Connector_push_object$38.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy((function(){if($truthy(($ret_or_9=details['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_9};return nil;})())){exception=nil;payload=$hash2([],{});if($truthy(details['$[]']("object")['$is_any?']($$$($$$('::','GxG'),'BinaryArray'),$$$('::','String')))){if($truthy($rb_gt(details['$[]']("path").$to_s().$size(),0))){$writer=["path",details['$[]']("path")];$send(payload,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$writer=["object",details['$[]']("object").$to_s().$encode64()];$send(payload,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;}else{exception="You MUST specify a :path to store the data into."}}else if($truthy(details['$[]']("object")['$is_a?']($$$($$$($$$('::','GxG'),'Database'),'DetachedHash')))){if($truthy($rb_gt(details['$[]']("path").$to_s().$size(),0))){$writer=["path",details['$[]']("path")];$send(payload,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];};$writer=["uuid",details['$[]']("object").$uuid().$to_s()];$send(payload,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;format_list=[];importation_record=$hash2(["formats","records"],{"formats":$hash2([],{}),"records":[]});if($truthy($rb_gt(details['$[]']("object").$format().$to_s().$size(),0))){format_list['$<<'](details['$[]']("object").$format())};$send(details['$[]']("object"),'search',[],($$39=function(value,selector,container){var self=$$39.$$s==null?this:$$39.$$s;if(value==null){value=nil;};if(selector==null){selector=nil;};if(container==null){container=nil;};if($truthy(value['$is_a?']($$$($$$($$$('::','GxG'),'Database'),'DetachedHash')))){if($truthy($rb_gt(value.$format().$to_s().$size(),0))){format_list['$<<'](value.$format())}};if($truthy(value['$is_a?']($$$($$$($$$('::','GxG'),'Database'),'PersistedArray')))){if($truthy($rb_gt(value.$constraint().$to_s().$size(),0))){return format_list['$<<'](value.$constraint())}else{return nil}}else{return nil};},$$39.$$s=self,$$39.$$arity=3,$$39));$send(format_list,'each',[],($$40=function(the_specifier){var self=$$40.$$s==null?this:$$40.$$s,format_record=nil;if(the_specifier==null){the_specifier=nil;};format_record=$$$($$($nesting,'GxG'),'DB')['$[]']("formats")['$[]'](the_specifier.$to_s().$to_sym()).$clone();if($truthy(format_record['$is_a?']($$$('::','Hash')))){$writer=["content",format_record['$[]']("content").$gxg_export()];$send(format_record,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$writer=[the_specifier.$to_s().$to_sym(),format_record];$send(importation_record['$[]']("formats"),'[]=',Opal.to_a($writer));return $writer[$rb_minus($writer["length"],1)];;}else{return nil};},$$40.$$s=self,$$40.$$arity=1,$$40));importation_record['$[]']("records")['$<<'](details['$[]']("object").$export());$writer=["object",importation_record];$send(payload,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;}else{exception="Invalid Data Type"};if($truthy(exception)){if($truthy(error_handler['$respond_to?']("call"))){error_handler.$call($hash2(["result","error"],{"result":nil,"error":exception}))};return false;}else{$send(self,'push_data',[$hash2(["put_object"],{"put_object":payload}),error_handler],($$41=function(data){var self=$$41.$$s==null?this:$$41.$$s;if(data==null){data=nil;};if($truthy(data['$is_a?']($$$('::','Hash')))){return the_handler.$call(data)}else{return nil};},$$41.$$s=self,$$41.$$arity=1,$$41));return true;};}else{return false};},$Connector_push_object$38.$$arity=-1);Opal.def(self,'$pull_data',$Connector_pull_data$42=function $$pull_data(the_specifier,error_handler){var $iter=$Connector_pull_data$42.$$p,the_handler=$iter||nil,$$43,self=this,$ret_or_10=nil,the_message=nil,$writer=nil;if($iter)$Connector_pull_data$42.$$p=null;if($iter)$Connector_pull_data$42.$$p=null;;if(the_specifier==null){the_specifier=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy((function(){if($truthy(($ret_or_10=the_specifier))){return the_handler}else{return $ret_or_10};return nil;})())){the_message=self.$new_message(the_specifier);$writer=["sender",self.uuid];$send(the_message,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$writer=["to",self.remote_uuid];$send(the_message,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;if($truthy(error_handler['$respond_to?']("call"))){$send(the_message,'on',["fail"],error_handler.$to_proc())};$send(the_message,'on',["success"],($$43=function(response){var self=$$43.$$s==null?this:$$43.$$s,data=nil,the_error=nil;if(response==null){response=nil;};if($truthy(response['$is_a?']($$$('::','Hash')))){data=nil;if($truthy(response['$[]']("result")['$is_a?']($$$('::','String')))){if($truthy(response['$[]']("result").$to_s()['$base64?']())){data=response['$[]']("result").$decode64()};if($truthy(data.$to_s()['$json?']())){try{data=$$$('::','JSON').$parse(data.$to_s(),$hash2(["symbolize_names"],{"symbolize_names":true}))}catch($err){if(Opal.rescue($err,[$$($nesting,'Exception')])){(the_error=$err) +try{self.$log_error($hash2(["error","parameters"],{"error":the_error,"parameters":$hash2(["data"],{"data":data})}))}finally{Opal.pop_exception();}}else{throw $err;}};};return the_handler.$call(data);}else{return self.$log_error($hash2(["error","parameters"],{"error":$$($nesting,'Exception').$new("Malformed Response Data"),"parameters":$hash2(["data"],{"data":response['$[]']("result")})}))};}else{return nil};},$$43.$$s=self,$$43.$$arity=1,$$43));return $$$($$($nesting,'GxG'),'CONNECTION').$pull(the_message);}else{return nil};},$Connector_pull_data$42.$$arity=-1);Opal.def(self,'$pull_object',$Connector_pull_object$44=function $$pull_object(the_specifier,error_handler){var $iter=$Connector_pull_object$44.$$p,the_handler=$iter||nil,$$45,self=this,$ret_or_11=nil,op_frame=nil;if($iter)$Connector_pull_object$44.$$p=null;if($iter)$Connector_pull_object$44.$$p=null;;if(the_specifier==null){the_specifier=nil;};if(error_handler==null){error_handler=nil;};if($truthy((function(){if($truthy(($ret_or_11=the_specifier))){return the_handler}else{return $ret_or_11};return nil;})())){if($truthy($$($nesting,'GxG')['$valid_uuid?'](the_specifier.$to_s()))){op_frame=$hash2(["get_object"],{"get_object":$hash2(["uuid"],{"uuid":the_specifier})})}else{op_frame=$hash2(["get_object"],{"get_object":$hash2(["path"],{"path":the_specifier})})};$send(self,'pull_data',[op_frame,error_handler],($$45=function(data){var self=$$45.$$s==null?this:$$45.$$s;if(data==null){data=nil;};if($truthy(data['$is_a?']($$$('::','Hash')))){return the_handler.$call($$$($$$('::','GxG'),'Database').$process_detached_import(data))}else{return nil};},$$45.$$s=self,$$45.$$arity=1,$$45));return true;}else{return false};},$Connector_pull_object$44.$$arity=-1);Opal.def(self,'$load_format',$Connector_load_format$46=function $$load_format(details,error_handler){var $iter=$Connector_load_format$46.$$p,the_handler=$iter||nil,$$47,self=this,$ret_or_12=nil;if($iter)$Connector_load_format$46.$$p=null;if($iter)$Connector_load_format$46.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy((function(){if($truthy(($ret_or_12=details))){return the_handler}else{return $ret_or_12};return nil;})())){$send(self,'pull_data',[$hash2(["get_format"],{"get_format":details}),error_handler],($$47=function(data){var self=$$47.$$s==null?this:$$47.$$s,the_error=nil;if(data==null){data=nil;};if($truthy(data['$is_a?']($$$('::','Hash')))){if($truthy(data['$[]']("result"))){if($truthy(data['$[]']("result")['$is_a?']($$$('::','String')))){if($truthy(data['$[]']("result").$to_s()['$base64?']())){data=data['$[]']("result").$decode64()};if($truthy(data.$to_s()['$json?']())){try{data=$$$('::','JSON').$parse(data.$to_s(),$hash2(["symbolize_names"],{"symbolize_names":true}));$$$($$$('::','GxG'),'Database').$process_detached_import(data);return the_handler.$call($hash2(["result"],{"result":true}));}catch($err){if(Opal.rescue($err,[$$($nesting,'Exception')])){(the_error=$err) +try{return self.$log_error($hash2(["error","parameters"],{"error":the_error,"parameters":$hash2(["data"],{"data":data})}))}finally{Opal.pop_exception();}}else{throw $err;}};}else{return nil};}else{return self.$log_error($hash2(["error","parameters"],{"error":$$($nesting,'Exception').$new("Malformed Response Data"),"parameters":$hash2(["data"],{"data":data['$[]']("result")})}))}}else if($truthy(data['$[]']("error"))){if($truthy(error_handler['$respond_to?']("call"))){return error_handler.$call(data)}else{return nil}}else{return nil}}else{return nil};},$$47.$$s=self,$$47.$$arity=1,$$47));return true;}else{return false};},$Connector_load_format$46.$$arity=-1);Opal.def(self,'$store_format',$Connector_store_format$48=function $$store_format(details,error_handler){var $iter=$Connector_store_format$48.$$p,the_handler=$iter||nil,$$49,$$50,$$51,self=this,$ret_or_13=nil,format_list=nil,importation_record=nil;if($iter)$Connector_store_format$48.$$p=null;if($iter)$Connector_store_format$48.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy((function(){if($truthy(($ret_or_13=details))){return the_handler}else{return $ret_or_13};return nil;})())){if(details.$keys().$size()['$=='](0)){format_list=$$$($$$('::','GxG'),'DB')['$[]']("formats").$keys()}else{format_list=[];$send($$$($$$('::','GxG'),'DB')['$[]']("formats").$keys(),'each',[],($$49=function(the_uuid){var self=$$49.$$s==null?this:$$49.$$s;if(the_uuid==null){the_uuid=nil;};if($truthy($rb_gt(details['$[]']("uuid").$to_s().$size(),0))){if(the_uuid['$=='](details['$[]']("uuid"))){if($truthy(format_list['$include?'](the_uuid))){}else{format_list['$<<'](the_uuid)}}};if($truthy($rb_gt(details['$[]']("type").$to_s().$size(),0))){if($$$($$$('::','GxG'),'DB')['$[]']("formats")['$[]'](the_uuid)['$[]']("type")['$=='](details['$[]']("type"))){if($truthy(format_list['$include?'](the_uuid))){}else{format_list['$<<'](the_uuid)}}};if($truthy($rb_gt(details['$[]']("ufs").$to_s().$size(),0))){if($$$($$$('::','GxG'),'DB')['$[]']("formats")['$[]'](the_uuid)['$[]']("ufs")['$=='](details['$[]']("ufs"))){if($truthy(format_list['$include?'](the_uuid))){}else{format_list['$<<'](the_uuid)}}};if($truthy($rb_gt(details['$[]']("title").$to_s().$size(),0))){if($$$($$$('::','GxG'),'DB')['$[]']("formats")['$[]'](the_uuid)['$[]']("title")['$=='](details['$[]']("title"))){if($truthy(format_list['$include?'](the_uuid))){}else{format_list['$<<'](the_uuid)}}};if($truthy($rb_gt(details['$[]']("version").$to_s().$size(),0))){if($$$($$$('::','GxG'),'DB')['$[]']("formats")['$[]'](the_uuid)['$[]']("version")['$=='](details['$[]']("version"))){if($truthy(format_list['$include?'](the_uuid))){return nil}else{return format_list['$<<'](the_uuid)}}else{return nil}}else{return nil};},$$49.$$s=self,$$49.$$arity=1,$$49));};importation_record=$hash2(["formats","records"],{"formats":$hash2([],{}),"records":[]});$send(format_list,'each',[],($$50=function(the_uuid){var self=$$50.$$s==null?this:$$50.$$s,format_record=nil,$writer=nil;if(the_uuid==null){the_uuid=nil;};format_record=$$$($$$('::','GxG'),'DB')['$[]']("formats")['$[]'](the_uuid.$to_s().$to_sym()).$clone();$writer=["content",format_record['$[]']("content").$gxg_export()];$send(format_record,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$writer=[the_uuid.$to_s().$to_sym(),format_record];$send(importation_record['$[]']("formats"),'[]=',Opal.to_a($writer));return $writer[$rb_minus($writer["length"],1)];;},$$50.$$s=self,$$50.$$arity=1,$$50));$send(self,'push_data',[$hash2(["put_format"],{"put_format":importation_record}),error_handler],($$51=function(data){var self=$$51.$$s==null?this:$$51.$$s;if(data==null){data=nil;};if($truthy(data['$is_a?']($$$('::','Hash')))){return the_handler.$call(data)}else{return nil};},$$51.$$s=self,$$51.$$arity=1,$$51));return true;}else{return false};},$Connector_store_format$48.$$arity=-1);Opal.def(self,'$get_permissions',$Connector_get_permissions$52=function $$get_permissions(the_specifier,error_handler){var $iter=$Connector_get_permissions$52.$$p,the_handler=$iter||nil,$$53,self=this,$ret_or_14=nil;if($iter)$Connector_get_permissions$52.$$p=null;if($iter)$Connector_get_permissions$52.$$p=null;;if(the_specifier==null){the_specifier=nil;};if(error_handler==null){error_handler=nil;};if($truthy((function(){if($truthy(($ret_or_14=the_specifier))){return the_handler}else{return $ret_or_14};return nil;})())){$send(self,'pull_data',[$hash2(["get_permissions"],{"get_permissions":$hash2(["path"],{"path":the_specifier})}),error_handler],($$53=function(data){var self=$$53.$$s==null?this:$$53.$$s;if(data==null){data=nil;};if($truthy(data['$is_a?']($$$('::','Hash')))){return the_handler.$call(data)}else{return nil};},$$53.$$s=self,$$53.$$arity=1,$$53));return true;}else{return false};},$Connector_get_permissions$52.$$arity=-1);Opal.def(self,'$call_event',$Connector_call_event$54=function $$call_event(service,op_frame,error_handler){var $iter=$Connector_call_event$54.$$p,the_handler=$iter||nil,self=this,$ret_or_15=nil;if($iter)$Connector_call_event$54.$$p=null;if($iter)$Connector_call_event$54.$$p=null;;if(service==null){service="core";};if(op_frame==null){op_frame=$hash2(["interface"],{"interface":true});};if(error_handler==null){error_handler=nil;};if($truthy(self['$open?']())){if($truthy((function(){if($truthy(($ret_or_15=op_frame['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_15};return nil;})())){$send(self,'pull_data',[$hash2(["call_event"],{"call_event":$hash2(["service","op_frame"],{"service":service.$to_s(),"op_frame":op_frame})}),error_handler],the_handler.$to_proc());return true;}else{return false}}else{return nil};},$Connector_call_event$54.$$arity=-1);Opal.def(self,'$library_pull',$Connector_library_pull$55=function $$library_pull(details,error_handler){var $iter=$Connector_library_pull$55.$$p,the_handler=$iter||nil,$$56,self=this,$ret_or_16=nil;if($iter)$Connector_library_pull$55.$$p=null;if($iter)$Connector_library_pull$55.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy(self['$open?']())){if($truthy((function(){if($truthy(($ret_or_16=details['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_16};return nil;})())){$send(self,'pull_data',[$hash2(["get_library"],{"get_library":details}),error_handler],($$56=function(data){var self=$$56.$$s==null?this:$$56.$$s;if(data==null){data=nil;};return the_handler.$call(data);},$$56.$$s=self,$$56.$$arity=1,$$56));return true;}else{return false}}else{return nil};},$Connector_library_pull$55.$$arity=-1);Opal.def(self,'$format_pull',$Connector_format_pull$57=function $$format_pull(details,error_handler){var $iter=$Connector_format_pull$57.$$p,the_handler=$iter||nil,$$58,self=this,$ret_or_17=nil;if($iter)$Connector_format_pull$57.$$p=null;if($iter)$Connector_format_pull$57.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy(self['$open?']())){if($truthy((function(){if($truthy(($ret_or_17=details['$is_any?']($$$('::','Array'),$$$('::','Hash'))))){return the_handler}else{return $ret_or_17};return nil;})())){$send(self,'pull_data',[$hash2(["format_pull"],{"format_pull":details}),error_handler],($$58=function(data){var self=$$58.$$s==null?this:$$58.$$s;if(data==null){data=nil;};return the_handler.$call(data);},$$58.$$s=self,$$58.$$arity=1,$$58));return true;}else{return false}}else{return nil};},$Connector_format_pull$57.$$arity=-1);Opal.def(self,'$format_push',$Connector_format_push$59=function $$format_push(details,error_handler){var $iter=$Connector_format_push$59.$$p,the_handler=$iter||nil,$$60,self=this,$ret_or_18=nil;if($iter)$Connector_format_push$59.$$p=null;if($iter)$Connector_format_push$59.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy(self['$open?']())){if($truthy((function(){if($truthy(($ret_or_18=details['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_18};return nil;})())){$send(self,'push_data',[$hash2(["format_push"],{"format_push":details}),error_handler],($$60=function(data){var self=$$60.$$s==null?this:$$60.$$s;if(data==null){data=nil;};return the_handler.$call(data);},$$60.$$s=self,$$60.$$arity=1,$$60));return true;}else{return false}}else{return nil};},$Connector_format_push$59.$$arity=-1);Opal.def(self,'$format_list',$Connector_format_list$61=function $$format_list(details,error_handler){var $iter=$Connector_format_list$61.$$p,the_handler=$iter||nil,$$62,self=this,$ret_or_19=nil;if($iter)$Connector_format_list$61.$$p=null;if($iter)$Connector_format_list$61.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy(self['$open?']())){if($truthy((function(){if($truthy(($ret_or_19=details['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_19};return nil;})())){$send(self,'pull_data',[$hash2(["format_list"],{"format_list":details}),error_handler],($$62=function(data){var self=$$62.$$s==null?this:$$62.$$s;if(data==null){data=nil;};return the_handler.$call(data);},$$62.$$s=self,$$62.$$arity=1,$$62));return true;}else{return false}}else{return nil};},$Connector_format_list$61.$$arity=-1);Opal.def(self,'$admin',$Connector_admin$63=function $$admin(details,error_handler){var $iter=$Connector_admin$63.$$p,the_handler=$iter||nil,$$64,self=this,$ret_or_20=nil;if($iter)$Connector_admin$63.$$p=null;if($iter)$Connector_admin$63.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy(self['$open?']())){if($truthy((function(){if($truthy(($ret_or_20=details['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_20};return nil;})())){$send(self,'pull_data',[$hash2(["admin"],{"admin":details}),error_handler],($$64=function(data){var self=$$64.$$s==null?this:$$64.$$s;if(data==null){data=nil;};return the_handler.$call(data);},$$64.$$s=self,$$64.$$arity=1,$$64));return true;}else{return false}}else{return nil};},$Connector_admin$63.$$arity=-1);Opal.def(self,'$vfs',$Connector_vfs$65=function $$vfs(details,error_handler){var $iter=$Connector_vfs$65.$$p,the_handler=$iter||nil,$$66,self=this,$ret_or_21=nil;if($iter)$Connector_vfs$65.$$p=null;if($iter)$Connector_vfs$65.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy(self['$open?']())){if($truthy((function(){if($truthy(($ret_or_21=details['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_21};return nil;})())){if($truthy(["vfs_mkfile","vfs_mkdir","vfs_rename","vfs_destroy","vfs_copy","vfs_move","set_permissions"]['$include?'](details.$keys()['$[]'](0)))){$send(self,'pull_data',[details,error_handler],($$66=function(data){var self=$$66.$$s==null?this:$$66.$$s;if(data==null){data=nil;};return the_handler.$call(data);},$$66.$$s=self,$$66.$$arity=1,$$66));return true;}else{return false}}else{return false}}else{return false};},$Connector_vfs$65.$$arity=-1);Opal.def(self,'$app_state_push',$Connector_app_state_push$67=function $$app_state_push(details,error_handler){var $iter=$Connector_app_state_push$67.$$p,the_handler=$iter||nil,$$68,self=this,$ret_or_22=nil;if($iter)$Connector_app_state_push$67.$$p=null;if($iter)$Connector_app_state_push$67.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy((function(){if($truthy(($ret_or_22=details['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_22};return nil;})())){$send(self,'push_data',[$hash2(["app_state_push"],{"app_state_push":$hash2(["application","data"],{"application":details['$[]']("application"),"data":details['$[]']("data")})}),error_handler],($$68=function(data){var self=$$68.$$s==null?this:$$68.$$s;if(data==null){data=nil;};if($truthy(data['$is_a?']($$$('::','Hash')))){return the_handler.$call(data)}else{return nil};},$$68.$$s=self,$$68.$$arity=1,$$68));return true;}else{return false};},$Connector_app_state_push$67.$$arity=-1);Opal.def(self,'$app_state_pull',$Connector_app_state_pull$69=function $$app_state_pull(details,error_handler){var $iter=$Connector_app_state_pull$69.$$p,the_handler=$iter||nil,$$70,self=this,$ret_or_23=nil;if($iter)$Connector_app_state_pull$69.$$p=null;if($iter)$Connector_app_state_pull$69.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy(self['$open?']())){if($truthy((function(){if($truthy(($ret_or_23=details['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_23};return nil;})())){$send(self,'pull_data',[$hash2(["app_state_pull"],{"app_state_pull":$hash2(["application"],{"application":details['$[]']("application")})}),error_handler],($$70=function(data){var self=$$70.$$s==null?this:$$70.$$s;if(data==null){data=nil;};return the_handler.$call(data);},$$70.$$s=self,$$70.$$arity=1,$$70));return true;}else{return false}}else{return nil};},$Connector_app_state_pull$69.$$arity=-1);Opal.def(self,'$application_open',$Connector_application_open$71=function $$application_open(details,error_handler){var $iter=$Connector_application_open$71.$$p,the_handler=$iter||nil,$$72,$$73,self=this,$ret_or_24=nil,$ret_or_25=nil,$ret_or_26=nil;if($iter)$Connector_application_open$71.$$p=null;if($iter)$Connector_application_open$71.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy(self['$open?']())){if($truthy((function(){if($truthy(($ret_or_24=details['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_24};return nil;})())){if($truthy(details['$[]']("name"))){$send(self,'pull_data',[$hash2(["application_open"],{"application_open":$hash2(["restore","name"],{"restore":(function(){if($truthy(($ret_or_25=details['$[]']("restore")))){return $ret_or_25}else{return false};return nil;})(),"name":details['$[]']("name")})}),error_handler],($$72=function(data){var self=$$72.$$s==null?this:$$72.$$s;if(data==null){data=nil;};return the_handler.$call(data);},$$72.$$s=self,$$72.$$arity=1,$$72))}else{$send(self,'pull_data',[$hash2(["application_open"],{"application_open":$hash2(["restore","path"],{"restore":(function(){if($truthy(($ret_or_26=details['$[]']("restore")))){return $ret_or_26}else{return false};return nil;})(),"path":details['$[]']("path")})}),error_handler],($$73=function(data){var self=$$73.$$s==null?this:$$73.$$s;if(data==null){data=nil;};return the_handler.$call(data);},$$73.$$s=self,$$73.$$arity=1,$$73))};return true;}else{return false}}else{return nil};},$Connector_application_open$71.$$arity=-1);Opal.def(self,'$application_close',$Connector_application_close$74=function $$application_close(details,error_handler){var $iter=$Connector_application_close$74.$$p,the_handler=$iter||nil,$$75,self=this,$ret_or_27=nil;if($iter)$Connector_application_close$74.$$p=null;if($iter)$Connector_application_close$74.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy(self['$open?']())){if($truthy((function(){if($truthy(($ret_or_27=details['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_27};return nil;})())){$send(self,'pull_data',[$hash2(["application_close"],{"application_close":$hash2(["application"],{"application":details['$[]']("application")})}),error_handler],($$75=function(data){var self=$$75.$$s==null?this:$$75.$$s;if(data==null){data=nil;};return the_handler.$call(data);},$$75.$$s=self,$$75.$$arity=1,$$75));return true;}else{return false}}else{return nil};},$Connector_application_close$74.$$arity=-1);Opal.def(self,'$application_list',$Connector_application_list$76=function $$application_list(error_handler){var $iter=$Connector_application_list$76.$$p,the_handler=$iter||nil,$$77,self=this;if($iter)$Connector_application_list$76.$$p=null;if($iter)$Connector_application_list$76.$$p=null;;if(error_handler==null){error_handler=nil;};if($truthy(self['$open?']())){if($truthy(the_handler)){$send(self,'pull_data',[$hash2(["application_list"],{"application_list":true}),error_handler],($$77=function(data){var self=$$77.$$s==null?this:$$77.$$s;if(data==null){data=nil;};return the_handler.$call(data);},$$77.$$s=self,$$77.$$arity=1,$$77));return true;}else{return false}}else{return nil};},$Connector_application_list$76.$$arity=-1);Opal.def(self,'$application_menu',$Connector_application_menu$78=function $$application_menu(error_handler){var $iter=$Connector_application_menu$78.$$p,the_handler=$iter||nil,$$79,self=this;if($iter)$Connector_application_menu$78.$$p=null;if($iter)$Connector_application_menu$78.$$p=null;;if(error_handler==null){error_handler=nil;};if($truthy(self['$open?']())){if($truthy(the_handler)){$send(self,'pull_data',[$hash2(["application_menu"],{"application_menu":true}),error_handler],($$79=function(data){var self=$$79.$$s==null?this:$$79.$$s;if(data==null){data=nil;};return the_handler.$call(data);},$$79.$$s=self,$$79.$$arity=1,$$79));return true;}else{return false}}else{return nil};},$Connector_application_menu$78.$$arity=-1);Opal.def(self,'$entries',$Connector_entries$80=function $$entries(details,error_handler){var $iter=$Connector_entries$80.$$p,the_handler=$iter||nil,$$81,self=this,$ret_or_28=nil;if($iter)$Connector_entries$80.$$p=null;if($iter)$Connector_entries$80.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy(self['$open?']())){if($truthy((function(){if($truthy(($ret_or_28=details['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_28};return nil;})())){$$$($$($nesting,'GxG'),'DISPLAY_DETAILS')['$[]']("object").$set_busy(true);$send(self,'pull_data',[$hash2(["entries"],{"entries":$hash2(["path"],{"path":details['$[]']("path")})}),error_handler],($$81=function(data){var self=$$81.$$s==null?this:$$81.$$s;if(data==null){data=nil;};the_handler.$call(data);return $$$($$($nesting,'GxG'),'DISPLAY_DETAILS')['$[]']("object").$set_busy(false);},$$81.$$s=self,$$81.$$arity=1,$$81));return true;}else{return false}}else{return nil};},$Connector_entries$80.$$arity=-1);Opal.def(self,'$heartbeat',$Connector_heartbeat$82=function $$heartbeat(){var $$83,self=this,heartbeat_message=nil,$writer=nil;if($truthy(self.active)){heartbeat_message=self.$new_message($hash2(["heartbeat"],{"heartbeat":true}));$writer=["sender",self.uuid.$to_s()];$send(heartbeat_message,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$writer=["to",self.remote_uuid.$to_s()];$send(heartbeat_message,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$send(heartbeat_message,'on',["success"],($$83=function(response){var self=$$83.$$s==null?this:$$83.$$s;if(response==null){response=nil;};if($truthy(response['$is_a?']($$$('::','Hash')))){if(response['$[]']("result")['$[]']("status")['$==']("credentialed")){};$writer=["server_status",response['$[]']("result")['$[]']("server").$to_s().$to_sym()];$send($$$($$($nesting,'GxG'),'DISPLAY_DETAILS'),'[]=',Opal.to_a($writer));return $writer[$rb_minus($writer["length"],1)];;}else{return nil};},$$83.$$s=self,$$83.$$arity=1,$$83));return $$$($$($nesting,'GxG'),'CONNECTION').$pull(heartbeat_message);}else{return nil}},$Connector_heartbeat$82.$$arity=0);Opal.def(self,'$update_credential',$Connector_update_credential$84=function $$update_credential(details,error_handler){var $iter=$Connector_update_credential$84.$$p,the_handler=$iter||nil,$$85,$$86,self=this,$ret_or_29=nil,content=nil,the_message=nil,$writer=nil;if($iter)$Connector_update_credential$84.$$p=null;if($iter)$Connector_update_credential$84.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};if($truthy(self['$open?']())){if($truthy((function(){if($truthy(($ret_or_29=details['$is_a?']($$$('::','Hash'))))){return the_handler}else{return $ret_or_29};return nil;})())){content=details.$to_json().$to_s().$encrypt(self.csrf.$to_s()).$encode64();the_message=self.$new_message($hash2(["update_credential"],{"update_credential":content}));$writer=["sender",self.uuid];$send(the_message,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$writer=["to",self.remote_uuid];$send(the_message,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$writer=["thread",the_message.$id().$to_s()];$send(the_message['$[]']("body"),'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$send(the_message,'on',["success"],($$85=function(the_response){var self=$$85.$$s==null?this:$$85.$$s;if(the_response==null){the_response=nil;};if($truthy(the_response['$is_a?']($$$('::','Hash')))){if(the_response['$[]']("status")['$==']("credentialed")){$writer=["logged_in",true];$send($$$($$($nesting,'GxG'),'DISPLAY_DETAILS'),'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];}};return the_handler.$call(the_response);},$$85.$$s=self,$$85.$$arity=1,$$85));if($truthy(error_handler)){$send(the_message,'on',["fail"],($$86=function(the_response){var self=$$86.$$s==null?this:$$86.$$s;if(the_response==null){the_response=nil;};return error_handler.$call(the_response);},$$86.$$s=self,$$86.$$arity=1,$$86))};return $$$($$($nesting,'GxG'),'CONNECTION').$push(the_message);}else{return nil}}else{return nil};},$Connector_update_credential$84.$$arity=-1);Opal.def(self,'$downgrade_credential',$Connector_downgrade_credential$87=function $$downgrade_credential(){var $iter=$Connector_downgrade_credential$87.$$p,the_handler=$iter||nil,$$88,self=this,downgrade_message=nil,$writer=nil;if($iter)$Connector_downgrade_credential$87.$$p=null;if($iter)$Connector_downgrade_credential$87.$$p=null;;if($truthy(self.active)){downgrade_message=self.$new_message($hash2(["downgrade_credential"],{"downgrade_credential":true}));$writer=["sender",self.uuid.$to_s()];$send(downgrade_message,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$writer=["to",self.remote_uuid.$to_s()];$send(downgrade_message,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$send(downgrade_message,'on',["success"],($$88=function(response){var self=$$88.$$s==null?this:$$88.$$s,new_event=nil;if(response==null){response=nil;};if($truthy(response['$is_a?']($$$('::','Hash')))){if(response['$[]']("status")['$==']("uncredentialed")){$writer=["logged_in",false];$send($$$($$($nesting,'GxG'),'DISPLAY_DETAILS'),'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;if($truthy(the_handler['$respond_to?']("call"))){the_handler.$call(response)};new_event=new CustomEvent('credentialchanged',{detail:response['$[]']("status").$to_s()});return window.dispatchEvent(new_event);}else{return nil}}else{return nil};},$$88.$$s=self,$$88.$$arity=1,$$88));return $$$($$($nesting,'GxG'),'CONNECTION').$pull(downgrade_message);}else{return nil};},$Connector_downgrade_credential$87.$$arity=0);Opal.def(self,'$action',$Connector_action$89=function $$action(details,error_handler){var $iter=$Connector_action$89.$$p,the_handler=$iter||nil,self=this;if($iter)$Connector_action$89.$$p=null;if($iter)$Connector_action$89.$$p=null;;if(details==null){details=$hash2([],{});};if(error_handler==null){error_handler=nil;};return nil;},$Connector_action$89.$$arity=-1);Opal.def(self,'$relative_url',$Connector_relative_url$90=function $$relative_url(){var self=this;return self.relative_url},$Connector_relative_url$90.$$arity=0);Opal.def(self,'$query',$Connector_query$91=function $$query(){var self=this;return self.query},$Connector_query$91.$$arity=0);Opal.def(self,'$article',$Connector_article$92=function $$article(){var self=this;return self.article},$Connector_article$92.$$arity=0);Opal.def(self,'$display_path',$Connector_display_path$93=function $$display_path(){var self=this;return self.display_path},$Connector_display_path$93.$$arity=0);return(Opal.def(self,'$initialize',$Connector_initialize$94=function $$initialize(){var $$95,$$96,$$101,$$102,self=this,page_name=nil,subpath_array=nil,found_at=nil,query_string=nil,query_array=nil,the_introduction=nil,$writer=nil;if($truthy((window.location['href'])['$include?']("https://"))){self.host_prefix=$rb_plus("https://",window.location['host'])}else{self.host_prefix=$rb_plus("http://",window.location['host'])};self.relative_url="";page_name=$$($nesting,'File').$basename(window.location['pathname']);subpath_array=(window.location['pathname']).$split("/");found_at=subpath_array.$index(page_name);if($truthy(found_at['$is_a?']($$$('::','Numeric')))){if($truthy($rb_gt(found_at,1))){self.relative_url=subpath_array['$[]'](Opal.Range.$new(0,$rb_minus(found_at,1),false)).$join("/")}};self.article=nil;self.query=$hash2([],{});query_string=(window.location.href).$split("?")['$[]'](1);if($truthy(query_string)){self.article=query_string.$split("#")['$[]'](1);query_string=query_string.$split("#")['$[]'](0);if($truthy(query_string['$include?']("&"))){query_array=query_string.$split("&")}else{query_array=query_string.$split("&")};$send(query_array,'each',[],($$95=function(entry){var self=$$95.$$s==null?this:$$95.$$s,buffer=nil,$writer=nil;if(self.query==null)self.query=nil;if(entry==null){entry=nil;};buffer=entry.$split("=");$writer=[buffer['$[]'](0).$to_s().$to_sym(),buffer['$[]'](1)];$send(self.query,'[]=',Opal.to_a($writer));return $writer[$rb_minus($writer["length"],1)];;},$$95.$$s=self,$$95.$$arity=1,$$95));}else{self.article=(window.location.href).$split("#")['$[]'](1)};self.uuid=$$($nesting,'GxG').$uuid_generate().$to_sym();self.remote_uuid=nil;self.active=true;self.display_path=nil;self.in_busy=false;self.out_busy=false;self.pending=$hash2([],{});self.channels=$hash2([],{});self.buffers=$hash2([],{});self.csrf=nil;self.the_connector=self;the_introduction=self.$new_message($hash2(["introduction"],{"introduction":self.uuid.$to_s()}));$writer=["sender",self.uuid.$to_s()];$send(the_introduction,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$writer=["to",self.host_prefix.$to_s()];$send(the_introduction,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$send(the_introduction,'on',["success"],($$96=function(response){var self=$$96.$$s==null?this:$$96.$$s,$$97;if(response==null){response=nil;};if(response['$[]']("result")['$==']("OK")){if($truthy(response['$[]']("csrf"))){self.csrf=response['$[]']("csrf")};if(response['$[]']("status")['$==']("credentialed")){$writer=["logged_in",true];$send($$$($$($nesting,'GxG'),'DISPLAY_DETAILS'),'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];}else{$writer=["logged_in",false];$send($$$($$($nesting,'GxG'),'DISPLAY_DETAILS'),'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];};if($truthy(response['$[]']("relative_url"))){self.relative_url=response['$[]']("relative_url")};if(response['$[]']("display")['$==']("unavailable")){return alert('Display Resource Unavailable');}else{self.display_path=response['$[]']("display");self.active=true;return $send($$$($$($nesting,'GxG'),'DISPATCHER'),'post_event',["display"],($$97=function(){var self=$$97.$$s==null?this:$$97.$$s,$a,$$98,$$99,$$100;if(self.query==null)self.query=nil;if(self.article==null)self.article=nil;if(self.relative_url==null)self.relative_url=nil;while(!($truthy((document.readyState).$to_s()['$==']("complete")))){self.$sleep(0.5)};$writer=["query",self.query];$send($$$($$$('::','GxG'),'DISPLAY_DETAILS'),'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$writer=["article",self.article];$send($$$($$$('::','GxG'),'DISPLAY_DETAILS'),'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;var do_unload=function(the_event){Opal.GxG.$eval("GxG::DISPLAY_DETAILS[:socket].close");if(the_event){the_event.returnValue="closing...";} for(var i=0;i<500000000;i++){} -return "closing...";};window.addEventListener('unload',do_unload,false);window.addEventListener('onunload',do_unload,false);window.addEventListener('beforeunload',do_unload,false);window.addEventListener('onbeforeunload',do_unload,false);window.onbeforeunload=do_unload;window.beforeunload=do_unload;;$send($$$($$($nesting,'GxG'),'DISPATCHER'),'post_event',["display"],($$99=function(){var self=$$99.$$s==null?this:$$99.$$s;return $$$($$$($$$('::','GxG'),'Gui'),'Vdom').$navigate_to(window.location['pathname'])},$$99.$$s=self,$$99.$$arity=0,$$99));$writer=["socket",$$$($$$($$$('::','GxG'),'Networking'),'Socket').$new()];$send($$$($$$('::','GxG'),'DISPLAY_DETAILS'),'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$$$($$$('::','GxG'),'DISPLAY_DETAILS')['$[]']("socket").$open($rb_plus($rb_plus($rb_plus(window.location['host'],"/"),self.relative_url),"/ws").$gsub("//","/"));$send($$$($$$('::','GxG'),'SOCKET_MONITOR'),'on',["attach_socket"],($$100=function(the_uuid){var self=$$100.$$s==null?this:$$100.$$s,the_message=nil;if(self.uuid==null)self.uuid=nil;if(self.remote_uuid==null)self.remote_uuid=nil;if(the_uuid==null){the_uuid=nil;};if($truthy($$$('::','GxG')['$valid_uuid?'](the_uuid))){the_message=self.$new_message($hash2(["attach_socket"],{"attach_socket":the_uuid.$to_s()}));$writer=["sender",self.uuid];$send(the_message,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$writer=["to",self.remote_uuid];$send(the_message,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;return $$$($$($nesting,'GxG'),'CONNECTION').$push(the_message);}else{return nil};},$$100.$$s=self,$$100.$$arity=1,$$100));return $send($$$($$$('::','GxG'),'DISPATCHER'),'add_periodic_timer',[$hash2(["interval"],{"interval":0.333})],($$101=function(){var self=$$101.$$s==null?this:$$101.$$s;return $$$($$$('::','GxG'),'SOCKET_MONITOR').$follow_up()},$$101.$$s=self,$$101.$$arity=0,$$101));},$$98.$$s=self,$$98.$$arity=0,$$98));};}else{return nil};},$$97.$$s=self,$$97.$$arity=1,$$97));$send(the_introduction,'on',["fail"],($$102=function(response){var self=$$102.$$s==null?this:$$102.$$s;if(response==null){response=nil;};self.active=false;return self.$log_error($hash2(["error","parameters"],{"error":$$($nesting,'Exception').$new("Communication Error"),"parameters":$hash2(["response"],{"response":response})}));},$$102.$$s=self,$$102.$$arity=1,$$102));$send($$$($$($nesting,'GxG'),'DISPATCHER'),'post_event',["communications"],($$103=function(){var self=$$103.$$s==null?this:$$103.$$s,$$104;$$$($$($nesting,'GxG'),'CONNECTION').$pull(the_introduction);return(self.heart_beat_timer=$send($$$($$($nesting,'GxG'),'DISPATCHER'),'add_periodic_timer',[$hash2(["interval"],{"interval":60.0})],($$104=function(){var self=$$104.$$s==null?this:$$104.$$s;return $$$($$($nesting,'GxG'),'CONNECTION').$heartbeat()},$$104.$$s=self,$$104.$$arity=0,$$104)));},$$103.$$s=self,$$103.$$arity=0,$$103));return self;},$Connector_initialize$95.$$arity=0),nil)&&'initialize';})($nesting[0],null,$nesting);})($nesting[0],$nesting);})($nesting[0],$nesting)};Opal.queue(function(Opal){var self=Opal.top,$nesting=[],nil=Opal.nil,$$$=Opal.$$$,$$=Opal.$$,$module=Opal.module,$hash2=Opal.hash2,$klass=Opal.klass;Opal.add_stubs(['$require','$to_i','$new','$private','$[]']);self.$require("opal");self.$require("opal/paths");self.$require("bigdecimal");self.$require("buffer");self.$require("base64");self.$require("console");self.$require("date");self.$require("delegate");self.$require("enumerator");self.$require("forwardable");self.$require("iconv");self.$require("json");self.$require("js");self.$require("observer");self.$require("opal-parser");self.$require("opal-platform");self.$require("pathname");self.$require("pp");self.$require("promise");self.$require("securerandom");self.$require("singleton");self.$require("stringio");self.$require("strscan");self.$require("thread");self.$require("time");self.$require("deps/chronic");self.$require("web/gxg");self.$require("web/gxg_augments");self.$require("web/gxg_elements");self.$require("web/gxg_events");self.$require("web/gxg_database");self.$require("web/gxg_libraries");self.$require("web/gxg_applications");self.$require("web/gxg_vdom");self.$require("web/gxg_foundation");self.$require("web/gxg_layout");self.$require("web/gxg_windows");self.$require("web/gxg_gui");self.$require("web/gxg_comm");(function($base,$parent_nesting){var self=$module($base,'GxG');var $nesting=[self].concat($parent_nesting);Opal.const_set($nesting[0],'DISPLAY_DETAILS',$hash2(["server_status","logged_in","host_path","use_ssl","socket","object","theme","query","article","mode"],{"server_status":"running","logged_in":false,"host_path":"","use_ssl":false,"socket":nil,"object":nil,"theme":"default","query":$hash2([],{}),"article":nil,"mode":"browsing"}));Opal.const_set($nesting[0],'LAYOUT',$hash2(["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],{"top-left":$hash2([],{}),"top":$hash2([],{}),"top-right":$hash2([],{}),"right":$hash2([],{}),"bottom-right":$hash2([],{}),"bottom":$hash2([],{}),"bottom-left":$hash2([],{}),"left":$hash2([],{})}));Opal.const_set($nesting[0],'LAYOUT_LIMITS',$hash2(["top","left","bottom","right","page_width","page_height"],{"top":0,"left":0,"bottom":(window.innerHeight).$to_i(),"right":(window.innerWidth).$to_i(),"page_width":(window.innerWidth).$to_i(),"page_height":(window.innerHeight).$to_i()}));Opal.const_set($nesting[0],'APPLICATIONS',$hash2(["processes","libraries","viewports","prefetching"],{"processes":$hash2([],{}),"libraries":$hash2([],{}),"viewports":$hash2([],{}),"prefetching":false}));Opal.const_set($nesting[0],'ANIMATION',$hash2(["animations","assets"],{"animations":$hash2([],{}),"assets":$hash2([],{})}));Opal.const_set($nesting[0],'DB',$hash2(["formats"],{"formats":$hash2([],{})}));Opal.const_set($nesting[0],'CONNECTION',$$$($$$($$$('::','GxG'),'Networking'),'Connector').$new());Opal.const_set($nesting[0],'SOCKET_MONITOR',$$$($$$($$$('::','GxG'),'Networking'),'SocketMonitor').$new());Opal.const_set($nesting[0],'THEMES',$hash2([],{}));Opal.const_set($nesting[0],'PAGES',$hash2([],{}));return Opal.const_set($nesting[0],'DOCUMENTS',$hash2([],{}));})($nesting[0],$nesting);return(function($base,$super,$parent_nesting){var self=$klass($base,$super,'Object');var $nesting=[self].concat($parent_nesting),$Object_page$1,$Object_applications$2,$Object_libraries$3,$Object_viewports$4,$Object_connector$5,$Object_sockets$6,$Object_documents$7;self.$private();Opal.def(self,'$page',$Object_page$1=function $$page(){var self=this;return $$$($$$('::','GxG'),'DISPLAY_DETAILS')['$[]']("object")},$Object_page$1.$$arity=0);Opal.def(self,'$applications',$Object_applications$2=function $$applications(){var self=this;return $$$($$$('::','GxG'),'APPLICATIONS')['$[]']("processes")},$Object_applications$2.$$arity=0);Opal.def(self,'$libraries',$Object_libraries$3=function $$libraries(){var self=this;return $$$($$$('::','GxG'),'APPLICATIONS')['$[]']("libraries")},$Object_libraries$3.$$arity=0);Opal.def(self,'$viewports',$Object_viewports$4=function $$viewports(){var self=this;return $$$($$$('::','GxG'),'APPLICATIONS')['$[]']("viewports")},$Object_viewports$4.$$arity=0);Opal.def(self,'$connector',$Object_connector$5=function $$connector(){var self=this;return $$$($$$('::','GxG'),'CONNECTION')},$Object_connector$5.$$arity=0);Opal.def(self,'$sockets',$Object_sockets$6=function $$sockets(){var self=this;return $$$($$$('::','GxG'),'SOCKET_MONITOR')},$Object_sockets$6.$$arity=0);return(Opal.def(self,'$documents',$Object_documents$7=function $$documents(){var self=this;return $$$($$$('::','GxG'),'DOCUMENTS')},$Object_documents$7.$$arity=0),nil)&&'documents';})($nesting[0],null,$nesting);});Opal.queue(function(Opal){var self=Opal.top,$nesting=[],nil=Opal.nil,$$$=Opal.$$$,$$=Opal.$$;Opal.add_stubs(['$exit']);return $$($nesting,'Kernel').$exit()}); \ No newline at end of file +return "closing...";};window.addEventListener('unload',do_unload,false);window.addEventListener('onunload',do_unload,false);window.addEventListener('beforeunload',do_unload,false);window.addEventListener('onbeforeunload',do_unload,false);window.onbeforeunload=do_unload;window.beforeunload=do_unload;;$send($$$($$($nesting,'GxG'),'DISPATCHER'),'post_event',["display"],($$98=function(){var self=$$98.$$s==null?this:$$98.$$s;return $$$($$$($$$('::','GxG'),'Gui'),'Vdom').$navigate_to(window.location['pathname'])},$$98.$$s=self,$$98.$$arity=0,$$98));$writer=["socket",$$$($$$($$$('::','GxG'),'Networking'),'Socket').$new()];$send($$$($$$('::','GxG'),'DISPLAY_DETAILS'),'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$$$($$$('::','GxG'),'DISPLAY_DETAILS')['$[]']("socket").$open($rb_plus($rb_plus($rb_plus(window.location['host'],"/"),self.relative_url),"/ws").$gsub("//","/"));$send($$$($$$('::','GxG'),'SOCKET_MONITOR'),'on',["attach_socket"],($$99=function(the_uuid){var self=$$99.$$s==null?this:$$99.$$s,the_message=nil;if(self.uuid==null)self.uuid=nil;if(self.remote_uuid==null)self.remote_uuid=nil;if(the_uuid==null){the_uuid=nil;};if($truthy($$$('::','GxG')['$valid_uuid?'](the_uuid))){the_message=self.$new_message($hash2(["attach_socket"],{"attach_socket":the_uuid.$to_s()}));$writer=["sender",self.uuid];$send(the_message,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;$writer=["to",self.remote_uuid];$send(the_message,'[]=',Opal.to_a($writer));$writer[$rb_minus($writer["length"],1)];;return $$$($$($nesting,'GxG'),'CONNECTION').$push(the_message);}else{return nil};},$$99.$$s=self,$$99.$$arity=1,$$99));return $send($$$($$$('::','GxG'),'DISPATCHER'),'add_periodic_timer',[$hash2(["interval"],{"interval":0.333})],($$100=function(){var self=$$100.$$s==null?this:$$100.$$s;return $$$($$$('::','GxG'),'SOCKET_MONITOR').$follow_up()},$$100.$$s=self,$$100.$$arity=0,$$100));},$$97.$$s=self,$$97.$$arity=0,$$97));};}else{return nil};},$$96.$$s=self,$$96.$$arity=1,$$96));$send(the_introduction,'on',["fail"],($$101=function(response){var self=$$101.$$s==null?this:$$101.$$s;if(response==null){response=nil;};self.active=false;return self.$log_error($hash2(["error","parameters"],{"error":$$($nesting,'Exception').$new("Communication Error"),"parameters":$hash2(["response"],{"response":response})}));},$$101.$$s=self,$$101.$$arity=1,$$101));$send($$$($$($nesting,'GxG'),'DISPATCHER'),'post_event',["communications"],($$102=function(){var self=$$102.$$s==null?this:$$102.$$s,$$103;$$$($$($nesting,'GxG'),'CONNECTION').$pull(the_introduction);return(self.heart_beat_timer=$send($$$($$($nesting,'GxG'),'DISPATCHER'),'add_periodic_timer',[$hash2(["interval"],{"interval":60.0})],($$103=function(){var self=$$103.$$s==null?this:$$103.$$s;return $$$($$($nesting,'GxG'),'CONNECTION').$heartbeat()},$$103.$$s=self,$$103.$$arity=0,$$103)));},$$102.$$s=self,$$102.$$arity=0,$$102));return self;},$Connector_initialize$94.$$arity=0),nil)&&'initialize';})($nesting[0],null,$nesting);})($nesting[0],$nesting);})($nesting[0],$nesting)};Opal.queue(function(Opal){var self=Opal.top,$nesting=[],nil=Opal.nil,$$$=Opal.$$$,$$=Opal.$$,$module=Opal.module,$hash2=Opal.hash2,$klass=Opal.klass;Opal.add_stubs(['$require','$to_i','$new','$private','$[]']);self.$require("opal");self.$require("opal/paths");self.$require("bigdecimal");self.$require("buffer");self.$require("base64");self.$require("console");self.$require("date");self.$require("delegate");self.$require("enumerator");self.$require("forwardable");self.$require("iconv");self.$require("json");self.$require("js");self.$require("observer");self.$require("opal-parser");self.$require("opal-platform");self.$require("pathname");self.$require("pp");self.$require("promise");self.$require("securerandom");self.$require("singleton");self.$require("stringio");self.$require("strscan");self.$require("thread");self.$require("time");self.$require("deps/chronic");self.$require("web/gxg");self.$require("web/gxg_augments");self.$require("web/gxg_elements");self.$require("web/gxg_events");self.$require("web/gxg_database");self.$require("web/gxg_libraries");self.$require("web/gxg_applications");self.$require("web/gxg_vdom");self.$require("web/gxg_foundation");self.$require("web/gxg_layout");self.$require("web/gxg_windows");self.$require("web/gxg_gui");self.$require("web/gxg_comm");(function($base,$parent_nesting){var self=$module($base,'GxG');var $nesting=[self].concat($parent_nesting);Opal.const_set($nesting[0],'DISPLAY_DETAILS',$hash2(["server_status","logged_in","host_path","use_ssl","socket","object","theme","query","article","mode"],{"server_status":"running","logged_in":false,"host_path":"","use_ssl":false,"socket":nil,"object":nil,"theme":"default","query":$hash2([],{}),"article":nil,"mode":"browsing"}));Opal.const_set($nesting[0],'LAYOUT',$hash2(["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],{"top-left":$hash2([],{}),"top":$hash2([],{}),"top-right":$hash2([],{}),"right":$hash2([],{}),"bottom-right":$hash2([],{}),"bottom":$hash2([],{}),"bottom-left":$hash2([],{}),"left":$hash2([],{})}));Opal.const_set($nesting[0],'LAYOUT_LIMITS',$hash2(["top","left","bottom","right","page_width","page_height"],{"top":0,"left":0,"bottom":(window.innerHeight).$to_i(),"right":(window.innerWidth).$to_i(),"page_width":(window.innerWidth).$to_i(),"page_height":(window.innerHeight).$to_i()}));Opal.const_set($nesting[0],'APPLICATIONS',$hash2(["processes","libraries","viewports","prefetching"],{"processes":$hash2([],{}),"libraries":$hash2([],{}),"viewports":$hash2([],{}),"prefetching":false}));Opal.const_set($nesting[0],'ANIMATION',$hash2(["animations","assets"],{"animations":$hash2([],{}),"assets":$hash2([],{})}));Opal.const_set($nesting[0],'DB',$hash2(["formats"],{"formats":$hash2([],{})}));Opal.const_set($nesting[0],'CONNECTION',$$$($$$($$$('::','GxG'),'Networking'),'Connector').$new());Opal.const_set($nesting[0],'SOCKET_MONITOR',$$$($$$($$$('::','GxG'),'Networking'),'SocketMonitor').$new());Opal.const_set($nesting[0],'THEMES',$hash2([],{}));Opal.const_set($nesting[0],'PAGES',$hash2([],{}));return Opal.const_set($nesting[0],'DOCUMENTS',$hash2([],{}));})($nesting[0],$nesting);return(function($base,$super,$parent_nesting){var self=$klass($base,$super,'Object');var $nesting=[self].concat($parent_nesting),$Object_page$1,$Object_applications$2,$Object_libraries$3,$Object_viewports$4,$Object_connector$5,$Object_sockets$6,$Object_documents$7;self.$private();Opal.def(self,'$page',$Object_page$1=function $$page(){var self=this;return $$$($$$('::','GxG'),'DISPLAY_DETAILS')['$[]']("object")},$Object_page$1.$$arity=0);Opal.def(self,'$applications',$Object_applications$2=function $$applications(){var self=this;return $$$($$$('::','GxG'),'APPLICATIONS')['$[]']("processes")},$Object_applications$2.$$arity=0);Opal.def(self,'$libraries',$Object_libraries$3=function $$libraries(){var self=this;return $$$($$$('::','GxG'),'APPLICATIONS')['$[]']("libraries")},$Object_libraries$3.$$arity=0);Opal.def(self,'$viewports',$Object_viewports$4=function $$viewports(){var self=this;return $$$($$$('::','GxG'),'APPLICATIONS')['$[]']("viewports")},$Object_viewports$4.$$arity=0);Opal.def(self,'$connector',$Object_connector$5=function $$connector(){var self=this;return $$$($$$('::','GxG'),'CONNECTION')},$Object_connector$5.$$arity=0);Opal.def(self,'$sockets',$Object_sockets$6=function $$sockets(){var self=this;return $$$($$$('::','GxG'),'SOCKET_MONITOR')},$Object_sockets$6.$$arity=0);return(Opal.def(self,'$documents',$Object_documents$7=function $$documents(){var self=this;return $$$($$$('::','GxG'),'DOCUMENTS')},$Object_documents$7.$$arity=0),nil)&&'documents';})($nesting[0],null,$nesting);});Opal.queue(function(Opal){var self=Opal.top,$nesting=[],nil=Opal.nil,$$$=Opal.$$$,$$=Opal.$$;Opal.add_stubs(['$exit']);return $$($nesting,'Kernel').$exit()}); \ No newline at end of file diff --git a/Services/www/www.rb b/Services/www/www.rb index 9bedab6..007f997 100644 --- a/Services/www/www.rb +++ b/Services/www/www.rb @@ -113,7 +113,13 @@ class Node0 < Sinatra::Application # end # ### Implementation of the verbs: get '*' do - GxG::SERVICES[:www][:receiver].handle_request(:get, request, session) + response = GxG::SERVICES[:www][:receiver].handle_request(:get, request, session) + if response[0] == -255 + send_file(response[2][:result][:file], {:disposition => 'attachment', :filename => File.basename(response[2][:result][:file])}) + GxG::SERVICES[:core][:resources].destroy(response[2][:result][:vfs_dir], ::GxG::DB[:administrator]) + response = [200, {"content-type" => "application/json"}, {:result => true}.to_json()] + end + response end # put '*' do diff --git a/Services/www/www/gxg-www.rb b/Services/www/www/gxg-www.rb index 89d29fd..5270800 100644 --- a/Services/www/www/gxg-www.rb +++ b/Services/www/www/gxg-www.rb @@ -1152,22 +1152,89 @@ module GxGwww begin temp_dir = "/Temporary/#{::GxG::uuid_generate().to_s}" download_path = "#{temp_dir + "/" + (details[:file_name] || "Untitled").to_s}" - final_path = "#{details[:destination].to_s + "/" + (details[:file_name] || "Untitled").to_s}" - GxG::SERVICES[:core][:resources].create_directory(temp_dir, ::GxG::DB[:administrator]) - GxG::SERVICES[:core][:resources].create(download_path, ::GxG::DB[:administrator]) - handle = GxG::SERVICES[:core][:resources].open_writable(download_path, ::GxG::DB[:administrator]) - handle[:resource].write details[:temp_file].read - GxG::SERVICES[:core][:resources].close(handle[:token]) - GxG::SERVICES[:core][:resources].move(download_path, ::GxG::DB[:administrator], final_path) - GxG::SERVICES[:core][:resources].set_permissions(final_path, @credential, {:execute => false, :rename => true, :move => true, :destroy => true, :create => true, :write => true, :read=>true}) - # - response = [200, {"content-type" => "application/json"}, ({:result => true}).to_json()] + # + if details[:destination].to_s[0..4] == "/User" + if @credential == :"00000000-0000-4000-0000-000000000000" + details[:destination] = ("/Public/www/" << details[:destination].to_s[5..-1]).gsub("//","/") + else + details[:destination] = ("/Users/#{@credential.to_s}/" << details[:destination].to_s[5..-1]).gsub("//","/") + unless GxG::SERVICES[:core][:resources].home_mounted?(@credential) + GxG::SERVICES[:core][:resources].home_mount(@credential) + end + end + else + details[:destination] = ("/Public/www/" << details[:destination].to_s).gsub("//","/") + end + if GxG::SERVICES[:core][:resources].permissions(details[:destination], @credential)[:write] == true + # + final_path = "#{details[:destination].to_s + "/" + (details[:file_name] || "Untitled").to_s}".gsub("//","/") + GxG::SERVICES[:core][:resources].create_directory(temp_dir, ::GxG::DB[:administrator]) + GxG::SERVICES[:core][:resources].create(download_path, ::GxG::DB[:administrator]) + handle = GxG::SERVICES[:core][:resources].open_writable(download_path, ::GxG::DB[:administrator]) + handle[:resource].write details[:temp_file].read + GxG::SERVICES[:core][:resources].close(handle[:token]) + GxG::SERVICES[:core][:resources].move(download_path, ::GxG::DB[:administrator], final_path) + GxG::SERVICES[:core][:resources].set_permissions(final_path, @credential, {:execute => false, :rename => true, :move => true, :destroy => true, :create => true, :write => true, :read=>true}) + GxG::SERVICES[:core][:resources].destroy(temp_dir, ::GxG::DB[:administrator]) + # + response = [200, {"content-type" => "application/json"}, ({:result => true}).to_json()] + else + response = [500, {"content-type" => "application/json"}, ({:result => false, :error => "You lack permissions to write."}).to_json()] + end rescue Exception => the_error response = [500, {"content-type" => "application/json"}, ({:result => false, :error => the_error.to_s}).to_json()] end response end # + def download_file(details={}) + # {:path => "/path/to/object"} + response = [404, {"content-type" => "application/json"}, ({:result => false, :error => "Object Not Found."}).to_json()] + begin + # + temp_dir = "/Temporary/#{::GxG::uuid_generate().to_s}" + final_path = "#{temp_dir}/#{File.basename(details[:path])}" + # + if details[:path].to_s[0..4] == "/User" + if @credential == :"00000000-0000-4000-0000-000000000000" + details[:path] = ("/Public/www/" << details[:path].to_s[5..-1]).gsub("//","/") + else + details[:path] = ("/Users/#{@credential.to_s}/" << details[:path].to_s[5..-1]).gsub("//","/") + unless GxG::SERVICES[:core][:resources].home_mounted?(@credential) + GxG::SERVICES[:core][:resources].home_mount(@credential) + end + end + else + details[:path] = ("/Public/www/" << details[:path].to_s).gsub("//","/") + end + # + # temp_file = "#{temp_dir}/#{File.basename((details[:path] || 'Untitled').to_s)}" + if GxG::SERVICES[:core][:resources].exist?(details[:path]) + profile = GxG::SERVICES[:core][:resources].profile(details[:path], @credential) + if profile + if profile[:permissions][:effective][:read] == true + if GxG::SERVICES[:core][:resources].copy(details[:path], ::GxG::DB[:administrator], final_path) + cache_profile = (GxG::SERVICES[:core][:resources].entries(temp_dir, ::GxG::DB[:administrator]) || []).first + if cache_profile + handle = GxG::SERVICES[:core][:resources].open((temp_dir + "/" + cache_profile[:title]), ::GxG::DB[:administrator]) + download_path = handle[:resource].path() + GxG::SERVICES[:core][:resources].close(handle[:token]) + response = [-255, {"content-type" => "application/hash"}, {:result => {:file => download_path, :vfs_dir => temp_dir} }] + end + else + response = [500, {"content-type" => "application/json"}, ({:result => false, :error => "Failed to cache file."}).to_json()] + end + end + end + # + end + rescue Exception => the_error + response = [500, {"content-type" => "application/json"}, ({:result => false, :error => the_error.to_s}).to_json()] + end + # + response + end + # def vfs_mkfile(details={}) # Review : find correct cooresponding return codes for errors. if self.closed?