/*    HTTP Host:  static.ak.fbcdn.net                                          */
/*    Generated:  February 10th 2010 1:30:53 AM PST                            */
/*      Machine:  10.16.139.109                                                */
/*       Source:  Backing Store                                                */
/*     Location:  js/ydir8cghkis0gkco.pkg.js h:745u5kx0                        */
/*       Locale:  nu_ll                                                        */
/*         Path:  js/ydir8cghkis0gkco.pkg.js                                   */

if (window.CavalryLogger) { CavalryLogger.start_js(["js\/ydir8cghkis0gkco.pkg.js"]); }

Arbiter.inform("template\/registerTemplate", {"name":"\/gigaboxx\/templates\/GBSearchBox.tmpl","template":"\n<form bindPoint=\"root\" listen=\"submit: searchSubmit\" class=\"GBSearchBox\">\n  <span class=\"GBSearchBox_Input\">\n    <input bindPoint=\"typeahead\"\n              listen=\"focus: searchFocus\"\n                name=\"q\"\n           maxlength=\"100\"\n             results=\"0\"\n        autocomplete=\"off\"\n         placeholder=\"${placeholder}\"\/>\n  <\/span>\n  <span class=\"GBSearchBox_Submit\">\n    <a bindPoint=\"submit\" listen=\"click: searchSelectSubmit\" class=\"GBSearchBox_SubmitLink\" href=\"#\">\n      <span class=\"GBSearchBox_Button\">&nbsp;<\/span>\n    <\/a>\n  <\/span>\n<\/form>\n"}, Arbiter.BEHAVIOR_PERSISTENT);
Arbiter.inform("template\/registerTemplate", {"name":"\/gigaboxx\/templates\/ThreadMessageRow.tmpl","template":"\n<div bindPoint=\"root\" class=\"GBThreadMessageRow clearfix\">\n  <div class=\"GBThreadMessageRow_Image\">\n    <a class=\"GBThreadMessageRow_Image_Link\" href=\"${author_href}\">\n      <img class=\"UIProfileImage UIProfileImage_Large\" src=\"${author_image_src}\" \/>\n    <\/a>\n  <\/div>\n\n  <div class=\"GBThreadMessageRow_Main\">\n    <div class=\"GBThreadMessageRow_Info\">\n      <span bindPoint=\"authorLinkWrapper\" class=\"GBThreadMessageRow_AuthorLink_Wrapper\">\n        <a class=\"GBThreadMessageRow_AuthorLink\" href=\"${author_href}\">${author_name}<\/a>\n      <\/span>\n      <span class=\"GBThreadMessageRow_Date\">\n        ${message_date}\n      <\/span>\n      <span class=\"GBThreadMessageRow_BranchLink\" bindPoint=\"branchLinkWrapper\"><\/span>\n      <span class=\"GBThreadMessageRow_ReportLink\" bindPoint=\"reportLinkWrapper\"><\/span>\n    <\/div>\n    <div class=\"GBThreadMessageRow_Body\">\n      <div class=\"GBThreadMessageRow_Body_Content\">\n        $H{message_body}\n      <\/div>\n      <div class=\"GBThreadMessageRow_ReferrerLink\">\n        $H{message_referrer}\n      <\/div>\n      <div class=\"GBThreadMessageRow_Body_Attachment\">\n        $H{message_attachment}\n      <\/div>\n    <\/div>\n  <\/div>\n<\/div>\n"}, Arbiter.BEHAVIOR_PERSISTENT);
Arbiter.inform("template\/registerTemplate", {"name":"\/gigaboxx\/templates\/ThreadRow.tmpl","template":"\n<div bindPoint=\"root\" class=\"GBThreadRow\">\n  <table bindPoint=\"thread_row\" id=\"${id}\" cellpadding=\"0\">\n    <tr>\n      <td class=\"badge_column\">\n        <a href=\"\"\n           class=\"badge\"\n           bindPoint=\"badge\"\n           listen=\"click: toggleUnread\"\n           onselectstart=\"return false;\"><\/a>\n      <\/td>\n      <td class=\"checkbox\" onselectstart=\"return false;\">\n        <label bindPoint=\"selectorLabel\">\n          <input bindPoint=\"selector\"\n                 listen=\"click: toggleSelect\"\n                 type=\"checkbox\"\n                 value=\"${id}\" \/>\n        <\/label>\n      <\/td>\n      <td class=\"icon\">\n        <div class=\"Thread_Icon\">\n          <a bindPoint=\"iconAnchor\">\n            <img class=\"UIProfileImage UIProfileImage_LARGE\" bindPoint=\"icon\" \/>\n          <\/a>\n        <\/div>\n      <\/td>\n      <td class=\"envelope clickable\" listen=\"click: readThread\">\n        <div bindPoint=\"authors\" class=\"authors line\"><\/div>\n        <div bindPoint=\"date\" class=\"date tagline\"><\/div>\n      <\/td>\n      <td class=\"thread_detail clickable\" listen=\"click: readThread\">\n        <div bindPoint=\"subject\" class=\"subject line\"><\/div>\n        <div bindPoint=\"preview\" class=\"preview tagline\"><\/div>\n      <\/td>\n      <td class=\"clickable\" listen=\"click: readThread\">\n        <a href=\"\"\n           class=\"delete_button UIObjectListing_RemoveLink\"\n           bindPoint=\"deleteButton\"\n           listen=\"click: deleteMessage\"><\/a>\n      <\/td>\n    <\/tr>\n  <\/table>\n<\/div>\n"}, Arbiter.BEHAVIOR_PERSISTENT);
function inbox_search_typeahead(obj,_L1,_L2){this.anchor_block=true;this.parent.construct(this,obj,_L1,_L2);}inbox_search_typeahead.extend('typeaheadpro');copy_properties(inbox_search_typeahead.prototype,{auto_select:false,less_than_n_chars:true,touch_fired:false,show:function(){if(!this.less_than_n_chars){this.parent.show();this.dropdown.style.width='200px';}else this.hide();},hide:function(){this.parent.hide();var _L0=ge('inbox_search');if(_L0)CSS.removeClass(_L0,'typeahead_border');},fireTouch:function(){if(!this.touch_fired){AsyncRequest.pingURI('/ajax/inbox/touch.php',{},false);this.touch_fired=true;}},found_suggestions:function(_L0,_L1,_L2){this.parent.found_suggestions(_L0,_L1,_L2);if(this.list.firstChild&&this.list.firstChild.firstChild){CSS.addClass(this.list.firstChild.firstChild,'blue_top_border');CSS.removeClass(this.list,'no_border_list');CSS.addClass(this.list.lastChild.lastChild,'blue_bottom_border');var _L3=ge('inbox_search');if(_L3)CSS.addClass(_L3,'typeahead_border');}else{var _L3=ge('inbox_search');if(_L3)CSS.removeClass(_L3,'typeahead_border');CSS.addClass(this.list,'no_border_list');}}});
function inbox_search_friend_source(_L0){this.parent.construct(this,_L0);new AsyncRequest().setMethod('GET').setReadOnly(true).setURI('/ajax/inbox/inbox_search.php?'+_L0).setErrorHandler(function(){}).setHandler(function(_L1){this.values=_L1.getPayload().entries;this.build_index();}.bind(this)).send();}inbox_search_friend_source.extend('static_source');copy_properties(inbox_search_friend_source.prototype,{cache_results:true,gen_html:function(_L0,_L1){return ['<div>',typeahead_source.highlight_found(_L0.t,_L1),'</div><div><small>',_L0.n,'</small></div>'].join('');},search_value:function(_L0){if(!this.is_ready){this.owner.less_than_n_chars=true;return [];}else if(_L0.length>=2){this.owner.fireTouch();this.owner.less_than_n_chars=false;return this.parent.search_value(_L0);}return [];}});
function ObjectBrowserDataSource(_L0,_L1){this.data=_L0.data;this.id=_L0.id;this.meta=_L0.meta;this.object_id=_L0.object_id;this.object_class=_L0.object_class;this.count=0;this.currentPage=0;this.pageSize=_L1;this.pageData=[];if(_L0.entities){this.pageData[0]=_L0.entities;this.count=_L0.count;this.shouldFetch=false;}this.fetchCompleteListener=null;this.scrollTopPosition=0;}copy_properties(ObjectBrowserDataSource.prototype,{fetch:function(_L0){if(this.pageData[_L0]){if(this.pageData[_L0].requested)return;if(this.fetchCompleteListener)this.fetchCompleteListener(this.id,_L0,this.pageData[_L0],this.count);}else{this.pageData[_L0]={'requested':true};if(this.object_id)SocialGraphManager.init(this.object_class,this.object_id);SocialGraphManager.fetch(this.data,this.meta,_L0,this.pageSize,this.onFetchComplete.bind(this));}},search:function(_L0,_L1,_L2){SocialGraphManager.search(_L0,_L1,_L2);},prefetch:function(){if(!this.shouldFetch)return;if(!this.pageData[this.currentPage]){this.fetch(this.currentPage);}else this.fetch(this.currentPage+1);},nextPage:function(){this.currentPage++;this.fetch(this.currentPage);},prevPage:function(){if(this.currentPage>0)this.currentPage--;this.fetch(this.currentPage);},setFetchCompleteListener:function(_L0){this.fetchCompleteListener=_L0;},onFetchComplete:function(_L0){if(!_L0)return;var _L1=_L0.getPayload();if(!_L1||_L1.page==null)return;var _L2=_L1.page;if(!this.pageData[_L2]||this.pageData[_L2].requested)if(_L1.user_info){this.pageData[_L2]=_L1.user_info;}else this.pageData[_L2]={};this.count=_L1.count;if(this.fetchCompleteListener)this.fetchCompleteListener(this.id,_L2,_L1.user_info,_L1.count);},removeItem:function(id){if(this.pageData[this.currentPage]&&this.pageData[this.currentPage][id])delete this.pageData[this.currentPage][id];},removePage:function(_L0){this.pageData[_L0]=null;}});function ObjectBrowserController(_L0,_L1,_L2,_L3,_L4){this.filters={};this.currentFilter=null;this.pageSize=_L3;this.elementID=_L1;this.pageData=null;this.pageDataArray=null;this.objectType=_L4;this.didPrefetchAll=false;this.objects={};this.arbiterTokens=[];this.segments=[];this.itemsPerSegment=10;this.itemHeight=55;this.segmentsFixed=false;this.container=$(_L1+'_object_browser_body');this.contentArea=$(_L1+'_object_browser_content_area');this.headerElement=$(_L1+'_object_browser_header_element');this.tabContainer=$(_L1+'_object_browser_tab_container');this.pagerNext=ge(_L1+'_object_browser_pager_more');this.pagerPrev=ge(_L1+'_object_browser_pager_less');this.searchBox=ge(_L1+'_object_browser_search_box');this.searchHeader=ge(_L1+'_object_browser_search_header');this.noResultsBanner=ge(_L1+'_object_browser_no_results');this.blockPeople=ge(_L1+'_object_browser_block_people');this.dialog=Dialog.getCurrent();if(_L2){var _L5=this.onFilterFetchComplete.bind(this);for(var i=0;i<_L2.length;i++){var _L7=new ObjectBrowserDataSource(_L2[i],this.pageSize);_L7.setFetchCompleteListener(_L5);this.filters[_L2[i].id]=_L7;if(_L2[i].selected)this.currentFilter=_L7;}}if(_L0)this.renderPage(_L0);Event.listen(this.container,'scroll',this.onScroll.bind(this));if(this.currentFilter)if(!_L0||_L0.length==0){this.showLoadingUI();this.currentFilter.fetch(0);}var _L8=this.searchBox;var _L9=this.searchBox;var lis=DOM.scry(this.tabContainer,'li');if(lis.length){_L9=lis[0];if(!_L8)_L8=lis[lis.length-1];}if(_L8){var _Lb=_L8.offsetTop-_L9.offsetTop;var _Lc=_Lb+_L8.offsetHeight+3;CSS.setStyle(this.tabContainer,'height',_Lc+'px');}ObjectBrowserController.setController(_L1,this);}copy_properties(ObjectBrowserController,{controllers:{},getController:function(_L0){return this.controllers[_L0];},setController:function(_L0,_L1){var _L2=this.getController(_L0);if(_L2)_L2.cleanup();this.controllers[_L0]=_L1;}});copy_properties(ObjectBrowserController.prototype,{setupSegments:function(){var _L0=this.pageDataArray.length;var _L1=Math.ceil(_L0/this.itemsPerSegment);this.segments=[];var _L2=null;var _L3=null;for(var i=0;i<_L1;i++){var _L2=$N('div',{className:'object_browser_segment_div clearfix'});var _L3=$N('div');CSS.setClass(_L3,'object_browser_segment_loading');CSS.setStyle(_L3,'height',(this.itemsPerSegment*this.itemHeight)+'px');_L2.appendContent(_L3);this.segments.push(_L2);}if(_L3)CSS.setStyle(_L3,'height',((_L0%this.itemsPerSegment)*this.itemHeight)+'px');DOM.empty(this.contentArea);this.contentArea.appendContent(this.segments);},fixupSegments:function(){if(this.segments.length<=1||this.segmentsFixed)return;this.segmentsFixed=true;var _L0=this.segments[0].clientHeight;var _L1=Math.round(_L0/this.itemsPerSegment);if(_L1==this.itemHeight)return;this.itemHeight=_L1;for(var i=1;i<this.segments.length-1;i++)CSS.setStyle(this.segments[i],'height',_L0+'px');CSS.setStyle(this.segments[this.segments.length-1],'height',((this.pageDataArray%this.itemsPerSegment)*_L1)+'px');},cleanup:function(){for(var i=0;i<this.arbiterTokens.length;i++)Arbiter.unsubscribe(this.arbiterTokens[i]);this.arbiterTokens=[];},setPageData:function(_L0){this.pageData=_L0;this.pageDataArray=[];for(var x in _L0)this.pageDataArray.push(_L0[x]);},onScroll:function(){if(this.drawOnScrollTimeout)clearTimeout(this.drawOnScrollTimeout);this.drawOnScrollTimeout=setTimeout(this.drawOnScroll.bind(this),20);},drawOnScroll:function(){var _L0=this.container.scrollTop-this.pagerPrev.clientHeight;var _L1=this.itemsPerSegment*this.itemHeight;var _L2=Math.floor(_L0/_L1);var _L3=Math.floor((_L0+this.container.clientHeight)/_L1);_L2--;_L3++;for(var i=_L2;i<=_L3;i++)this.renderSegment(i);},prefetchAllFilters:function(){if(this.didPrefetchAll)return;this.didPrefetchAll=true;for(var _L0 in this.filters)this.filters[_L0].prefetch();},onFilterClick:function(_L0){if(_L0==this.currentFilter.id)return false;this.currentFilter.scrollTopPosition=this.container.scrollTop;if(this.searchHeader)CSS.addClass(this.searchHeader,'hidden_elem');var _L1=this.filters[_L0];if(!_L1){Util.error('Filter '+_L0+' not found');return false;}this.showLoadingUI();this.currentFilter=this.filters[_L0];_L1.fetch(_L1.currentPage);this.clearSearch();Arbiter.inform('/people_browser/filterclick/',{'id':_L0});return false;},setCurrentFilter:function(_L0){if((_L0==this.currentFilterID)||!this.filters[_L0])return;var _L1=this.elementID+'_filter_tabs';var _L2=Tabset.getInstance(_L1);if(!_L2)return;_L2.selectTab(_L1+'_'+_L0);this.currentFilter=this.filters[_L0];},nextPage:function(){this.showLoadingUI();this.currentFilter.nextPage();this.currentFilter.prefetch();},prevPage:function(){this.showLoadingUI();this.currentFilter.prevPage();},search:function(){this.showLoadingUI();this.currentFilter.search(this.searchBox.value,{'wrapper_id':this.elementID},this.onSearchComplete.bind(this));return false;},showLoadingUI:function(){DOM.empty(this.contentArea);CSS.addClass(this.pagerNext,'hidden_elem');CSS.addClass(this.pagerPrev,'hidden_elem');if(this.dialog)this.dialog.setTitleLoading(true);},hideLoadingUI:function(){if(this.dialog)this.dialog.setTitleLoading(false);},onSearchComplete:function(_L0){if(!_L0)return;var _L1=_L0.getPayload();if(!_L1)return;if(_L1.header){CSS.removeClass(this.searchHeader,'hidden_elem');DOM.setContent(this.searchHeader,HTML(_L1.header));Event.listen($(this.elementID+'_search_header_cancel_link'),'click',this.onCancelSearch.bind(this));}CSS.addClass(this.pagerNext,'hidden_elem');CSS.addClass(this.pagerPrev,'hidden_elem');this.container.scrollTop=0;this.renderPage(_L1.user_info);Arbiter.inform('/people_browser/search_complete/',{'wrapper_id':this.elementID,'filter':this.currentFilter.id});},onCancelSearch:function(){this.clearSearch();this.currentPage=0;this.currentFilter.fetch(0);return false;},clearSearch:function(){if(!this.searchHeader)return;CSS.addClass(this.searchHeader,'hidden_elem');DOM.empty(this.searchHeader);this.searchBox.value="";},onFilterFetchComplete:function(_L0,_L1,_L2,_L3){if(this.currentFilter.id!=_L0)return;if(this.filters[_L0].currentPage!=_L1)return;if(!this.container){Util.error('ObjectBrowserController.container not found');return;}CSS.conditionClass(this.blockPeople,'hidden_elem',_L0!='blocked');this.renderPage(_L2);this.container.scrollTop=this.filters[_L0].scrollTopPosition;var _L4=((_L1+1)*this.pageSize)<_L3;var _L5=_L1>0;CSS.conditionClass(this.pagerPrev,'hidden_elem',!_L5);CSS.conditionClass(this.pagerNext,'hidden_elem',!_L4);},removeItem:function(id){if(!this.objects[id]){Util.error('item not found in ObjectBrowserController.removeItem');return;}var _L1=this.objects[id].root;animation(_L1).blind().to('height','0').duration(300).hide().go();if(this.currentFilter)this.currentFilter.removeItem(id);},replaceItem:function(id,_L1){if(!this.objects[id]){Util.error('item not found in ObjectBrowserController.replaceItem');return;}var _L2=this.objects[id].root;var row=this.renderUser(_L1,true);DOM.replace(_L2,row.root);},hideActionLink:function(id){if(!this.objects[id]){Util.error('item not found in ObjectBrowserController.hideActionLink');return;}var _L1=this.objects[id].root;CSS.addClass(_L1,'object_browser_hidden_action');},setHeaderContent:function(_L0){DOM.setContent(this.headerElement,_L0);},showHeaderContent:function(_L0){CSS.conditionClass(this.headerElement,'hidden_elem',!_L0);},onRemoveClick:function(id){var _L1=this.pageData[id].title;var _L2={'id':id,'title':_L1,'element':this.elementID,'obj_label':this.objectType};if(this.pageData[id].removeArgs)copy_properties(_L2,this.pageData[id].removeArgs);Arbiter.inform('/people_browser/remove/',_L2);return false;},onActionClick:function(id,_L1){var _L2=this.pageData[id].title;var _L3={'id':id,'title':_L2,'action':_L1,'element':this.elementID,'obj_label':this.objectType};if(this.pageData[id].actionArgs)copy_properties(_L3,this.pageData[id].actionArgs);Arbiter.inform('/people_browser/action/'+_L1,_L3);return false;},addActionHandler:function(_L0,_L1){var _L2=function(_L0,_L3){_L1(_L3);};this.arbiterTokens.push(Arbiter.subscribe('/people_browser/action/'+_L0,_L2));},addRemoveHandler:function(_L0){var _L1=function(_L2,_L3){_L0(_L3);};this.arbiterTokens.push(Arbiter.subscribe('/people_browser/remove/',_L1));},replaceActionButton:function(id,_L1,_L2){var _L3=new UIActionButton(_L2).setSuppressMargin(true).setOnclick(this.onActionClick.bind(this,id,_L1));this.objects[id].setActionControl(_L3);},renderUser:function(_L0,_L1){if(this.objects[_L0.id]&&!_L1)return this.objects[_L0.id];var row=new UIObjectListing(_L0);row.setPicPadding(true);row.paint();if(_L0.removeable)row.setRemoveControl(true,this.onRemoveClick.bind(this,_L0.id));if(_L0.action){var _L3=new UIActionButton(_L0.actionText);_L3.setSuppressMargin(true);_L3.setOnclick(this.onActionClick.bind(this,_L0.id,_L0.action));row.setActionControl(_L3);}this.objects[_L0.id]=row;return row;},renderPage:function(_L0){this.setPageData(_L0);this.setupSegments();this.hideLoadingUI();CSS.addClass(this.noResultsBanner,'hidden_elem');this.renderSegment(0);setTimeout(this.renderSegment.bind(this,1),0);setTimeout(this.fixupSegments.bind(this),0);CSS.conditionClass(this.noResultsBanner,'hidden_elem',this.pageDataArray.length!=0);this.prefetchAllFilters();},renderSegment:function(_L0){if(_L0<0||_L0>=this.segments.length)return;if(this.segments[_L0].rendered)return;var _L1=_L0*this.itemsPerSegment;var _L2=_L1+this.itemsPerSegment-1;if(_L0==this.segments.length-1)_L2=this.pageDataArray.length-1;var _L3=[];for(var i=_L1;i<=_L2;i++){var row=this.renderUser(this.pageDataArray[i],true);_L3.push(row.root);}DOM.empty(this.segments[_L0]);DOM.appendContent(this.segments[_L0],_L3);this.segments[_L0].rendered=true;},reload:function(_L0){this.setCurrentFilter(_L0);this.currentFilter.scrollTopPosition=this.container.scrollTop;if(this.searchHeader)CSS.addClass(this.searchHeader,'hidden_elem');var _L1=this.filters[_L0];if(!_L1){Util.error('Filter '+_L0+' not found');return false;}this.showLoadingUI();this.currentFilter=this.filters[_L0];this.currentFilter.removePage(_L1.currentPage);_L1.fetch(_L1.currentPage);this.clearSearch();Arbiter.inform('/people_browser/filterclick/',{'id':_L0});return false;}});
function BroadcastManager(){}copy_properties(BroadcastManager,{popup:function(){new AsyncRequest().setURI('/ajax/gigaboxx/endpoint/BroadcastManager.php').setMethod('GET').setReadOnly(true).send();return false;},popupUnsubscribe:function(_L0){BroadcastManager.updateSubscription(false,_L0.id);ObjectBrowserController.getController(_L0.element).replaceActionButton(_L0.id,'broadcast_subscribe',_tx("Subscribe"));},popupSubscribe:function(_L0){BroadcastManager.updateSubscription(true,_L0.id);ObjectBrowserController.getController(_L0.element).replaceActionButton(_L0.id,'broadcast_unsubscribe',_tx("Unsubscribe"));},updateSubscription:function(_L0,oid){var _L2={action:_L0?'subscribe':'unsubscribe',oid:oid};new AsyncRequest().setURI('/ajax/gigaboxx/endpoint/BroadcastEndpoint.php').setData(_L2).setHandler(bagofholding).setErrorHandler(bagofholding).send();}});
function GBTabset(){var _L0=$N('div',{className:'GBTabset'},$N('span',{className:'GBTabset_Label'},_tx("Show: ")));copy_properties(this,{_selectedTab:null,_tabs:{},_tabsetNode:_L0});}copy_properties(GBTabset.prototype,{getNode:function(){return this._tabsetNode;},addTab:function(_L0,_L1,_L2,_L3,_L4){_L4=!!_L4;var _L5=$N('a',{href:_L2,className:'GBTabset_Pill',onclick:bind(this,this.selectTab,_L0)},$N('span',null,$N('span',null,$N('span',null,_L1))));this._tabs[_L0]={node:_L5,href:_L2,onselect:_L3||bagofholding};if(_L4){CSS.addClass(_L5,'selected');this._selectedTab=_L0;}this._tabsetNode.appendContent(_L5);return this;},updateTab:function(_L0,_L1,_L2,_L3){if(this._tabs[_L0]){var tab=this._tabs[_L0];if(_L1)tab.node.find('span.GBTabset_Pill_Left').setContent(_L1);if(_L2){tab.href=_L2;tab.node.href=_L2;}if(_L3)tab.onselect=_L3;}return this;},forceSelectTab:function(_L0,_L1){return this._selectTab(true,_L0,_L1);},selectTab:function(_L0,_L1){return this._selectTab(false,_L0,_L1);},_selectTab:function(_L0,_L1,_L2){if(typeof(this._tabs[_L1])=='undefined')return true;var tab=null;if(this._selectedTab){tab=this._tabs[this._selectedTab];CSS.removeClass(tab.node,'selected');this._selectedTab=null;}this._selectedTab=_L1;tab=this._tabs[this._selectedTab];CSS.addClass(tab.node,'selected');if(!_L0&&tab.onselect()!==false)URI(tab.href).go();return false;}});
function GBControlHeader(_L0){copy_properties(this,{_controller:_L0,_node:null,_rm:new RenderManager(this),_tabset:null,_selectedTabId:null});}GBControlHeader.mixin({getNode:function(){if(!this._node)this._buildNode();return this._node;},getTabset:function(){return this._tabset;},setSelectedTabId:function(_L0){if(this._selectedTabId!=_L0){this._selectedTabId=_L0;this._rm.dirty();}},paint:function(){if(this._controller.getConfig().showFilters)this._tabset.selectTab(this._selectedTabId);},_buildNode:function(){var _L0=[];var _L1=GigaboxxManager.Filters;this._tabset=new GBTabset().addTab('view_all',_tx("All"),this._controller.buildURI().addQueryData({filter:undefined,page:undefined}),null,this._controller.getViewState().getFilter()=='').addTab('view_unread',_tx("Unread"),this._controller.buildURI().addQueryData({filter:_L1.UNREAD,page:undefined}),null,this._controller.getViewState().getFilter()==_L1.UNREAD);Arbiter.subscribe('gigaboxx/view_changed',this._updateTabset.bind(this));var _L2=[];_L2.push(_tx("Select: {select_type_list}",{select_type_list:''}));_L2.push(this._buildSelectLink(_tx("All"),bind(this._controller,this._controller._doSelect,function(row){return true;})));_L2.push(', ');_L2.push(this._buildSelectLink(_tx("Read"),bind(this._controller,this._controller._doSelect,function(row){return !row.isUnread();})));_L2.push(', ');_L2.push(this._buildSelectLink(_tx("None"),bind(this._controller,this._controller._doSelect,function(row){return false;})));_L0.push($N('span',{className:'GBSelectList'},_L2));if(this._controller.getConfig().showFilters)_L0.push(this._tabset.getNode());if(this._controller.getConfig().alternateToolbarUI)return;this._node=$N('div',{className:'GBControlHeader clearfix'},_L0);},_buildSelectLink:function(_L0,_L1){var _L2=$N('a',{href:'#',onclick:_L1},_L0);return _L2;},_updateTabset:function(){var _L0=GigaboxxManager.Filters;this._tabset.updateTab('view_all',null,this._controller.buildURI().addQueryData({filter:undefined,page:undefined}),null);this._tabset.updateTab('view_unread',null,this._controller.buildURI().addQueryData({filter:_L0.UNREAD,page:undefined}),null);}});
function GBErrorView(_L0){copy_properties(this,{_controller:_L0});this._initialize();}copy_properties(GBErrorView.prototype,{paint:function(){var _L0=new Date().getTime();this._paintContentArea();this._controller.debugLog(this._controller.Debug.PAINT,"Paint Took "+(new Date().getTime()-_L0));},hide:function(){if(this._rootContainer.parentNode)DOM.replace(this._rootContainer,null);},show:function(){var _L0=this._controller.getContentArea();_L0.appendContent(this._rootContainer);this._controller.hideMuffin();},getTitle:function(){return _tx("Error");},_initialize:function(){if(this._initialized)return;this._initialized=true;this._rootContainer=$N('div',{'className':'gigaboxx_error'});},_paintContentArea:function(){var _L0=new Date().getTime();this._rootContainer.setContent(this._controller._errorMsg);this._controller.debugLog(this._controller.Debug.PAINT,"Message Paint Took "+(new Date().getTime()-_L0));}});
function GBSearchRequest(){}copy_properties(GBSearchRequest.prototype,{getId:abstractMethod,getLabel:abstractMethod,getQueryData:abstractMethod});function GBSearchRequestId(id,_L1){this.parent.construct(this);this.id=id;this.name=_L1;}GBSearchRequestId.extend('GBSearchRequest');GBSearchRequest.mixin({getId:function(){return 'Id:'+this.id;},getLabel:function(){return this.name;},getQueryData:function(){return {search_id:this.id,search_name:this.name};}});function GBSearchRequestTerms(_L0){this.parent.construct(this);this.terms=_L0;}GBSearchRequestTerms.extend('GBSearchRequest');GBSearchRequestTerms.mixin({getId:function(){return 'Terms:'+this.terms;},getLabel:function(){return this.terms;},getQueryData:function(){return {search_terms:this.terms};}});
function GBSearchBox(_L0){copy_properties(this,{_touchSent:false,_typeaheadInitialized:false,_typeaheadObject:null,_controller:_L0,root:null,typeahead:null});this.parent.construct(this,URI('/gigaboxx/templates/GBSearchBox.tmpl'),{placeholder:_tx("Search Inbox")});new TextInputControl(this.typeahead).setPlaceholderText(this.typeahead.getAttribute('placeholder'));}GBSearchBox.extend('TemplateObject');copy_properties(GBSearchBox.prototype,{getRoot:function(){return this.root;},searchFocus:function(){bind(this,this._doTouch).defer();this._initializeTypeahead();return false;},searchSelectSubmit:function(){if(!$(this.typeahead).isEmpty()){this.searchSubmit();}else this.typeahead.focus();return false;},searchSubmit:function(_L0){_L0=this._typeaheadObject.get_current_selection();var _L1=null;if(_L0){_L1=new GBSearchRequestId(_L0.i,_L0.t);}else{var _L2=this._typeaheadObject.get_value();if(_L2)_L1=new GBSearchRequestTerms(_L2);}if(_L1){this._controller.buildURI(true).addQueryData(_L1.getQueryData()).go();this._typeaheadObject.blur();this._typeaheadObject.set_value('');this._typeaheadObject.dirty_results();}return false;},_doTouch:function(){if(!this._touchSent){new AsyncSignal('/ajax/gigaboxx/endpoint/SearchTouch.php').send();this._touchSent=true;}},_initializeTypeahead:function(){if(this._typeaheadInitialized)return;this._typeaheadInitialized=true;var _L0=new inbox_search_friend_source('');_L0.search_limit=5;_L0.text_noinput='';_L0.text_nomatch='';_L0.text_placeholder='';this._typeaheadObject=new inbox_search_typeahead(this.typeahead,_L0,{onsubmit:bind(this,this.searchSubmit),max_results:5});}});
function GBMessageHistoryView(_L0){copy_properties(this,{_controller:_L0});}copy_properties(GBMessageHistoryView.prototype,{paint:function(){IL().b('MessageHistory Paint');var _L0=new Date().getTime();this._paintContentArea();this._controller.debugLog(this._controller.Debug.PAINT,"Paint Took "+(new Date().getTime()-_L0));IL().e('MessageHistory Paint');},hide:function(){var _L0=this._controller.getContentArea();var _L1=ge(_L0.id+'_message_pane');if(_L1){hide(_L1);DOM.empty(_L1);}},show:function(){var _L0=this._controller.getContentArea();show(_L0.id+'_message_pane');this._controller.showMuffin();},getTitle:function(){return this._controller._activeThreadData.subject;},_fetchBranch:function(_L0,_L1){var _L2={'tid':_L1.threadId,'base_thread':_L0.threadId};new AsyncRequest().setData(_L2).setURI('/ajax/gigaboxx/endpoint/ReadBranch.php').setReadOnly(true).setMethod('GET').setHandler(bind(this,this._fetchBranchHandler,_L0,_L1)).setErrorHandler(bind(this,this._fetchBranchError,_L1)).send();},_fetchBranchHandler:function(_L0,_L1,_L2){var _L3=_L2.getPayload();var _L4=_L3.thread;var _L5=ge(_L0.threadId+'_messages');if(_L5){if(_L4.messages){var _L6=this._buildMessages(_L0.threadId,_L4.messages,true);_L5.prependContent(_L6.message_nodes);_L6.onload_script();}if(_L4.parentThread)_L5.prependContent(this._buildBranchLink(_L0,_L4));}var _L7=ge('branch_message_'+_L1.threadId);if(_L7)_L7.parentNode.removeChild(_L7);},_fetchBranchError:function(_L0,_L1){var _L2=ge('branch_message_'+_L0.threadId);if(_L2)_L2.setContent(_tx("There was an error trying to get previous messages.  Please try again later."));},_showHiddenMessages:function(_L0,_L1,_L2){var _L3=ge(_L0+'_messages');if(_L3){var _L4=this._buildMessages(_L0,_L1,true);_L3.prependContent(_L4.message_nodes);_L4.onload_script();}if(_L2)DOM.remove(_L2);},_buildMessages:function(_L0,_L1,_L2){var _L3=[];var _L4="";var _L5=0;var _L6=false;var _L7=false;for(var _L8=_L1.length-1;_L8>=0;_L8--){var _L9=_L1[_L8];var row=new ThreadMessageRow(this._controller,_L9,_L0);_L3=row.getNodes().concat(_L3);_L4=_L4.concat(_L9.messageOnload);_L5++;if(!_L2&&!_L9.unread&&_L5>=this._controller.getConfig().messageDisplayCount)break;}if(_L5<_L1.length){var _Lb={'View_previous_messages_link':''};var _Lc=$N('h6',{'className':'gigaboxx_thread_hidden_messages'},[_tx("{View_previous_messages_link}",_Lb)]);var _Ld=this._showHiddenMessages.bind(this,_L0,_L1.slice(0,_L1.length-_L5),_Lc);var _Le=$N('a',{'onclick':_Ld},_tx("Earlier Messages"));_Lc.appendContent(_Le);_L3.unshift(_Lc);}return {message_nodes:_L3,onload_script:new Function(_L4)};},_buildBranchLink:function(_L0,_L1){var _L2=this._fetchBranch.bind(this,_L0,_L1);var _L3=$N('a',{'onclick':_L2},_tx("View previous thread."));var _L4={'View_previous_thread_link':''};var _L5=$N('h6',{'className':'gigaboxx_thread_branch_message','id':'branch_message_'+_L1.threadId},[_tx("This thread has been branched from a previous thread.  {View_previous_thread_link}",_L4),_L3]);return _L5;},_paintContentArea:function(){var _L0=new Date().getTime();IL().b('MessageHistory Paint ContentArea');var _L1=this._controller._activeThreadData;var _L2=[];_L2.push(this._buildReadMessageHeader(_L1));if(_L1.parentThread)_L2.push(this._buildBranchLink(_L1,_L1));var _L3={message_nodes:null,onload_script:new Function()};if(_L1.messages)_L3=this._buildMessages(_L1.threadId,_L1.messages);_L2.push($N('div',{'id':_L1.threadId+'_messages'},_L3.message_nodes));var _L4='';if(_L1.renderedReplyComposer){var mk=HTML(_L1.renderedReplyComposer[0]);_L2.push(mk);_L4=_L1.renderedReplyComposer[1];}var _L6=this._controller._getMessagePane();DOM.setContent(_L6,_L2);_L3.onload_script();(new Function(_L4))();this._controller._activeThreadMessagesRoot=$(_L1.threadId+'_messages');IL().e('MessageHistory Paint ContentArea');this._controller.debugLog(this._controller.Debug.PAINT,"Message Paint Took "+(new Date().getTime()-_L0));},_buildReadMessageHeader:function(_L0){var _L1=$N('h2',{'className':'gigaboxx_thread_header_subject'},_L0.subject);var _L2=$N('div',{'className':'gigaboxx_thread_header_authors'},HTML(_L0.renderedAuthorList));var _L3=$N('div',{'className':'gigaboxx_thread_header'},[_L1,_L2]);return _L3;},_getFolderName:function(){var _L0=this._controller.getViewState();if(_L0.isSearchRequest())return _L0.searchRequest.getLabel();switch(_L0.folder){case GigaboxxManager.Folders.REQUESTS:return _tx("Requests");case GigaboxxManager.Folders.UPDATES:return _tx("Updates");case GigaboxxManager.Folders.SENT:return _tx("Sent");case GigaboxxManager.Folders.MESSAGES:default:return _tx("Messages");}}});
function GigaboxxThreadCache(){copy_properties(this,{_cache:{}});}GigaboxxThreadCache.mixin('Arbiter',{getThreadData:function(_L0){return this._cache[_L0]||null;},isCached:function(_L0){return this._cache[_L0]!=undefined;},flushCache:function(){this._cache={};},mergeThreadData:function(_L0){copy_properties(this._cache,_L0);for(var tid in _L0)this.dirty(tid);},mergeMessageData:function(_L0,_L1){var _L2=this._cache[_L0];if(_L2){_L2.snippet=_L1.message.substr(0,60);this.dirty(_L0);}},dirty:function(_L0){this.inform('GigaboxxThreadCache/dirty/'+_L0,null,Arbiter.BEHAVIOR_STATE);},getCache:function(){return this._cache;}});
function UIButtonStrip(){copy_properties(this,{_buttons:[],_disabledStates:[],_wrapperNodes:[],_rm:new RenderManager(this),_root:$N('span',{className:'UIButtonStrip'})});}copy_properties(UIButtonStrip.prototype,{addButton:function(_L0){_L0.setSuppressMargin(true);var _L1=this._buttons.length;this._buttons.push(_L0);this._disabledStates[_L1]=_L0.getDisabled();_L0.setDisabledOriginal=_L0.setDisabled;_L0.setDisabled=this.setDisabled.bind(this,_L0);this._rm.dirty();return this;},setDisabled:function(_L0,_L1){var _L2=this._buttons.indexOf(_L0);this._disabledStates[_L2]=_L1;this._rm.dirty();return this;},paint:function(){var _L0=[];var _L1=null;for(var i=0;i<this._buttons.length;i++){var _L3=this._buttons[i].getNodes();if(this._wrapperNodes[i]===undefined)_L0.push(this._wrapperNodes[i]=$N('span',{className:'UIButtonStrip_Wrapper'},_L3));var _L4=this._wrapperNodes[i];var _L5=this._disabledStates[i];if(i>0&&_L5&&!this._disabledStates[i-1]){CSS.addClass(_L1,'UIButtonStrip_EnabledToDisabled');CSS.addClass(_L4,'UIButtonStrip_DisabledFromEnabled');}else{CSS.removeClass(_L4,'UIButtonStrip_DisabledFromEnabled');if(i>0&&(!_L5||this._disabledStates[i-1]))CSS.removeClass(_L1,'UIButtonStrip_EnabledToDisabled');}this._buttons[i].setDisabledOriginal(_L5);_L1=_L4;}if(_L0)this._root.appendContent(_L0);return;},getNodes:function(){return [this._root];}});
function GBThreadListView(_L0){copy_properties(this,{_controller:_L0,_header:new GBControlHeader(_L0)});this._initialize();}copy_properties(GBThreadListView.prototype,{paint:function(){var _L0=new Date().getTime();IL().b('ThreadList Paint');this._paintControlHeader();this._paintContentArea();IL().e('ThreadList Paint');this._controller.debugLog(this._controller.Debug.PAINT,"Paint Took "+(new Date().getTime()-_L0));},hide:function(){var _L0=this._controller.getContentArea();hide(_L0.id+'_thread_list');hide(this._header.getNode());},show:function(){var _L0=this._controller.getContentArea();show(_L0.id+'_thread_list');show(this._header.getNode());this._controller.hideMuffin();},getTitle:function(){return null;},_initialize:function(){if(this._initialized)return;this._initialized=true;var _L0=this._controller.getContentArea();_L0.prependContent(this._header.getNode());},_paintControlHeader:function(){var _L0=new Date().getTime();IL().b('ThreadList Paint Control');var _L1=this._controller.getViewState();if(_L1.getSearchRequest()||(_L1.getFolder()==GigaboxxManager.Folders.MESSAGES&&_L1.getSubFolder())||_L1.getFolder()==GigaboxxManager.Folders.SENT){hide(this._header.getTabset().getNode());}else{var _L2=null;switch(_L1.getFilter()){case GigaboxxManager.Filters.UNREAD:_L2='view_unread';break;case null:default:_L2='view_all';break;}this._header.getTabset().forceSelectTab(_L2);show(this._header.getTabset().getNode());}IL().e('ThreadList Paint Control');this._controller.debugLog(this._controller.Debug.PAINT,"Header Paint Took "+(new Date().getTime()-_L0));},_paintContentArea:function(){var _L0=this._controller.getViewState();var _L1=new Date().getTime();IL().b('ThreadList Paint ContentArea');var _L2=this._controller._getViewStateData().list.getPage(this._controller.getPage());for(var i=0;i<this._controller._pageSize;i++){var _L4=_L2&&_L2[i]||null;this._paintThreadRow(i,_L4);}this._controller._updateToolbarOnSelect();IL().e('ThreadList Paint ContentArea');this._controller.debugLog(this._controller.Debug.PAINT,"Message Paint Took "+(new Date().getTime()-_L1));},_paintThreadRow:function(_L0,_L1){if(_L1==null){this._controller._threadList.setThreadRow(_L0,null);}else{var _L2=this._controller._getThreadRow(_L1);_L2.paint(_L0);this._controller._threadList.setThreadRow(_L0,_L2);}}});
function Collection(_L0,_L1){if(!_L0.__collection__){var _L2=new Function();for(var _L3 in _L0.prototype)_L2.prototype[_L3]=Collection._call.bind(null,_L3);_L0.__collection__=_L2;}var _L4=new _L0.__collection__();_L4._elements=_L1;return _L4;}Collection._call=function(_L0){var _L1=Array.prototype.slice.call(arguments,1);this._elements.each(function(_L2){_L2[_L0].apply(_L2,_L1);});return this;};
function GBToolbarManager(_L0,_L1,_L2,_L3){copy_properties(this,{_controller:_L0,_components:{},_searchToolbar:_L3,_topToolbar:_L1,_bottomToolbar:_L2,_needToUpdateBackButton:false});this._controller.subscribe('gigaboxx/viewChanged',this._viewChanged.bind(this));this._initialize.bind(this).defer();}GBToolbarManager.Locations=['top','bottom','search'];GBToolbarManager.mixin({_viewChanged:function(){this._needToUpdateBackButton=true;},_initialize:function(){IL().b('ToolbarManager initialize');this._initialized=true;var st=this._searchToolbar;var tt=this._topToolbar;var bt=this._bottomToolbar;st.reset();st.addContent(this.getComponent('SearchBox','top').getRoot(),'left');tt.reset();tt.addContent(this._controller._topPager.getRoot(),'right');tt.addContent(this._controller._topMessagePager.getRoot(),'right');tt.addButton(this.getComponent('BackButton','top'),'left');tt.addButton(this.getComponent('ComposeButton','top'),'left');tt.addButton(this.getComponent('ToolbarDivider','top'),'left');tt.addButton(this.getComponent('SelectAllButton','top'),'left');tt.addButton(this.getComponent('SelectNoneButton','top'),'left');tt.addButton(this.getComponent('ReadButton','top'),'left');tt.addButton(this.getComponent('UnreadButton','top'),'left');tt.addContent(this.getComponent('DeleteAndReportSpamButtonStrip','top').getNodes(),'left');tt.addButton(this.getComponent('UnsubscribeUpdateButton','top'),'left');bt.reset();bt.addContent(this._controller._bottomPager.getRoot(),'right');bt.addContent(this._controller._bottomMessagePager.getRoot(),'right');bt.addButton(this.getComponent('BackButton','bottom'),'left');bt.addButton(this.getComponent('EditSubscriptionsButton','bottom'),'left');IL().e('ToolbarManager initialize');},paint:function(){var _L0=new Date().getTime();IL().b('ToolbarManager Paint Toolbar');var _L1=this._controller.getViewState().getFolder();var _L2=_L1==GigaboxxManager.Folders.SENT;var _L3=_L1==GigaboxxManager.Folders.UPDATES;switch(this._controller.getView()){case 'read_message':var _L4=false;if(_L3){var _L5=this._controller._activeThreadData;_L4|=_L5.subscription&&_L5.subscription.subscribed;}this.getComponent('UnreadButton').setDisabled(_L2).setHidden(false);this.getComponent('ReadButton').setHidden(true);this.getComponent('ReportSpamButton').setDisabled(_L2).setHidden(false);this.getComponent('DeleteButton').setDisabled(false).setHidden(false);this.getComponent('UnsubscribeUpdateButton').setDisabled(!_L4).setHidden(!_L3);this.getComponent('EditSubscriptionsButton').setHidden(!_L3);this.getComponent('ComposeButton').setHidden(true);this.getComponent('BackButton').setHidden(false);this.getComponent('EditSubscriptionsButton').setHidden(true);this.getComponent('SelectAllButton').setHidden(true);this.getComponent('SelectNoneButton').setHidden(true);this._controller._topPager.setHidden(true);this._controller._bottomPager.setHidden(true);this._controller._topMessagePager.setHidden(false);this._controller._bottomMessagePager.setHidden(false);break;case 'thread_list':default:this.getComponent('ComposeButton').setHidden(false);this.getComponent('BackButton').setHidden(true);this.getComponent('EditSubscriptionsButton').setHidden(!_L3);this._controller._topPager.setHidden(false);this._controller._bottomPager.setHidden(false);this._controller._topMessagePager.setHidden(true);this._controller._bottomMessagePager.setHidden(true);break;}if(this._needToUpdateBackButton){this.getComponent('BackButton','top').setTitle(this._buildBackButtonContent());this.getComponent('BackButton','bottom').setTitle(this._buildBackButtonContent());this._needToUpdateBackButton=false;}IL().e('ToolbarManager Paint Toolbar');this._controller.debugLog(this._controller.Debug.PAINT,"Toolbar Paint Took "+(new Date().getTime()-_L0));},getComponent:function(_L0,_L1){var key=_L0;if(_L1!==undefined&&_L0!='SearchBox')key+='_'+_L1;if(this._components[key]===undefined)this._initComponent(_L0);return this._components[key];},_initComponent:function(_L0){var _L1='_init'+_L0;if(typeof(this[_L1])!='function'){this._components[_L0]=null;}else this[_L1]();},_buildBackButtonContent:function(){return [_tx("Back to {folder_name}",{folder_name:this._getFolderName()})];},_getFolderName:function(){var _L0=this._controller.getViewState();if(_L0.isSearchRequest())return _tx("Results");switch(_L0.folder){case GigaboxxManager.Folders.REQUESTS:return _tx("Requests");case GigaboxxManager.Folders.UPDATES:return _tx("Updates");case GigaboxxManager.Folders.SENT:return _tx("Sent");case GigaboxxManager.Folders.MESSAGES:default:return _tx("Messages");}},_initSearchBox:function(){this._components['SearchBox']=new GBSearchBox(this._controller);return false;},_initToolbarDivider:function(){var _L0=[];GBToolbarManager.Locations.forEach(function(_L1){_L0.push(this._components['ToolbarDivider_'+_L1]=new UIActionButton('').setOnclick(function(){return false;}));CSS.addClass(this._components['ToolbarDivider_'+_L1].getNodes()[0],'GBToolbarDivider');},this);this._components['ToolbarDivider']=new Collection(UIActionButton,_L0);},_initComposeButton:function(){var _L0=[];GBToolbarManager.Locations.forEach(function(_L1){_L0.push(this._components['ComposeButton_'+_L1]=new UIActionButton(_tx("Compose")).setOnclick(Dialog.bootstrap.shield(null,'/gigaboxx/dialog/MessageComposer.php',{},true)).setIcon(UIActionButton.iconPlus));},this);this._components['ComposeButton']=new Collection(UIActionButton,_L0);},_initDeleteAndReportSpamButtonStrip:function(){var _L0=[];GBToolbarManager.Locations.forEach(function(_L1){_L0.push(this._components['DeleteAndReportSpamButtonStrip_'+_L1]=new UIButtonStrip().addButton(this.getComponent('ReportSpamButton',_L1)).addButton(this.getComponent('DeleteButton',_L1)));},this);this._components['DeleteAndReportSpamButtonStrip']=new Collection(UIButtonStrip,_L0);},_initSelectAllButton:function(){this.__initActionButton('SelectAllButton',_tx("Select All"),'select_all');},_initSelectNoneButton:function(){this.__initActionButton('SelectNoneButton',_tx("Select None"),'select_none');},_initDeleteButton:function(){this.__initActionButton('DeleteButton',_tx("Delete"),'delete');},_initUnsubscribeUpdateButton:function(){this.__initActionButton('UnsubscribeUpdateButton',_tx("Unsubscribe"),'unsubscribe');},_initReportSpamButton:function(){this.__initActionButton('ReportSpamButton',_tx("Report Spam"),'report');},_initUnreadButton:function(){this.__initActionButton('UnreadButton',_tx("Mark as Unread"),'unread');},_initReadButton:function(){this.__initActionButton('ReadButton',_tx("Mark as Read"),'read');},_initEditSubscriptionsButton:function(){this.__initButton('EditSubscriptionsButton',_tx("Edit Subscriptions"),BroadcastManager.popup.curry());},_initBackButton:function(){this.__initButton('BackButton',this._buildBackButtonContent(),function(){this._controller.buildURI().go();return false;}.bind(this),UIActionButton.iconBack);},__initActionButton:function(_L0,_L1,_L2){this.__initButton(_L0,_L1,bind(this._controller,this._controller._doSelectedAction,_L2),null,true);},__initButton:function(_L0,_L1,_L2,_L3,_L4){var _L5=[];GBToolbarManager.Locations.forEach(function(_L6){_L5.push(this._components[_L0+'_'+_L6]=new UIActionButton(_L1).setOnclick(_L2).setDisabled(_L4||false));if(_L3)this._components[_L0+'_'+_L6].setIcon(_L3);},this);this._components[_L0]=new Collection(UIActionButton,_L5);}});
function GBUndoManager(_L0){copy_properties(this,{_controller:_L0,_action:$('GBUndoAction'),_currently_displaying:false,_deferred_notification:null});}GBUndoManager.mixin({deferUndoNotification:function(_L0){this._deferred_notification=_L0;},hasPendingDeferredNotification:function(){return !!this._deferred_notification;},displayDeferredNotification:function(){this.setUndoNotification(this._deferred_notification);this._deferred_notification=null;},setUndoNotification:function(_L0){if(!_L0)return;var _L1=function(){this._action.setContent($N('span',{className:'GBUndoAction_notification'},[$N('span',{className:'GBUndoAction_notification_text'},HTML(_L0.text)),$N('a',{className:'GBUndoAction_link',href:'#',onclick:this._sendUndoRequest.bind(this,_L0.action)},HTML(_tx("Undo")))]));}.bind(this);if(this._currently_displaying){animation(this._action).to('opacity',.5).duration(100).checkpoint(1,_L1).to('opacity',1).duration(100).go();}else{this._action.style.opacity=0;_L1();animation(this._action).show().to('height','auto').from('marginTop',0).from('marginBottom',0).to('marginTop',10).to('marginBottom',10).duration(300).checkpoint().to('opacity',1).duration(300).ease(animation.ease.both).go();this._currently_displaying=true;}},clearNotification:function(){if(this._currently_displaying){animation(this._action).to('opacity',0).duration(300).ease(animation.ease.both).checkpoint().to('height',0).from('marginTop',10).from('marginBottom',10).to('marginTop',0).to('marginBottom',0).duration(300).hide().go();this._currently_displaying=false;}},_sendUndoRequest:function(_L0){new AsyncRequest('/ajax/gigaboxx/endpoint/UndoAction.php').setMethod('POST').setData({data:_L0}).setHandler(this._handleUndoResponse.bind(this,_L0)).setStatusElement(this._action).send();return false;},_handleUndoResponse:function(_L0,_L1){DOM.remove(DOM.find(this._action,'.GBUndoAction_link'));if(!this._updateViewOnUndo(_L0,_L1))this.clearNotification();},_updateViewOnUndo:function(_L0,_L1){switch(_L0.type){case 'GigaboxxUndoableDeleteAction':case 'GigaboxxUndoableReportAsSpamAction':return this._controller.updateViewOnUndoDelete(_L1);case 'GigaboxxUndoableUnsubscribeAction':return this._controller.updateViewOnSubscriptionChange(_L1.getPayload(),true);}return false;}});
function GBViewState(_L0,_L1,_L2,_L3){copy_properties(this,{_onViewChangeHandler:bagofholding,_onPropertyChangeHandlers:{},folder:_L0||'',subfolder:_L1||'',filter:_L2||'',page:_L3||1,searchRequest:null});}copy_properties(GBViewState,{constructFromStruct:function(_L0){var _L1=new GBViewState();for(var key in _L0)switch(key){case 'folder':_L1.setFolder(_L0[key]);break;case 'subfolder':_L1.setSubFolder(_L0[key]);break;case 'filter':_L1.setFilter(_L0[key]);break;case 'search_id':_L1.setSearchRequest(new GBSearchRequestId(_L0[key].id,_L0[key].name));break;case 'search_terms':_L1.setSearchRequest(new GBSearchRequestTerms(_L0[key]));break;}return _L1;}});copy_properties(GBViewState.prototype,{isSearchRequest:function(){return !!this.searchRequest;},getViewId:function(){if(this.searchRequest)return 'Search:'+this.searchRequest.getId();return this.folder+':'+this.subfolder+':'+this.filter;},setOnViewChangeHandler:function(_L0){this._onViewChangeHandler=_L0;return this;},setOnPropertyChangeHandler:function(_L0,_L1){this._onPropertyChangeHandlers[_L0]=_L1;return this;},setFolder:function(_L0){return this._mutate('folder',_L0);},getFolder:function(){return this.folder;},setSubFolder:function(_L0){return this._mutate('subfolder',_L0);},getSubFolder:function(){return this.subfolder;},setFilter:function(_L0){return this._mutate('filter',_L0);},getFilter:function(){return this.filter;},setPage:function(_L0){return this._mutate('page',_L0);},getPage:function(){return this.page;},setSearchRequest:function(_L0){return this._mutate('searchRequest',_L0);},clearSearchRequest:function(){this.setSearchRequest(null);},getSearchRequest:function(){return this.searchRequest;},getViewData:function(){var _L0={};if(this.searchRequest){copy_properties(_L0,this.searchRequest.getQueryData());}else{_L0.folder=this.folder;if(this.subfolder)_L0.subfolder=this.subfolder;if(this.filter)_L0.filter=this.filter;}if(this.page)_L0.page=this.page;return _L0;},_mutate:function(_L0,_L1){var _L2=this.getViewId();var _L3=this[_L0];this[_L0]=_L1;var _L4=this.getViewId();var _L5=this[_L0];if(_L3!=_L5&&typeof(this._onPropertyChangeHandlers[_L0])=='function')this._onPropertyChangeHandlers[_L0]();if(_L2!=_L4)this._onViewChangeHandler();return this;},toString:function(){return ["Folder: ",this.folder," Subfolder: ",this.subfolder," Filter: ",this.filter," Page: ",this.page," Search: ",this.searchRequest].join('');}});
function ThreadRow(_L0,_L1){copy_properties(this,{threadId:_L1,_controller:_L0,_dirty:true,root:null,readLinks:[],authors:null,date:null,subject:null,preview:null,selector:null,selectorLabel:null});this._controller.threadCache.subscribe('GigaboxxThreadCache/dirty/'+_L1,this.dirty.bind(this),Arbiter.SUBSCRIBE_NEW);this.parent.construct(this,URI('/gigaboxx/templates/ThreadRow.tmpl'),{id:_L1});Event.listen(this.root,'mouseover',CSS.addClass.curry(this.root,'GBThreadRow_Hover'));Event.listen(this.root,'mouseout',CSS.removeClass.curry(this.root,'GBThreadRow_Hover'));var _L2=[this.selectorLabel,this.icon,this.badge,this.deleteButton];for(var i=0;i<_L2.length;i++){var _L4=_L2[i];Event.listen(_L4,'mouseover',CSS.addClass.curry(this.root,'GBThreadRow_HoverBlocker'));Event.listen(_L4,'mouseout',CSS.removeClass.curry(this.root,'GBThreadRow_HoverBlocker'));}}ThreadRow.extend('TemplateObject');copy_properties(ThreadRow.prototype,{deleteMessage:function(){this._controller.deleteMessages(this.threadId);return false;},toggleUnread:function(){if(this._controller.getViewState().getFolder()!=GigaboxxManager.Folders.SENT||this.isUnread())this._controller.setMessageTag(this.threadId,GigaboxxManager.Filters.UNREAD,this.isUnread());return false;},toggleSelect:function(e){e=$E(e);if(e.shiftKey||e.ctrlKey||e.metaKey){var _L1=this._controller.threadCache.getThreadData(this.threadId);if(_L1){var _L2=_L1.tags.contains(GigaboxxManager.Filters.UNREAD);if((e.shiftKey&&_L2)||e.ctrlKey||e.metaKey)this._controller.setMessageTag(this.threadId,GigaboxxManager.Filters.UNREAD,_L2);}e.kill();return false;}this._controller._updateToolbarOnSelect();},readThread:function(e){var _L1=$E(e).getTarget();if(_L1&&_L1.href&&!this._controller.isGigaboxxURI(_L1.href))return true;var _L2=URI(this._controller.buildURI()).addQueryData({tid:this.threadId}).go();return false;},isUnread:function(){return this._getThreadData().tags.contains(GigaboxxManager.Filters.UNREAD);},isReplied:function(){var _L0=this._getThreadData().recentAuthors;return _L0.length&&_L0[0]==this._controller._userId;},getFolderTags:function(){return values(GigaboxxManager.Folders).filter(function(_L0){return this._getThreadData().tags.contains(_L0);});},_getThreadData:function(){return this._controller.threadCache.getThreadData(this.threadId);},dirty:function(){this._dirty=true;},paint:function(_L0){if(!this._dirty)return;this._dirty=false;if(this._controller.getConfig().alternateToolbarUI&&!_L0)CSS.addClass(this.root,'GBThreadRow_NoBorder');var _L1=this._getThreadData();if(_L1.inaccessible){if(this._controller.getViewState().isSearchRequest()){CSS.addClass(this.root,'hidden_elem');}else{this._inaccessible=$N('div',{className:'GBThreadRow_InaccessibleWarning'},_tx("Sorry, the contents of this thread are temporarily unavailable."));DOM.appendContent(this.root,this._inaccessible);CSS.addClass(this.root,'GBThreadRow_Inaccessible');}return;}else if(this._inaccessible){DOM.remove(this._inaccessible);delete this._inaccessible;CSS.removeClass(this.root,'GBThreadRow_Inaccessible');}else CSS.removeClass(this.root,'hidden_elem');var _L2=[];var _L3=_L1.recentAuthorsData;for(var _L4 in _L3){var _L5=_L3[_L4];if(_L5.href){var _L6=$N('a',{href:_L5.href,title:_L5.title},_L5.html);_L2.push(_L6);Event.listen(_L6,'mouseover',CSS.addClass.curry(this.root,'GBThreadRow_HoverBlocker'));Event.listen(_L6,'mouseout',CSS.removeClass.curry(this.root,'GBThreadRow_HoverBlocker'));}else _L2.push(_L5.html);_L2.push(', ');}_L2.pop();var _L7=_L1.snippet;var _L8=_L1.subject||_tx("(no subject)");this.icon.src=_L1.icon.image;this.icon.alt=_L1.icon.alt;this.iconAnchor.href=_L1.icon.href;DOM.setContent(this.authors,_L2);DOM.setText(this.date,_L1.timeLastUpdatedRendered);DOM.setContent(this.preview,_L7);DOM.setContent(this.subject,_L8);CSS.conditionClass(this.thread_row,'unread',this.isUnread());CSS.conditionClass(this.thread_row,'replied',this.isReplied());}});
function ThreadList(_L0,_L1){var _L2=[];for(var i=0;i<_L1;i++)_L2.push($N('div'));var _L4=$N('div',{className:'ThreadList'},_L2);var _L5=_L0.getContentArea().id+'_thread_list';var _L6=$N('div',{id:_L5,className:'ThreadListWrapper'},_L4);copy_properties(this,{_controller:_L0,_fallback:null,_threadList:_L4,_threadListWrapper:_L6,_rm:new RenderManager(this),_rowNodes:_L2,_rowObjects:[],_size:_L1});}copy_properties(ThreadList.prototype,{getNode:function(){return this._threadListWrapper;},getThreadRows:function(){return this._rowObjects;},setSize:function(_L0){if(_L0==this._size)return;if(_L0>this._size){var _L1=[];for(var i=this._size;i<_L0;i++){var _L3=$N('div');this._rowNodes.push(_L3);_L1.push(_L3);}this._threadList.appendContent(_L1);}else{for(var i=this._size;i>_L0;i--){var _L3=this._rowNodes[i-1];while(_L3.firstChild)_L3.removeChild(_L3.firstChild);DOM.remove(_L3);}this._rowNodes.splice(_L0,this._size-_L0);}this._size=_L0;},setThreadRow:function(_L0,_L1){var _L2=this._rowNodes[_L0];var _L3=this._rowObjects[_L0];if(_L1!=null){if(_L3!=_L1){this._rowObjects[_L0]=_L1;while(_L2.firstChild)_L2.removeChild(_L2.firstChild);DOM.setContent(_L2,_L1.root);}}else{delete this._rowObjects[_L0];while(_L2.firstChild)_L2.removeChild(_L2.firstChild);}this._rm.dirty();return this;},paint:function(){if(this._hasThreadRows()){if(this._fallback){DOM.remove(this._fallback);this._fallback=null;}}else if(!this._fallback){this._fallback=$N('div',{className:'ThreadListFallback'},this._buildFallbackContent());this._threadListWrapper.appendContent(this._fallback);}},_hasThreadRows:function(){for(var i=0;i<this._size;i++)if(this._rowObjects[i]!=undefined)return true;return false;},_buildFallbackContent:function(){var _L0;var _L1=this._controller.getViewState();if(_L1.isSearchRequest()){var _L2='<b>'+htmlize(_L1.searchRequest.getLabel())+'</b>';_L0=HTML(_tx("No messages matched your search for: {search_value}",{search_value:_L2}));}else if(_L1.getFilter()==GigaboxxManager.Filters.UNREAD){var _L3=this._controller.buildURI().addQueryData({filter:undefined});_L0=[_tx("You currently don't have any unread messages."),' ',$N('a',{href:_L3},_tx("View all messages."))];}else if(_L1.getFolder()==GigaboxxManager.Folders.MESSAGES){var _L4=Dialog.bootstrap.shield(null,'/gigaboxx/dialog/MessageComposer.php',{},true);_L0=[_tx("There are no messages in\nthis view."),' ',$N('a',{onclick:_L4},_tx("Compose a message."))];}else if(_L1.getFolder()==GigaboxxManager.Folders.UPDATES)_L0=[_tx("There are no messages in\nthis view.")];return _L0;}});
function PaginatedObjectList(_L0){if(_L0<=0){Util.error('Invalid Page Size');_L0=10;}copy_properties(this,{_dirty:{},_objectList:[],_pageHandler:bagofholding,_pageSize:_L0||10});}copy_properties(PaginatedObjectList.prototype,{getPageSize:function(){return this._pageSize;},hasFullPage:function(_L0){var _L1=(_L0-1)*this._pageSize;var end=Math.min((_L0)*this._pageSize,this._objectList.length);if(_L1>=this._objectList.length)return false;var _L3=end==this._objectList.length;var _L4=false;var _L5=false;for(var i=_L1;i<end;i++)if(typeof(this._objectList[i])=='undefined'){if(!_L3||(_L3&&!_L4)){return false;}else _L5=true;}else if(_L3)if(_L5){return false;}else _L4=true;return true;},hasPage:function(_L0){var _L1=(_L0-1)*this._pageSize;var end=(_L0)*this._pageSize;for(var i=_L1;i<this._objectList.length&&i<end;i++)if(typeof(this._objectList[i])!='undefined')return true;return false;},getPage:function(_L0){var _L1=(_L0-1)*this._pageSize;if(_L1>(this._objectList.length-1)||_L1<0)return null;var _L2=this._objectList.slice(_L1,_L1+this._pageSize);var _L3=_L2.length-1;while(_L3>=0&&typeof(_L2[_L3])=='undefined')_L3--;return _L3>=0?_L2.slice(0,_L3+1):null;},setPage:function(_L0,_L1){if(!hasArrayNature(_L1)){Util.warn('Invalid object for setPage');return this;}if(_L1.length==0)return this;var _L2=_L0*this._pageSize;if(this._objectList.length<_L2)this._objectList.length=_L2;var _L3=_L1.splice(0,this._pageSize);if(_L3.length<this._pageSize)_L3.length=this._pageSize;Array.prototype.splice.apply(this._objectList,[_L2-this._pageSize,this._pageSize].concat(_L3));if(_L1.length>0)this.setPage(_L0+1,_L1);return this;},unsetPage:function(_L0){var _L1=(_L0-1)*this._pageSize;var _L2=[];_L2.length=this._pageSize;this.setPage(_L0,_L2);},maxPage:function(){var _L0=this._objectList.length-1;while(this._objectList[_L0]===undefined&&_L0>0)_L0--;return Math.floor((_L0/this._pageSize)+1);},setPageHandler:function(_L0){this._pageHandler=_L0;return this;},deleteObject:function(_L0){var _L1=false;for(var i=0;i<this._objectList.length;i++)if(this._objectList[i]==_L0){this._objectList.splice(i,1);_L1=true;i--;}for(var _L3=1,_L4=Math.ceil(this._objectList.length/this._pageSize);_L3<=_L4;_L3++)this._dirtyPage(_L3);return this;},_dirtyPage:function(_L0){if(!this._dirty[_L0]){this._dirty[_L0]=true;bind(this,this._doCallback,_L0).defer();}},_doCallback:function(_L0){this._dirty[_L0]=false;this._pageHandler(this,_L0);}});
function ThreadMessageRow(_L0,_L1,_L2){copy_properties(this,{_controller:_L0,_data:_L1,threadId:_L2,root:null,authorLinkWrapper:null,branchLinkWrapper:null,reportLinkWrapper:null});var _L3={author_href:_L1.author.href||this._controller.buildURI().addQueryData({tid:_L2}),author_name:_L1.author.name,author_image_src:_L1.author.picture,message_date:_L1.time_rendered,message_body:_L1.message,message_referrer:_L1.referrer_rendered||'',message_attachment:_L1.attachment_rendered||''};this.parent.construct(this,URI('/gigaboxx/templates/ThreadMessageRow.tmpl'),_L3);if(_L1.unread)CSS.addClass(this.root,'GBThreadMessageRow_Unread');if(_L1.can_branch){var uri=URI('/gigaboxx/dialog/MessageComposer.php').setQueryData({'thread':this.threadId,'msg_id':this._data.msg_id,'id':this._data.author.id}).toString();var _L5=$N('a',{'href':uri,'rel':'dialog-post'},_tx("Reply"));DOM.setContent(this.branchLinkWrapper,_L5);}if(_L1.report_link){var _L6=(_L1.can_branch?' &bull; ':'')+_L1.report_link;DOM.setContent(this.reportLinkWrapper,HTML(_L6));}if(!this._data.author.href)DOM.setContent(this.authorLinkWrapper,this._data.author.name);}ThreadMessageRow.extend('TemplateObject');
function GigaboxxManager(_L0,_L1,_L2,_L3,_L4,_L5,_L6){window.gbm=this;this.Debug={NONE:0,ALL:1,STATES:2,PAINT:4,DATA_LOAD:8,DATA:16,DATA_SET:32};this.STATE_MAP={'*GLOBAL*':{Dirty:'CHECK_DATA'},'UNINITIALIZED':{},'CHECK_DATA':{_action:this._deferCheckDataCache.bind(this),CheckComplete:'LOAD_DATA'},'LOAD_DATA':{_action:this._checkDoDataLoad.bind(this),Loaded:'PRE_PAINT',Loading:'LOAD_PENDING'},'LOAD_PENDING':{_action:this._pendingDataLoad.bind(this),Pending:'LOAD_PENDING',Failed:'FAILED_LOAD',PendingComplete:'PRE_PAINT'},'FAILED_LOAD':{_action:this._doFailedLoadData.bind(this)},'PRE_PAINT':{_action:this._doPrePaintHooks.bind(this),PreHooksComplete:'PAINT'},'PAINT':{_action:this._doRepaint.bind(this),Painted:'POST_PAINT'},'POST_PAINT':{_action:this._doPostPaintHooks.bind(this),PostHooksComplete:'IDLE'},'IDLE':{}};if(_L6.debugLevel)this.debug=_L6.debugLevel;copy_properties(this,{_userId:_L0,_originalPageTitle:document.title,_config:_L6||{},_folderNav:_L1,toolbarManager:new GBToolbarManager(this,_L2,_L3,_L4),_toolbars:[_L2,_L3,_L4],_content_area:_L5,_undo_manager:new GBUndoManager(this),_state:'UNINITIALIZED',_isDirty:false,_blockLoadData:false,_asyncRequestQueue:[],_asyncPendingRequestQueue:[],_prePaintHooks:[],_postPaintHooks:[],_activeThread:null,_viewState:new GBViewState(GigaboxxManager.Folders.MESSAGES,'','',1).setOnViewChangeHandler(bind(this,this._viewChanged)).setOnPropertyChangeHandler('page',bind(this,this._pageChanged)),_view:GigaboxxManager.Views.THREAD_LIST,_pageSize:_L6.pageSize,_savedSearches:{},_viewStateData:{},threadCache:new GigaboxxThreadCache(),_threadRows:{},_resetPending:false,_threadList:null,_pagerCollection:null,_messagePagerCollection:null,_topPager:null,_bottomPager:null,_topMessagePager:null,_bottomMessagePager:null,_activeThreadData:null,_hasShownMuffin:false,_activeReplyForm:null,_activeThreadMessagesRoot:null,_errorCode:null,_errorMsg:null});PageTransitions.registerHandler(this._pageTransitionHandler.bind(this));this._initialize();GigaboxxManager.instances[_L0]=this;}copy_properties(GigaboxxManager,{getInstance:function(_L0){return GigaboxxManager.instances[_L0]||null;},instances:{},Folders:{MESSAGES:'[fb]messages',REQUESTS:'[fb]requests',UPDATES:'[fb]updates',SENT:'[fb]sent'},Views:{THREAD_LIST:'thread_list',COMPOSE_MESSAGE:'compose',READ_MESSAGE:'read_message',ERROR:'error'},Filters:{UNREAD:'[fb]unread'}});GigaboxxManager.mixin('Arbiter',{getFolderNav:function(){return this._folderNav;},getContentArea:function(){return this._content_area;},getToolbars:function(){return this._toolbars;},getConfig:function(){return this._config;},isGigaboxxURI:function(uri){var re;if(this._config.forceLaunch){re=/\/gigaboxx|inbox\//;}else re=/\/gigaboxx\//;if(typeof(uri)=='string')uri=new URI(uri);return re.test(uri.getPath());},_pageTransitionHandler:function(uri){if(!this.isGigaboxxURI(uri))return false;var _L1=this.interpretURI(uri);this.load(_L1||{},true);PageTransitions.transitionComplete();return true;},interpretURI:function(uri){var _L1=uri.getQueryData();var _L2={};if(_L1.folder)switch(_L1.folder){case GigaboxxManager.Folders.MESSAGES:case GigaboxxManager.Folders.REQUESTS:case GigaboxxManager.Folders.UPDATES:case GigaboxxManager.Folders.SENT:_L2['folder']=_L1.folder;break;default:return null;}if(typeof(_L1.subfolder)!='undefined'){_L2['subfolder']=_L1.subfolder;}else _L2['subfolder']='';if(typeof(_L1.filter)!='undefined'){_L2['filter']=_L1.filter;}else _L2['filter']='';if(typeof(_L1.page)!='undefined'){_L2['page']=_L1.page;}else _L2['page']=1;if(_L1.tid){_L2['thread']=_L1.tid;_L2['view']=GigaboxxManager.Views.READ_MESSAGE;}else _L2['view']=GigaboxxManager.Views.THREAD_LIST;if(_L1.search_id||_L1.search_terms)if(_L1.search_id){_L2['search_id']={id:_L1.search_id,name:_L1.search_name||''};}else _L2['search_terms']=_L1.search_terms;return _L2;},load:function(_L0,_L1){var _L2=['folder','subfolder','filter','search_terms','search_id','page','thread','view'];_L2.forEach(function(_L3){var _L4=_L0[_L3];if(_L4!==undefined){this.debugLog(this.Debug.DATA_SET,'Load: ',_L3,' ',_L4);switch(_L3){case 'folder':this.setFolder(_L4);break;case 'subfolder':this.setSubFolder(_L4);break;case 'filter':this.setFilter(_L4);break;case 'view':this.setView(_L4);break;case 'page':this.setPage(_L4);break;case 'thread':this.setActiveThread(_L4);break;case 'search_terms':this.setSearchRequest(new GBSearchRequestTerms(_L4));break;case 'search_id':this.setSearchRequest(new GBSearchRequestId(_L4.id,_L4.name));break;}}},this);if(_L1&&this._config.logCachedViews)this._doCachedAsyncSignal();this._dirty();return false;},setFolder:function(_L0){if(this._viewState.getFolder()!=_L0)if(this._isValidFolder(_L0)){$('gigaboxx_wrapper').removeClass(this._cssClassForFolder(this._viewState.getFolder()));$('gigaboxx_wrapper').addClass(this._cssClassForFolder(_L0));this.debugLog(this.Debug.DATA,'Switching folder:',_L0);this._viewState.setFolder(_L0);this.setSubFolder('');this.setFilter('');this._viewState.clearSearchRequest();this._dirty();}else Util.warn('Invalid folder %s',_L0);},_cssClassForFolder:function(_L0){if(!_L0.length)return _L0;_L0=_L0.replace('[fb]','');return 'GBFolder_'+_L0.charAt(0).toUpperCase()+_L0.substring(1);},_isValidFolder:function(_L0){return (_L0==GigaboxxManager.Folders.MESSAGES||_L0==GigaboxxManager.Folders.REQUESTS||_L0==GigaboxxManager.Folders.UPDATES||_L0==GigaboxxManager.Folders.SENT);},setSubFolder:function(_L0){this._viewState.setSubFolder(_L0);this._viewState.setFilter('');if(_L0)this._viewState.clearSearchRequest();this._dirty();return this;},setFilter:function(_L0){if(this._viewState.getFilter()!=_L0)if(this._isValidMessageFilter(_L0)){this._viewState.setFilter(_L0);this._viewState.clearSearchRequest();this._dirty();}else Util.warn('Invalid filter %s',_L0);return this;},setSearchRequest:function(_L0){this._viewState.setSearchRequest(_L0);this._viewState.setFolder('');this._viewState.setSubFolder('');this._viewState.setFilter('');if(!this._savedSearches[_L0.getId()]){var _L1=new UINestedNavItem(_L0.getId()).setIcon('/images/app_icons/search.gif').setTitle(_L0.getLabel()).setHref(this.buildURI(true).addQueryData(_L0.getQueryData())).setCloseHandler(this._deleteSavedSearch.bind(this));this.getFolderNav().addNavItem(_L1,true);this._savedSearches[_L0.getId()]=_L1;}this._dirty();},setError:function(_L0,_L1){if(_L0){this._errorCode=_L0;this._errorMsg=_L1;this.setView(GigaboxxManager.Views.ERROR);}else{this._errorCode=null;this._errorMsg=null;var _L2=this.interpretURI(URI.getRequestURI());this.load(_L2||{},true);}this._dirty();return this;},_deleteSavedSearch:function(_L0){if(this._viewState.isSearchRequest()&&this._viewState.searchRequest.getId()==_L0.id){this.buildURI(true).addQueryData({folder:GigaboxxManager.Folders.MESSAGES}).go();this._folderNav.selectTab('gb_nav_folder_messages');}delete this._savedSearches[_L0.id];return false;},getViewState:function(){return this._viewState;},_viewChanged:function(){this.setPage(1);for(var _L0 in this._savedSearches){this._folderNav.removeNavItem(this._savedSearches[_L0]);this._deleteSavedSearch(this._savedSearches[_L0]);}if(this._resetPending){this.debugLog(this.Debug.DATA,'Performing pending reset.');this.flushCaches();this._resetPending=false;}Arbiter.inform('gigaboxx/view_changed',this.getViewState());this.inform('gigaboxx/viewChanged',this.getViewState());},_pageChanged:function(){var _L0=this._viewState.getPage();if(this._pagerCollection)this._pagerCollection.setPage(_L0);},_isValidMessageFilter:function(_L0){var _L1=values(GigaboxxManager.Filters);return _L0==''||_L1.contains(_L0);},setPageData:function(_L0,_L1,_L2){var _L3=GBViewState.constructFromStruct(_L0);this._mergeThreadList(_L3,_L1,_L2);return this;},setActiveThreadData:function(_L0){this._activeThreadData=_L0;return this;},_getViewStateData:function(_L0){_L0=_L0||this._viewState;var _L1=_L0.getViewId();if(this._viewStateData[_L1]!==undefined){var _L2=new Date().getTime()-this._viewStateData[_L1].time;if(_L2>this._config.cacheExpire){this.debugLog(this.Debug.DATA,'Expiring View: ',_L1,_L2);delete this._viewStateData[_L1];}}if(typeof(this._viewStateData[_L1])=='undefined'){var _L3=new PaginatedObjectList(this._pageSize).setPageHandler(bind(this,this._onPageUpdate));var _L4=-1;this._viewStateData[_L1]={list:_L3,count:_L4,time:new Date().getTime()};}return this._viewStateData[_L1];},_onPageUpdate:function(_L0,_L1){if(this._getViewStateData().list==_L0)if(this.getPage()==_L1)if(_L0.hasFullPage(_L1)){this._dirty();}else for(var _L2 in this._viewStateData)if(this._viewStateData[_L2].list==_L0){this.debugLog(this.Debug.DATA,'Expire View ',_L2,' on dirty page ',_L1);delete this._viewStateData[_L2];this._dirty();}},_onCounterUpdate:function(_L0,_L1){this.debugLog(this.Debug.DATA,'Counter update',_L0,_L1);this.flushCaches();if(this.isGigaboxxURI(URI.getRequestURI())&&this._view==GigaboxxManager.Views.THREAD_LIST&&this.getPage()==1)this._dirty();},setView:function(_L0){if(this._view!=_L0)if(this._isValidView(_L0)){this._view=_L0;if(_L0!=GigaboxxManager.Views.ERROR){this._errorCode=null;this._errorMessage=null;}if(_L0!=GigaboxxManager.Views.READ_MESSAGE&&this._activeThread)this.setActiveThread(null);this._dirty();}else Util.warn('Invalid view %s',_L0);return this;},getView:function(){return this._view;},_isValidView:function(_L0){if(_L0==GigaboxxManager.Views.READ_MESSAGE)if(this._activeThread==null)return false;return values(GigaboxxManager.Views).contains(_L0);},getPage:function(){return this._viewState.getPage();},_computeOffset:function(_L0,_L1){_L0=_L0||this.getPage();_L1=_L1||this._pageSize;return Math.max(_L0-1,0)*_L1;},setPage:function(_L0){if(this._viewState.getPage()!=_L0){this._viewState.setPage(Math.max(_L0,1));this._dirty();if(this._getViewStateData().count<0)this._pagerCollection.setTotal(this._computeOffset()+this._pageSize+1);}return this;},setPageSize:function(_L0){if(_L0!=this._pageSize){this._threadList.setSize(_L0);this._pageSize=_L0;this._topPager.setMaxPerPage(_L0);this._bottomPager.setMaxPerPage(_L0);this.flushCaches();this.buildURI(true).go();}},_gotoPageByOffset:function(_L0){var _L1=_L0/this._pageSize+1;this.buildURI().addQueryData({page:_L1}).go();},_gotoAdjacentMessage:function(_L0,dir){this._ensurePageCached(this._onLoadThreadListGotoAdjacentMessage.bind(this,_L0,dir,this._viewState));this._dirty();},_onLoadThreadListGotoAdjacentMessage:function(_L0,dir,_L2,_L3){if(_L3)this._onLoadThreadList(_L2,_L3);var _L4=this._getCurrentThreads();var _L5=this._determineActiveThreadIndex(_L4,this._activeThread);if(_L5==-1){this.buildURI().addQueryData({page:this.getPage()}).go();return;}var _L6=_L5+dir;if(_L6>=0&&_L6<_L4.length){this.buildURI().addQueryData({tid:_L4[_L6]}).go();}else{if(_L6<0){var _L7=this.getPage();if(_L7<=1){this.buildURI().addQueryData({page:1}).go();return;}else this.setPage(this.getPage()-1);}else this.setPage(this.getPage()+1);this._ensurePageCached(this._onLoadThreadListGotoThread.bind(this,this._viewState,_L6>0));this._dirty();}},_onLoadThreadListGotoThread:function(_L0,_L1,_L2){if(_L2)this._onLoadThreadList(_L0,_L2);var _L3=this._getCurrentThreads();if(!_L3){this.buildURI().addQueryData({page:this.getPage()-1}).go();}else if(_L1){this.buildURI().addQueryData({tid:_L3[0]}).go();}else this.buildURI().addQueryData({tid:_L3[_L3.length-1]}).go();},getActiveThread:function(){return this._activeThread;},setActiveThread:function(_L0){if(this._activeThread!=_L0&&_L0){this.debugLog(this.Debug.DATA_LOAD,'New thread: ',this._activeThread,' != ',_L0);this._prePaintHooks.push(function(_L0){var _L1=this._activeThreadData;if(_L1&&_L1.threadId==_L0&&_L1.tags.contains(GigaboxxManager.Filters.UNREAD)){this._updateTags([_L0],GigaboxxManager.Filters.UNREAD,true);this._postPaintHooks.push(function(_L0){var _L1=this._activeThreadData;if(_L1&&_L1.threadId==_L0)this.setMessageTag(_L1.threadId,GigaboxxManager.Filters.UNREAD,true,{'from_read':1});}.bind(this,_L0));}}.bind(this,_L0));}this._activeThread=_L0;this._messagePagerCollection.setTotal(this._pageSize);this._messagePagerCollection.setPage(this._pageSize/2);this._dirty();if(this._activeThread==null&&this._view==GigaboxxManager.Views.READ_MESSAGE)this.setView(GigaboxxManager.Views.THREAD_LIST);return this;},_determineActiveThreadIndex:function(_L0,_L1){if(!_L1)return -1;var _L0=this._getCurrentThreads();for(var i=0;i<_L0.length;i++)if(_L0[i]==_L1)return i;return -1;},buildURI:function(_L0){var uri;if(this._config.forceLaunch){uri=URI('/inbox/');}else uri=URI('/gigaboxx/');if(!_L0)uri.addQueryData(this._viewState.getViewData());return uri;},_doTransition:function(_L0){this.debugLog(this.Debug.STATES,'Transition: ',_L0,' in State:',this._state);var _L1=this.STATE_MAP['*GLOBAL*'];var _L2=this.STATE_MAP[this._state];if(!_L2){Util.error('Unknown state: %s',this._state);return;}var _L3=_L2[_L0];if(_L3==undefined)_L3=_L1[_L0];if(_L3==undefined){Util.warn('Unhandled transition: %s in state %s',_L0,this._state);return;}this._executeState(_L3);},_executeState:function(_L0){this._state=_L0;var _L1=this.STATE_MAP[_L0];if(_L1){var _L2=_L1._action;if(typeof(_L2)=='function')_L2();}else Util.error('State without action: %s',this._state);},_initialize:function(){this._initializeThreadListPlaceholders();this._initializePagers();this._initializeCounterDisplays();this._initializeSubscriptions();this._postPaintHooks.push(this._setVisible.bind(this));},_initializeThreadListPlaceholders:function(){var _L0=this.getContentArea();if(this._threadList==null)this._threadList=new ThreadList(this,this._pageSize);_L0.setContent(this._threadList.getNode());},_initializePagers:function(){var _L0=this._computeOffset();var _L1=_L0+this._pageSize+1;var _L2=this._getViewStateData().count;if(_L2>=0)_L1=_L2;this._topPager=new UIPager(_L1,this._pageSize,_L0,this._gotoPageByOffset.bind(this)).setSummaryTextHandler(identity.curry(''));this._bottomPager=new UIPager(_L1,this._pageSize,_L0,this._gotoPageByOffset.bind(this)).setSummaryTextHandler(identity.curry(''));this._topMessagePager=new UIPager(this._pageSize,1,this._pageSize/2,this._gotoAdjacentMessage.bind(this)).setSummaryTextHandler(identity.curry(''));this._bottomMessagePager=new UIPager(this._pageSize,1,this._pageSize/2,this._gotoAdjacentMessage.bind(this)).setSummaryTextHandler(identity.curry(''));this._pagerCollection=new Collection(UIPager,[this._topPager,this._bottomPager]);this._messagePagerCollection=new Collection(UIPager,[this._topMessagePager,this._bottomMessagePager]);},_initializeCounterDisplays:function(){var _L0=DOM.scry(this._folderNav.getContentArea(),'li.UINestedFilterList_Item');_L0.forEach(function(_L1){if(_L1.id){var _L2=_L1.id.match(/gb_nav_folder_(.*)/);var _L3=DOM.scry(_L1,'div.BubbleCount_Number');var _L4=DOM.scry(_L1,'div.BubbleCount');if(_L2&&_L3.length>0)new CounterDisplay(_L2[1]+'_unread',_L3[0],_L4[0]);}});},_initializeSubscriptions:function(){var _L0=[];for(var _L1 in GigaboxxManager.Folders){var _L2=GigaboxxManager.Folders[_L1].substring(4);_L0.push(CounterDisplay.EVENT_TYPE_UPDATE+'/'+_L2+'_unread');}Arbiter.subscribe(_L0,this._onCounterUpdate.bind(this),Arbiter.SUBSCRIBE_NEW);},_deferCheckDataCache:function(){if(!this._isDirty){this._isDirty=true;bind(this,this._doCheckDataCache).defer();}},_ensurePageCached:function(_L0){if(this._threadListPageCached(this._viewState,this.getPage())){this.debugLog(this.Debug.DATA_LOAD,'View Cached. '+this._viewState);_L0(null);}else{var _L1={start:this._computeOffset(this._viewState.getPage(),this._pageSize),limit:this._pageSize};var _L2=this._viewState.getViewData();delete _L2.page;copy_properties(_L1,_L2);var _L3=new AsyncRequest('/ajax/gigaboxx/endpoint/ListThreads.php').setMethod('GET').setReadOnly(true).setData(_L1);var _L4={async:_L3,handler:_L0};this.debugLog(this.Debug.DATA_LOAD,'Need thread list. '+this._viewState);this._asyncRequestQueue.push(_L4);}},_doCachedAsyncSignal:function(){var _L0=false;var _L1={};if(this._view==GigaboxxManager.Views.READ_MESSAGE){if(this._messageCached(this._activeThread)){_L1={action:'read',tid:this._activeThread};_L0=true;}}else if(this._view==GigaboxxManager.Views.THREAD_LIST)if(this._threadListPageCached(this._viewState,this.getPage())){_L1={start:this._computeOffset(this._viewState.getPage(),this._pageSize),limit:this._pageSize};var _L2=this._viewState.getViewData();delete _L2.page;copy_properties(_L1,_L2);_L0=true;}if(_L0){_L1['cached']=true;new AsyncSignal('/ajax/gigaboxx/endpoint/ListThreads.php',_L1).send();}},_doCheckDataCache:function(){IL().b('check_data');this._isDirty=false;this.debugLog(this.Debug.STATES,'View State: View/',this._view,' Folder/',this._viewState.getFolder(),' Filter/',this._viewState.getFilter(),' Page/',this.getPage());if(this._view==GigaboxxManager.Views.ERROR){this.debugLog(this.Debug.DATA_LOAD,'Errored, no data loads');}else if(this._view==GigaboxxManager.Views.READ_MESSAGE){if(!this._messageCached(this._activeThread)){var _L0=new AsyncRequest('/ajax/gigaboxx/endpoint/ReadThread.php').setMethod('GET').setReadOnly(true).setData({tid:this._activeThread,readonly:true});var _L1={async:_L0,handler:this._onMessageLoad.bind(this)};this.debugLog(this.Debug.DATA_LOAD,'Need Thread History',this._activeThread);this._asyncRequestQueue.push(_L1);}else if(this._hasShownMuffin){ads_refresh(null,'/inbox/',this._onMuffinLoad.bind(this),null,null,null,true);}else this._hasShownMuffin=true;}else this._ensurePageCached(this._onLoadThreadList.bind(this,this._viewState));this._doTransition('CheckComplete');IL().e('check_data');},_checkDoDataLoad:function(){if(this._asyncRequestQueue.length){this._doLoadData.bind(this).deferUntil(function(){return !this._blockLoadData;}.bind(this),10000);CSS.addClass(this.getContentArea(),'async_saving');}else this._doTransition('Loaded');},_doLoadData:function(){var _L0=this.getContentArea();this._asyncRequestQueue.forEach(function(_L1){var _L2=bind(this,this._loadDataHandler,_L1);var _L3=bind(this,this._loadDataErrorHandler,_L1);var _L4=bind(this,this._loadDataFinallyHandler,_L1);_L1.async.setHandler(_L2).setErrorHandler(_L3).setFinallyHandler(_L4).setStatusElement(_L0).send();this._asyncPendingRequestQueue.push(_L1);},this);this._asyncRequestQueue=[];this._doTransition('Loading');},_pendingDataLoad:function(){if(this._asyncPendingRequestQueue.length){this.debugLog(this.Debug.DATA_LOAD,'Pending Request Count: ',this._asyncPendingRequestQueue.length);}else this._doTransition('PendingComplete');},_doFailedLoadData:function(){this.setView(GigaboxxManager.Views.ERROR);this._dirty();},_loadDataHandler:function(_L0,_L1){if(typeof(_L0.handler)=='function')_L0.handler(_L1);_L0.success=true;},_loadDataErrorHandler:function(_L0,_L1){if(typeof(_L0.errorHandler)=='function')_L0.errorHandler(_L1);this._errorCode=_L1.getError();this._errorMsg=_L1.getErrorDescription();},_loadDataFinallyHandler:function(_L0,_L1){this._asyncPendingRequestQueue.remove(_L0);if(_L0.success){this._doTransition('Pending');}else this._doTransition('Failed');},_setVisible:function(){$('gigaboxx_wrapper').style.visibility='visible';},_doPrePaintHooks:function(){if(this._prePaintHooks.length){this._prePaintHooks.forEach(function(_L0){_L0();});this._prePaintHooks=[];}this._doTransition('PreHooksComplete');},_doPostPaintHooks:function(){if(this._postPaintHooks.length){this._postPaintHooks.forEach(function(_L0){_L0();});this._postPaintHooks=[];}this._doTransition('PostHooksComplete');},_doRepaint:function(){bind(this,this._paint).defer();},_dirty:function(){this._doTransition('Dirty');},_paint:function(){IL().b('gb paint');this._isDirty=false;var _L0=this.getContentArea();if(!this._threadListView)this._threadListView=new GBThreadListView(this);if(!this._messageHistoryView)this._messageHistoryView=new GBMessageHistoryView(this);if(!this._errorView)this._errorView=new GBErrorView(this);var _L1=null;switch(this._view){case GigaboxxManager.Views.COMPOSE_MESSAGE:case GigaboxxManager.Views.THREAD_LIST:this._threadListView.paint();_L1=this._threadListView.getTitle();this._errorView.hide();this._messageHistoryView.hide();this._threadListView.show();break;case GigaboxxManager.Views.READ_MESSAGE:this._messageHistoryView.paint();_L1=this._messageHistoryView.getTitle();this._errorView.hide();this._threadListView.hide();this._messageHistoryView.show();DOMScroll.scrollTo(new Vector2(0,0,'document'));break;case GigaboxxManager.Views.ERROR:this._errorView.paint();_L1=this._errorView.getTitle();this._errorView.show();this._messageHistoryView.hide();this._threadListView.hide();break;default:Util.warn('Unable to paint view %s',this._view);}this.toolbarManager.paint();document.title=_L1?'Facebook | '+_tx("Inbox")+' - '+_L1:this._originalPageTitle;if(this._undo_manager.hasPendingDeferredNotification()){this._undo_manager.displayDeferredNotification();}else this._undo_manager.clearNotification();this._doTransition('Painted');IL().e('gb paint');},_updateToolbarOnSelect:function(){var _L0=this._getSelectedThreads();var _L1=this.getViewState().getFolder();var _L2=(_L1==GigaboxxManager.Folders.SENT);var _L3=(_L1==GigaboxxManager.Folders.UPDATES);var _L4=_L0.length>0;var _L5=false;var _L6=false;var _L7=_L0.length&&(!_L3||_L0.length==1);var _L8=!_L0.length;var _L9=false;for(var i=0;i<_L0.length;i++){var tid=_L0[i];var _Lc=this.threadCache.getThreadData(tid);if(!_Lc){_L6=true;_L5=true;}else{if(_Lc.tags.contains(GigaboxxManager.Filters.UNREAD)){_L6=true;}else _L5=true;if(_Lc.subscription&&_Lc.subscription.subscribed)_L9=true;}}this.toolbarManager.getComponent('SelectAllButton').setDisabled(false).setHidden(!(this._config.alternateToolbarUI&&_L8));this.toolbarManager.getComponent('SelectNoneButton').setDisabled(false).setHidden(!this._config.alternateToolbarUI||_L8);this.toolbarManager.getComponent('UnreadButton').setDisabled(!_L5||_L2).setHidden(_L6);this.toolbarManager.getComponent('ReadButton').setDisabled(false).setHidden(!_L6);this.toolbarManager.getComponent('DeleteButton').setDisabled(!_L4).setHidden(false);this.toolbarManager.getComponent('ReportSpamButton').setDisabled(!_L7||_L2).setHidden(false);this.toolbarManager.getComponent('UnsubscribeUpdateButton').setDisabled(!_L9).setHidden(!_L3);},_doSelect:function(_L0){var _L1=this._getViewStateData().list.getPage(this.getPage());if(_L1)for(var i=0;i<_L1.length;i++){var tid=_L1[i];var _L4=this._threadRows[tid];var _L5=this.threadCache.getThreadData(tid);if(!_L5||_L5.inaccessible)continue;if(typeof(_L0)=='function'&&_L0(_L4)){_L4.selector.checked=true;}else _L4.selector.checked=false;}this._updateToolbarOnSelect();return false;},_getSelectedThreads:function(){var _L0=[];if(this._view==GigaboxxManager.Views.READ_MESSAGE){_L0.push(this._activeThread);}else{var _L1=this._threadList.getThreadRows();for(var i=0;i<_L1.length;i++)if(_L1[i]&&_L1[i].selector.checked)_L0.push(_L1[i].threadId);}return _L0;},_getCurrentThreads:function(){return this._getViewStateData().list.getPage(this.getPage());},addReplyContent:function(_L0){var _L1=false;var _L2=_L0.thread_id;var _L3=_L0.message;if(_L2==this._activeThread&&this._activeThreadMessagesRoot){var row=new ThreadMessageRow(this,_L3,_L2);DOM.appendContent(this._activeThreadMessagesRoot,row.getNodes());animation(row.root).from('height',0).to('auto').from('opacity',0).to(1).duration(250).ease(animation.ease.both).go();_L1=true;}if(this._messageCached(_L2))this._activeThreadData.messages.push(_L3);if(this.threadCache.isCached(_L2))this.threadCache.mergeMessageData(_L2,_L0.message_raw);return _L1;},_getThreadRow:function(_L0){if(!this._threadRows[_L0]){var row=new ThreadRow(this,_L0);this._threadRows[_L0]=row;}return this._threadRows[_L0];},_getMessagePane:function(){var _L0=this.getContentArea();var _L1=_L0.id+'_message_pane';var _L2=ge(_L1);if(_L2==null){_L2=this._createMessagePane(_L1);_L0.appendContent(_L2);}return _L2;},_createMessagePane:function(_L0){var _L1=$N('div',{id:_L0,className:'message_pane',style:{display:'none'}});return _L1;},_threadListPageCached:function(_L0,_L1){var _L2=this._getViewStateData(_L0);return _L2.list.hasFullPage(_L1);},_messageCached:function(_L0){return this._activeThreadData&&this._activeThreadData.threadId==_L0;},flushCaches:function(){this.debugLog(this.Debug.DATA,'Flushing Caches');this.threadCache.flushCache();this._threadRows={};this._viewStateData={};this._activeThreadData=null;},setMessageTag:function(_L0,tag,_L2,_L3){_L0=arrayize(_L0);_L2=!!_L2;var _L4=bind(this,this._setMessageTagHandler,_L0,tag,_L2);this._updateTags(_L0,tag,_L2);var _L5={tid:_L0,tag:tag,to_remove:_L2};copy_properties(_L5,_L3||{});new AsyncRequest('/ajax/gigaboxx/endpoint/TagThread.php').setMethod('POST').setData(_L5).setErrorHandler(_L4).setHandler(_L4).send();if(tag==GigaboxxManager.Filters.UNREAD&&_L2==false&&_L0.contains(this._activeThread))this.buildURI().go();return false;},_setMessageTagHandler:function(_L0,tag,_L2,_L3){if(!_L3.error&&_L3.getPayload().success){this._resetPending=true;}else this._updateTags(_L0,tag,!_L2);},_updateTags:function(_L0,tag,_L2){var _L3={};for(var i=0;i<_L0.length;i++){var _L5=_L0[i];this._setCountUpdate(_L5,tag,_L2,_L3);if(_L2){this.debugLog(this.Debug.DATA,'Remove Tag',tag,'from',_L5);if(this.threadCache.isCached(_L5)){this.threadCache.getThreadData(_L5).tags.remove(tag);this.threadCache.dirty(_L5);}if(this._messageCached(_L5))this._activeThreadData.tags.remove(tag);}else{this.debugLog(this.Debug.DATA,'Add Tag',tag,'from',_L5);if(this.threadCache.isCached(_L5)){array_set_add(this.threadCache.getThreadData(_L5).tags,tag);this.threadCache.dirty(_L5);}if(this._messageCached(_L5))array_set_add(this._activeThreadData.tags,tag);}}for(var _L6 in _L3)CounterDisplay.adjustCount(_L6,_L3[_L6]);this._dirty();},_setCountUpdate:function(_L0,tag,_L2,_L3,_L4){if(tag!=GigaboxxManager.Filters.UNREAD)return;var _L5=0;var _L6=[];var _L7=null;var _L8=!_L2;var _L9=null;if(this.threadCache.isCached(_L0)){_L9=this.threadCache.getThreadData(_L0);_L7=values(GigaboxxManager.Folders).filter(function(_La){return _L9.tags.contains(_La);});_L8=_L9.tags.contains(GigaboxxManager.Filters.UNREAD);}else if(this._messageCached(_L0)){_L9=this._activeThreadData;_L7=values(GigaboxxManager.Folders).filter(function(_La){return this._activeThreadData.tags.contains(_La);},this);_L8=this._activeThreadData.tags.contains(GigaboxxManager.Filters.UNREAD);}else Util.warn('Can\'t find thread '+_L0);if(_L8&&_L2){_L5=_L4?1:-1;}else if(!_L8&&!_L2)_L5=_L4?-1:1;if(_L7)_L7.map(function(_La){_L6.push(_La.substring(4)+'_unread');});_L6.forEach(function(_La){if(_L3[_La]===undefined)_L3[_La]=0;_L3[_La]+=_L5;});this._updateSeenThread(_L9,_L5);},deleteMessages:function(_L0){_L0=arrayize(_L0);var _L1={};for(var _L2=0;_L2<_L0.length;_L2++){var tid=_L0[_L2];var _L4=this.threadCache.getThreadData(tid);if(!_L4){this.debugLog(this.Debug.DATA,'Delete missing thread data:',tid);continue;}_L1[tid]=_L4.timeLastUpdated;}var _L5=this._deleteMessagesHandler.bind(this);new AsyncRequest('/ajax/gigaboxx/endpoint/DeleteThread.php').setMethod('POST').setData({tids:_L1}).setStatusElement(this.getContentArea()).setErrorHandler(_L5).setHandler(_L5).setFinallyHandler(this._deleteMessagesFinallyHandler.bind(this)).send();this._deleteThreads(keys(_L1));return false;},_deleteThreads:function(_L0,_L1){if(_L1||_L1===undefined){this._blockLoadData=true;for(var _L2 in this._viewStateData){var _L3=this._viewStateData[_L2];for(var i=0;i<_L0.length;i++){this.debugLog(this.Debug.DATA,'Delete thread ',_L0[i],' in view ',_L2);_L3.list.deleteObject(_L0[i]);}}}},_deleteMessagesHandler:function(_L0){var _L1=false;if(!_L0.error){_L1=true;var _L2=_L0.getPayload();if(_L2.results)for(var tid in _L2.results)_L1&=_L2.results[tid];this._undo_manager.deferUndoNotification(_L2.undo);}else ErrorDialog.showAsyncError(_L0);if(_L1){var _L4={};for(var tid in _L2.results){delete this._threadRows[tid];this._setCountUpdate(tid,GigaboxxManager.Filters.UNREAD,true,_L4);}for(var _L5 in _L4)CounterDisplay.adjustCount(_L5,_L4[_L5]);this.buildURI().go();}else{this.flushCaches();this._dirty();}},_deleteMessagesFinallyHandler:function(_L0){if(this._blockLoadData){this._blockLoadData=false;this._dirty();}},updateViewOnUndoDelete:function(_L0){var _L1={};for(var tid in _L0.getPayload())this._setCountUpdate(tid,GigaboxxManager.Filters.UNREAD,true,_L1,true);for(var _L3 in _L1)CounterDisplay.adjustCount(_L3,_L1[_L3]);if(this.isGigaboxxURI(URI.getRequestURI())&&this._view==GigaboxxManager.Views.THREAD_LIST){this.flushCaches();this._dirty();return true;}return false;},reportSpam:function(_L0){_L0=arrayize(_L0);var _L1=this._deleteMessagesHandler.bind(this);new AsyncRequest('/ajax/gigaboxx/endpoint/ReportThread.php').setMethod('POST').setData({tids:_L0}).setStatusElement(this.getContentArea()).setTransportErrorHandler(_L1).setErrorHandler(_L1).setFinallyHandler(this._deleteMessagesFinallyHandler.bind(this)).setHandler(_L1).send();this._deleteThreads(_L0);return false;},unsubscribeUpdates:function(_L0){_L0=arrayize(_L0);var _L1={};for(var i=0;i<_L0.length;i++){var tid=_L0[i];var _L4=this.threadCache.getThreadData(tid);if(!_L4){_L1[tid]=0;}else if(_L4.subscription&&_L4.subscription.subscribed)_L1[tid]=_L4.originalAuthor;}new AsyncRequest('/ajax/gigaboxx/endpoint/UnsubscribeUpdate.php').setMethod('POST').setData({tid_sender_map:_L1}).setStatusElement(this.getContentArea()).setHandler(this._unsubscribeUpdatesHandler.bind(this)).send();return false;},_unsubscribeUpdatesHandler:function(_L0){var _L1=_L0.getPayload();this.updateViewOnSubscriptionChange(_L1.results,false);this._undo_manager.setUndoNotification(_L1.undo);},updateViewOnSubscriptionChange:function(_L0,_L1){var _L2=this.threadCache.getCache();for(var tid in _L2){var _L4=_L2[tid];if(_L0[_L4.originalAuthor])_L4.subscription.subscribed=_L1;}if(this._activeThreadData&&_L0[this._activeThreadData.originalAuthor])this._activeThreadData.subscription.subscribed=_L1;this._updateToolbarOnSelect();return false;},_doSelectedAction:function(_L0){var _L1=GigaboxxManager.Filters;var _L2=this._getSelectedThreads();switch(_L0){case 'unread':return this.setMessageTag(_L2,_L1.UNREAD,false);case 'read':return this.setMessageTag(_L2,_L1.UNREAD,true);case 'delete':return this.deleteMessages(_L2);case 'report':return this.reportSpam(_L2);case 'select_all':return this._doSelect(function(row){return true;});case 'select_none':return this._doSelect(function(row){return false;});case 'unsubscribe':return this.unsubscribeUpdates(_L2);}return true;},_onMessageLoad:function(_L0){var _L1=_L0.getPayload();this._activeThreadData=_L1.thread;this._onMuffinLoad(_L0);},_updateLastSeenTime:function(){var _L0=this._viewState.getFolder();if(this._config.fbxGroup&&_L0==GigaboxxManager.Folders.MESSAGES){new AsyncSignal('/ajax/gigaboxx/endpoint/UpdateLastSeenTime.php',{folder:_L0}).send();Arbiter.inform(CounterDisplay.EVENT_TYPE_UPDATE+'/'+_L0.substring(4)+'_unseen',0);this._config.lastSeenTime=0;}},_updateSeenThread:function(_L0,_L1){var _L2=this._viewState.getFolder();if(_L0&&this._config.lastSeenTime&&_L2==GigaboxxManager.Folders.MESSAGES&&_L0.timeLastUpdated>this._config.lastSeenTime)Arbiter.inform(CounterDisplay.EVENT_TYPE_ADJUST+'/'+_L2.substring(4)+'_unseen',_L1);},_onMuffinLoad:function(_L0){var _L1=_L0.getPayload();if(_L1.sidebar_ads)this._setMuffinHtml(_L1.sidebar_ads);},_onLoadThreadList:function(_L0,_L1){this._updateLastSeenTime.bind(this).defer();if(!_L1)return;var _L2=_L1.getPayload().thread_list;if(_L2){this.threadCache.mergeThreadData(_L2);var _L3=[];for(var _L4 in _L2)_L3.push(_L4);this._mergeThreadList(copy_properties({},_L0),_L0.getPage(),_L3);}},_mergeThreadList:function(_L0,_L1,_L2){var _L3=this._getViewStateData(_L0).list;var _L4=0;var _L5=true;for(var _L4=0;_L4<_L2.length;_L4+=this._pageSize){var t=_L2.slice(_L4,_L4+this._pageSize);t.push(undefined);if(_L3.hasPage(_L1))_L5=false;if(!_L5){_L3.unsetPage(_L1);this.debugLog(this.Debug.DATA,'Expiring Page: ',_L1,' on merge');}_L3.setPage(_L1,t);_L1++;}if(!_L5)for(;_L1<_L3.maxPage();_L1++){_L3.unsetPage(_L1);this.debugLog(this.Debug.DATA,'Expiring Page: ',_L1,' on merge');}},addData:function(_L0){this.threadCache.mergeThreadData(_L0);},_setMuffinHtml:function(_L0){$('gb_muffin_area').innerHTML=_L0;},showMuffin:function(){$('gb_muffin_area').style.display='block';$('gigaboxx_wrapper').addClass('gb_has_muffin');},hideMuffin:function(){hide('gb_muffin_area');$('gigaboxx_wrapper').removeClass('gb_has_muffin');},debugLog:function(){var _L0=arguments[0];var _L1=to_array(arguments);var _L2=this.Debug.NONE;if(typeof(_L0)=='number'){_L2=_L0;_L1.shift();}if(((this.debug&_L2)||(this.debug&this.Debug.ALL))&&console&&console.log)console.log.apply(console,_L1);}});
function UINestedFilterList(_L0){copy_properties(this,{useAnimation:false,_contentArea:_L0,_list:DOM.find(_L0,'ul.UINestedFilterList_List'),_selectedItemId:null,_selectedSubItemIndex:null,_itemRecords:null});this.initialize();}copy_properties(UINestedFilterList.prototype,{getContentArea:function(){return this._contentArea;},initialize:function(){this._itemRecords=[];this._selectedItemId=null;var _L0=DOM.scry(this._contentArea,'li.UINestedFilterList_Item');var _L1=DOM.scry(this._contentArea,'li.UINestedFilterList_Item_SubList');var _L2={};_L1.forEach(function(_La){var _Lb=_La.id.match(/sublists_(.*)/);if(_Lb)_L2[_Lb[1]]=_La;});for(var i=0;i<_L0.length;i++){var _L4=_L0[i];var _L5=_L4.id||i;if(CSS.hasClass(_L4,'UINestedFilterList_Selected')||CSS.hasClass(_L4,'UINestedFilterList_SubSelected'))this._selectedItemId=_L5;var _L6=_L2[_L5];var _L7=null;if(_L6){_L7=DOM.scry(_L6,'li.UINestedFilterList_SubItem');for(var j=0;j<_L7.length;j++)if(CSS.hasClass(_L7[j],'UINestedFilterList_SubItem_Selected'))this._selectedSubItemIndex=j;}var _L9={id:_L5,item:new UINestedNavItem(_L5),itemElem:_L4,subListElem:_L6,subItemElems:_L7};this._itemRecords.push(_L9);}},addNavItem:function(_L0,_L1){_L1=!!_L1;var _L2=[];var _L3=[$N('span',{className:'UINestedFilterList_Title'},_L0.title),$N('span',{className:'UINestedFilterList_ItemRight'})];if(_L0.icon){var _L4=_L0.isSprited?'UINestedFilterList_Icon':'UINestedFilterList_Icon UINestedFilterList_IconNonSprite';_L3.unshift($N('span',{className:_L4,style:{backgroundImage:"url("+_L0.icon+")"}}));}var _L5=$N('a',{href:_L0.href||'#',className:'UINestedFilterList_Item_Link',onclick:this.selectTab.bind(this,_L0.id)},_L3);if(_L0.closeHandler){var _L6=$N('span',{className:'UINestedFilterList_Item_CloseLink_Icon'});var _L7=$N('span',{className:'UINestedFilterList_Item_CloseLinkWrapper'},$N('a',{href:'#',className:'UINestedFilterList_Item_CloseLink',onclick:this._onCloseTab.bind(this,_L0,_L0.closeHandler)},_L6));_L2.push('UINestedFilterList_Item_hasCloseLink');_L5=$N('div',{className:'UINestedFilterList_Item_Contents'},[_L5,_L7]);}var _L8='UINestedFilterList_Item '+_L2.join(' ');var _L9=$N('li',{className:_L8},_L5);var _La='UINestedFilterList_Item_SubList';var _Lb=$N('li',{className:_La});var _Lc={id:_L0.id,item:_L0,itemElem:_L9,subListElem:_Lb,subItemElems:[]};this._list.appendContent([_L9,_Lb]);this._itemRecords.push(_Lc);if(_L1)this.selectTab(_L0.id);return this;},removeNavItem:function(_L0){var _L1=null;for(var i=0;i<this._itemRecords.length;i++)if(_L0.id==this._itemRecords[i].id){_L1=this._itemRecords[i];this._itemRecords.splice(i,1);break;}if(!_L1)return;DOM.remove(_L1.itemElem);if(_L1.subListElem)DOM.remove(_L1.subListElem);if(_L1.id==this._selectedItemId)this.selectTab(null);return this;},selectTab:function(_L0,_L1){var _L2;var _L3;var _L4;var _L5;for(var i=0;i<this._itemRecords.length;i++){var _L7=this._itemRecords[i];if(_L7.id==this._selectedItemId){_L2=_L7;if(this._selectedSubItemIndex!==undefined&&this._selectedSubItemIndex!==null&&_L7.subItemElems!==undefined)_L3=_L7.subItemElems[this._selectedSubItemIndex];}if(_L7.id==_L0){_L4=_L7;if(_L1!==undefined&&_L7.subItemElems!==undefined)_L5=_L7.subItemElems[_L1];}}if(_L2!=_L4){if(_L2&&_L2.subListElem)this._closeSubList(_L2.subListElem);if(_L4&&_L4.subListElem)this._openSubList(_L4.subListElem);}if(_L3){CSS.removeClass(_L3,'UINestedFilterList_SubItem_Selected');CSS.removeClass(_L3,'selected');}if(_L5){CSS.addClass(_L5,'UINestedFilterList_SubItem_Selected');CSS.addClass(_L5,'selected');}if(_L2){var _L8='UINestedFilterList_Selected';if(_L3){_L8='UINestedFilterList_SubSelected';}else CSS.removeClass(_L2.itemElem,'selected');CSS.removeClass(_L2.itemElem,_L8);CSS.removeClass(_L2.itemElem,'selected');}if(_L4){var _L8='UINestedFilterList_Selected';if(_L5){_L8='UINestedFilterList_SubSelected';}else CSS.addClass(_L4,'selected');CSS.addClass(_L4.itemElem,_L8);CSS.addClass(_L4.itemElem,'selected');}this._selectedItemId=_L0;this._selectedSubItemIndex=_L1;},_onCloseTab:function(_L0,_L1){if(!_L1(_L0))this.removeNavItem(_L0);return false;},_openSubList:function(_L0){if(this.useAnimation){this._animateOpen(_L0);}else CSS.addClass(_L0,'UINestedFilterList_Item_SubList_Open');},_closeSubList:function(_L0){if(this.useAnimation){this._animateClose(_L0);}else CSS.removeClass(_L0,'UINestedFilterList_Item_SubList_Open');},_animateOpen:function(_L0){animation(_L0).to('height','auto').from('0px').to('opacity',1).from(0).blind().show().duration(this.animationDuration||200).checkpoint(1,function(){CSS.addClass(_L0,'UINestedFilterList_Item_SubList_Open');}).go();},_animateClose:function(_L0){animation(_L0).to('height','0px').to('opacity',0).hide().duration(this.animationDuration||200).checkpoint(1,function(){CSS.removeClass(_L0,'UINestedFilterList_Item_SubList_Open');}).go();},_changeCollapse:function(_L0,_L1){for(var i=0;i<this._itemRecords.length;i++){var _L3=this._itemRecords[i];if(_L3.id!=_L0)continue;var _L4='UINestedFilterList_SubItem_';var _L5=_L4+(_L1?'Uncollapsed':'Collapsed');var _L6=_L4+(_L1?'Collapsed':'Uncollapsed');for(var j=0;j<_L3.subItemElems.length;j++)if(CSS.hasClass(_L3.subItemElems[j],_L5)){CSS.removeClass(_L3.subItemElems[j],_L5);CSS.addClass(_L3.subItemElems[j],_L6);}var _L8=$(_L0+'_CollapseLinkMore');var _L9=$(_L0+'_CollapseLinkHide');if(_L1){_L8.style.display='block';hide(_L9);}else{hide(_L8);_L9.style.display='block';}}},showCollapsed:function(_L0){this._changeCollapse(_L0,false);},hideCollapsed:function(_L0){this._changeCollapse(_L0,true);}});function UINestedNavItem(id){copy_properties(this,{id:id,icon:null,isSprited:false,href:null,title:null,subTitle:null,subItems:[],closeHandler:null});}copy_properties(UINestedNavItem.prototype,{setId:function(id){return this._mutate('id',id);},setTitle:function(_L0){return this._mutate('title',_L0);},setSubTitle:function(_L0){return this._mutate('subTitle',_L0);},setHref:function(_L0){return this._mutate('href',_L0);},setIcon:function(_L0){this.isSprited=false;return this._mutate('icon',_L0);},setSubItems:function(_L0){return this._mutate('subItems',_L0);},setCloseHandler:function(_L0){return this._mutate('closeHandler',_L0);},_mutate:function(key,_L1){this[key]=_L1;return this;}});

if (window.Bootloader) { Bootloader.done(["js\/ydir8cghkis0gkco.pkg.js"]); }