/*!CK:2875556241!*//*1459382574,*/

if (self.CavalryLogger) { CavalryLogger.start_js(["D\/u54"]); }

__d("ChatNotificationConstants",[],function a(b,c,d,e,f,g){c.__markCompiled&&c.__markCompiled();f.exports={NORMAL:0,NO_USER_MESSAGE_NOTIFICATION:1};},null);
__d("IrisProtocolMessageLifetime",[],function a(b,c,d,e,f,g){c.__markCompiled&&c.__markCompiled();f.exports={TTL_OFF:0,TTL_ON_UNKNOWN:1,TTL_30SECONDS:30000,TTL_1MINUTE:60000,TTL_3MINUTES:180000,TTL_5MINUTES:300000,TTL_10MINUTES:600000,TTL_15MINUTES:900000,TTL_30MINUTES:1800000,TTL_1HOUR:3600000,TTL_2HOURS:7200000,TTL_4HOURS:14400000,TTL_8HOURS:28800000,TTL_12HOURS:43200000,TTL_24HOURS:86400000};},null);
__d("MercuryMessageSourceTags",[],function a(b,c,d,e,f,g){c.__markCompiled&&c.__markCompiled();f.exports={CHAT:"source:chat",EMAIL:"source:email",MESSENGER:"source:messenger",MOBILE:"source:mobile"};},null);
__d("MercurySendMessageFields",[],function a(b,c,d,e,f,g){c.__markCompiled&&c.__markCompiled();f.exports={AUTO_RETRY_CNT:"auto_retry_cnt",MANUAL_RETRY_CNT:"manual_retry_cnt"};},null);
__d("MercurySyncTopicType",[],function a(b,c,d,e,f,g){c.__markCompiled&&c.__markCompiled();f.exports={DELTA:"delta",DELTAFLOW:"deltaflow"};},null);
__d("MercuryTimePassed",[],function a(b,c,d,e,f,g){c.__markCompiled&&c.__markCompiled();f.exports={TODAY:0,WEEK_AGO:1,MONTH_AGO:2,CURRENT_YEAR:3,OTHER_YEAR:4};},null);
__d("MercuryTypeaheadConstants",[],function a(b,c,d,e,f,g){c.__markCompiled&&c.__markCompiled();f.exports={COMPOSER_FRIENDS_MAX:4,COMPOSER_FB4C_MAX:4,COMPOSER_NON_FRIENDS_MAX:2,COMPOSER_SHOW_MORE_LIMIT:2,COMPOSER_THREADS_INITIAL_LIMIT:2,COMPOSER_CHATTAB_MAX:5,COMPOSER_PAGES_MAX:4,COMPOSER_WM_MAX:18,USER_TYPE:"user",PAGE_TYPE:"page",THREAD_TYPE:"thread",HEADER_TYPE:"header",FRIEND_TYPE:"friend",NON_FRIEND_TYPE:"non_friend",FB4C_TYPE:"fb4c",MEETING_ROOM_PAGE_TYPE:"meeting_room_page",COMMERCE_PAGE_TYPE:"commerce_page",VALID_EMAIL:"^([A-Z0-9._\u0025+-]+\u0040((?!facebook\\.com))[A-Z0-9.-]+\\.[A-Z]{2,4}|(([A-Z._\u0025+-]+[A-Z0-9._\u0025+-]*)|([A-Z0-9._\u0025+-]+[A-Z._\u0025+-]+[A-Z0-9._\u0025+-]*))\u0040(?:facebook\\.com))$"};},null);
__d("MessagingEvent",[],function a(b,c,d,e,f,g){c.__markCompiled&&c.__markCompiled();f.exports={DELETE:"delete",DELETE_MESSAGES:"delete_messages",DELIVER:"deliver",ERROR:"error",READ:"read",REPORT_SPAM:"report_spam",REPORT_SPAM_MESSAGES:"report_spam_messages",UNMARK_SPAM:"unmark_spam",SUBSCRIBE:"subscribe",CHANGE_MUTE_SETTINGS:"change_mute_settings",TAG:"tag",UNREAD:"unread",UNSUBSCRIBE:"unsubscribe",DELIVER_LOG:"deliver_log",MORE_THREADS:"more_threads",READ_ALL:"read_all",READ_RECEIPT:"read_receipt",DELIVERY_RECEIPT:"delivery_receipt",SENT_PUSH:"sent_push",DELIVER_FAST_PAST:"deliver_fast_path",MESSENGER_STATUS:"messenger_status",UPDATE_PINNED_THREADS:"update_pinned_threads",CHANGE_PAGE_THREAD_FLAG:"change_page_thread_flag",UPDATE_BLOCKER_STATUS:"update_blocker_status",UPDATE_BLOCKEE_STATUS:"update_blockee_status",CREATE_PAGE_ADMIN_NOTE:"create_page_admin_note",NO_OP:"no_op"};},null);
__d("MessagingThreadAction",[],function a(b,c,d,e,f,g){c.__markCompiled&&c.__markCompiled();f.exports={ACTION_INVALID:"ACTION_INVALID",ACTION_ARCHIVED:"ACTION_ARCHIVED",ACTION_UNARCHIVED:"ACTION_UNARCHIVED"};},null);
__d("OzConstants",[],function a(b,c,d,e,f,g){c.__markCompiled&&c.__markCompiled();f.exports={AUTHOR_TYPES:{BOT:"bot",TRAINER:"trainer",USER:"user"},ATTS:{COMMAND:"\u0040COMMAND",IMAGE:"image",SUGG:"\u0040SUGG",TEMPLATE:"template",SURVEY:"survey",QUICK_REPLIES:"\u0040QUICK_REPLIES"},SESSION_INFO_EVENT:"iframenonce_fb_session_info",TOKENS:{USER_FIRST_NAME:"user-first-name"},REMINDERS:{RANGE_IN_YEARS:5},M_FBIDS:{M:"881263441913087",M_DEV:"1579802578966277",P:"506060876211905"}};},null);
__d("PagesMessagingEventType",[],function a(b,c,d,e,f,g){c.__markCompiled&&c.__markCompiled();f.exports={FLAG:1,CREATE_ADMIN_NOTE:2};},null);
__d("StickerConstants",[],function a(b,c,d,e,f,g){c.__markCompiled&&c.__markCompiled();f.exports={MOBILE_LIKE_STICKER_PACK_ID:"227877430692340",GRAVEYARD_PACK_ID:"604597256247273",LIKE_STICKER_ID:"227878347358915",HOT_LIKE_SMALL_STICKER_ID:"369239263222822",HOT_LIKE_MEDIUM_STICKER_ID:"369239343222814",HOT_LIKE_LARGE_STICKER_ID:"369239383222810",MRU_STICKER_PACK:"599061016853145",SEARCH_PACK_ID:"680229632032514",SPRITE_PADDING:"24",PayloadSource:{VIEW_ACTION:"view-action"},EMOTICON_PACK_ID:"1471127876485636",DEFAULT_FRAME_RATE:83,TRAY_SIZE:64,THREAD_SIZE:120};},null);
__d('ChatOpenTabEventLogger',['Banzai','ChatImpressionLogger','MercuryIDs'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();var h='messaging_tracking',i={log:function(j,k,l,m){var n={referrer:j||'',message_thread_id:k,message_view:'chat',timestamp_send:Date.now(),message_target_ids:null};if(l!==undefined)n.message_target_ids=[l];c('ChatImpressionLogger').logImpression(j,l,m);c('Banzai').post(h,n,{delay:0,retry:true});var o=c('MercuryIDs').getUserIDFromThreadID(String(k));c('Banzai').post('page_message_button_click',{page_id:o,ref:j});}};f.exports=i;},null);
__d('ChatWelcomeMessage',['ImmutableObject'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();function h(){this.$ChatWelcomeMessage1={};}h.prototype.setWelcomeMessage=function(j,k,l){this.$ChatWelcomeMessage1[j]=new (c('ImmutableObject'))({timestamp:Date.now(),thread_id:j,author:k,body:l});};h.prototype.getWelcomeMessage=function(j){return this.$ChatWelcomeMessage1[j];};var i=new h();f.exports=i;},null);
__d('MercuryLocalIDs',['PresenceUtil','randomInt'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();var h={generateMessageID:function(j){var k=j||Date.now(),l=c('randomInt')(0,4294967295),m=c('PresenceUtil').getSessionID();return '<'+k+':'+l+'-'+m+'@mail.projektitan.com>';},generateThreadID:function(j){return 'root:'+h.generateOfflineThreadingID(j);},generateOfflineThreadingID:function(j){var k=j||Date.now(),l=c('randomInt')(0,4294967295),m=('0000000000000000000000'+l.toString(2)).slice(-22),n=k.toString(2)+m;return i(n.slice(-63));}};function i(j){var k='';while(j!='0'){var l=0,m='';for(var n=0;n<j.length;n++){l=2*l+parseInt(j[n],10);if(l>=10){m+='1';l-=10;}else m+='0';}k=l.toString()+k;j=m.slice(m.indexOf('1'));}return k;}f.exports=h;},null);
__d('MercuryMessageObject',['fbt','BanzaiODS','MercuryActionStatus','MercuryActionType','MercuryIDs','MercuryLocalIDs','MercuryMessageClientState','MercuryMessageSourceTags','MercurySingletonProvider','MercurySourceType','MercuryThreads','MercuryTimePassed','MercurySendMessageFields','formatDate'],function a(b,c,d,e,f,g,h){if(c.__markCompiled)c.__markCompiled();i.getForFBID=function(m){'use strict';return l.getForFBID(m);};i.get=function(){'use strict';return l.get();};function i(m){'use strict';this.$MercuryMessageObject1=m;this.$MercuryMessageObject2=c('MercuryThreads').getForFBID(m);}i.prototype.constructUserGeneratedMessageObject=function(m,n,o,p,q){'use strict';var r=j(this.$MercuryMessageObject1,c('MercuryActionType').USER_GENERATED_MESSAGE,n,o);if(typeof m=='string')m=m.replace(/^\s+/,'').replace(/\s+$/,'');r.body=m;r.has_attachment=false;r.html_body=false;r.attachments=[];r.specific_to_list=p||[];r.creator_info=q;return r;};i.prototype.constructStickerMessageObject=function(m,n,o){'use strict';var p=j(this.$MercuryMessageObject1,c('MercuryActionType').USER_GENERATED_MESSAGE,n,o);p.has_attachment=true;p.html_body=false;p.attachments=[];p.sticker_id=m;p.specific_to_list=[];return p;};i.prototype.constructAttachmentMessageObject=function(m,n){'use strict';var o=j(this.$MercuryMessageObject1,c('MercuryActionType').USER_GENERATED_MESSAGE,m,n);o.attachments=[];o.specific_to_list=[];return o;};i.prototype.constructLogMessageObject=function(m,n,o,p){'use strict';var q=j(this.$MercuryMessageObject1,c('MercuryActionType').LOG_MESSAGE,m,n);q.log_message_type=o;q.log_message_data=p;if(p&&p.untypedData&&p.untypedData.ttl)q.ephemeral_ttl_mode=p.untypedData.ttl;return q;};i.prototype.normalizeNewMessage=function(m){'use strict';if(m.status===undefined)m.status=c('MercuryActionStatus').UNSENT;m.timestamp_absolute=h._("Today").toString();m.offline_threading_id=m.offline_threading_id||c('MercuryLocalIDs').generateOfflineThreadingID(m.timestamp);if(!m.offline_threading_id)c('BanzaiODS').bumpEntityKey('chat.web','invalid_otid_generated');m.message_id=m.message_id||m.offline_threading_id;var n=c('MercuryIDs').getParticipantIDFromUserID(this.$MercuryMessageObject1);m.specific_to_list=m.specific_to_list||[];if(m.specific_to_list.length&&m.specific_to_list.indexOf(n)===-1)m.specific_to_list.push(n);if(!m.thread_id){m.thread_id='root:'+m.offline_threading_id;}else{var o=this.$MercuryMessageObject2.getThreadMetaNow(m.thread_id);if(o&&o.ephemeral_ttl_mode!==null&&m.ephemeral_ttl_mode===undefined)m.ephemeral_ttl_mode=o.ephemeral_ttl_mode;}if(m.specific_to_list.length==1){m.thread_id='user:'+this.$MercuryMessageObject1;}else if(m.specific_to_list.length==2){var p=m.specific_to_list[0]==n?m.specific_to_list[1]:m.specific_to_list[0];m.thread_id=c('MercuryIDs').getThreadIDFromParticipantID(p);}if(!m.specific_to_list.length){var q=c('MercuryIDs').tokenize(m.thread_id),r=q.type,s=q.value;if(r=='user')m.specific_to_list=['fbid:'+s,n];}if(!m[c('MercurySendMessageFields').MANUAL_RETRY_CNT])m[c('MercurySendMessageFields').MANUAL_RETRY_CNT]=0;};i.prototype.normalizeResendMessage=function(m){'use strict';m.status=c('MercuryActionStatus').RESENDING;m.timestamp=Date.now();m[c('MercurySendMessageFields').MANUAL_RETRY_CNT]+=1;};i.prototype.normalizeAddAttachmentPlaceholder=function(m,n,o){'use strict';if(o.preview_attachments.length>0){m.has_attachment=true;m.preview_attachments=o.preview_attachments;}m.client_state=c('MercuryMessageClientState').DO_NOT_SEND_TO_SERVER;m.status=c('MercuryActionStatus').RESENDING;m.upload_id=n;};function j(m,n,o,p){var q=k(o)?[c('MercuryMessageSourceTags').CHAT]:[],r=Date.now(),s=c('formatDate')(new Date(r),'g:ia'),t={action_type:n,thread_id:p,author:c('MercuryIDs').getParticipantIDFromUserID(m),author_email:null,timestamp:r,timestamp_absolute:new Date(r).toLocaleDateString(),timestamp_relative:s,timestamp_time_passed:c('MercuryTimePassed').TODAY,is_unread:false,is_forward:false,is_filtered_content:false,is_filtered_content_bh:false,is_filtered_content_account:false,is_filtered_content_quasar:false,is_filtered_content_invalid_app:false,is_spoof_warning:false,source:o,source_tags:q};return t;}function k(m){switch(m){case c('MercurySourceType').CHAT_WEB:case c('MercurySourceType').CHAT_JABBER:case c('MercurySourceType').CHAT_IPHONE:case c('MercurySourceType').CHAT_MEEBO:case c('MercurySourceType').CHAT_ORCA:case c('MercurySourceType').CHAT_TEST:case c('MercurySourceType').CHAT:case c('MercurySourceType').DESKTOP:return true;default:return false;}}var l=new (c('MercurySingletonProvider'))(i);f.exports=i;},null);
__d('MercuryMessageActions',['MercuryActionType','MercuryDispatcher','MercuryMessageObject','MercuryPayloadSource','MercuryServerRequests','MercurySingletonMixin'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();function h(i){this.$MercuryMessageActions1=i;this.$MercuryMessageActions2=c('MercuryMessageObject').getForFBID(this.$MercuryMessageActions1);this.__serverRequests=c('MercuryServerRequests').getForFBID(this.$MercuryMessageActions1);this.__dispatcher=c('MercuryDispatcher').getForFBID(this.$MercuryMessageActions1);}h.prototype.send=function(i,j,k){j=j||Function.prototype;this.$MercuryMessageActions2.normalizeNewMessage(i);this.__dispatcher.handleUpdate(this.__constructClientSingleMessagePayload(babelHelpers['extends']({},i),c('MercuryPayloadSource').CLIENT_SEND_MESSAGE));this.__serverRequests.sendNewMessage(i,k);j(i.thread_id);};h.prototype.resend=function(i,j){var k=babelHelpers['extends']({},i);this.$MercuryMessageActions2.normalizeResendMessage(k);this.send(k,undefined,j);};h.prototype.addAttachmentPlaceholder=function(i,j,k){this.$MercuryMessageActions2.normalizeAddAttachmentPlaceholder(i,j,k);this.$MercuryMessageActions2.normalizeNewMessage(i);this.__dispatcher.handleUpdate(this.__constructClientSingleMessagePayload(babelHelpers['extends']({},i),c('MercuryPayloadSource').CLIENT_SEND_MESSAGE));};h.prototype.cancelAttachmentPlaceholder=function(i,j){this.__dispatcher.handleUpdate(this.__constructClientSingleMessagePayload({upload_id:i,upload_data:j,action_type:c('MercuryActionType').CANCEL_ATTACHMENT_PLACEHOLDER},c('MercuryPayloadSource').CLIENT_SEND_MESSAGE));};h.prototype.confirmAttachmentPlaceholder=function(i,j){this.__dispatcher.handleUpdate(this.__constructClientSingleMessagePayload({upload_id:i,upload_data:j,action_type:c('MercuryActionType').CONFIRM_ATTACHMENT_PLACEHOLDER},c('MercuryPayloadSource').CLIENT_SEND_MESSAGE));};h.prototype['delete']=function(i,j,k){this.__dispatcher.handleUpdate(this.$MercuryMessageActions3(i,j,c('MercuryActionType').DELETE_MESSAGES,k||c('MercuryPayloadSource').CLIENT_DELETE_MESSAGES));};h.prototype.unwrap=function(i){this.__dispatcher.handleUpdate(this.__constructClientSingleMessagePayload({thread_id:i.thread_id,unwrapped_message_id:i.message_id,action_type:c('MercuryActionType').UNWRAP_MESSAGE},c('MercuryPayloadSource').CLIENT_UNWRAP_MESSAGE));};h.prototype.__constructClientSingleMessagePayload=function(i,j){return {actions:[i],from_client:true,payload_source:j};};h.prototype.$MercuryMessageActions4=function(i,j){return {actions:[i],from_client:false,payload_source:j};};h.prototype.$MercuryMessageActions3=function(i,j,k,l){return {actions:[{action_type:k,thread_id:i,message_ids:j}],from_client:true,payload_source:l};};Object.assign(h,c('MercurySingletonMixin'));f.exports=h;},null);
__d('MercuryViewer',['CurrentUser','MercuryAssert'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();var h='fbid:'+c('CurrentUser').getID(),i={getID:function(){return h;},isViewer:function(j){c('MercuryAssert').isParticipantID(j);return j===h;}};f.exports=i;},null);
__d("XMercuryThreadLikeIconController",["XController"],function a(b,c,d,e,f,g){c.__markCompiled&&c.__markCompiled();f.exports=c("XController").create("\/mercury\/like_icon\/",{emoji:{type:"String",defaultValue:""}});},null);
__d("XMessagingSaveAdminsController",["XController"],function a(b,c,d,e,f,g){c.__markCompiled&&c.__markCompiled();f.exports=c("XController").create("\/messaging\/save_admins\/",{elem_id:{type:"String"},parent_elem_id:{type:"String"},thread_fbid:{type:"String"},admin_ids:{type:"FBIDSet"},add:{type:"Bool",defaultValue:false}});},null);
__d("XMessagingSaveNicknameController",["XController"],function a(b,c,d,e,f,g){c.__markCompiled&&c.__markCompiled();f.exports=c("XController").create("\/messaging\/save_thread_nickname\/",{source:{type:"Enum",required:true,enumType:1}});},null);
__d("XMessagingSaveThreadColorController",["XController"],function a(b,c,d,e,f,g){c.__markCompiled&&c.__markCompiled();f.exports=c("XController").create("\/messaging\/save_thread_color\/",{source:{type:"Enum",required:true,enumType:1}});},null);
__d("XMessagingSaveThreadEmojiController",["XController"],function a(b,c,d,e,f,g){c.__markCompiled&&c.__markCompiled();f.exports=c("XController").create("\/messaging\/save_thread_emoji\/",{source:{type:"Enum",required:true,enumType:1}});},null);
__d("XMessengerNotificationsSettingsDialogController",["XController"],function a(b,c,d,e,f,g){c.__markCompiled&&c.__markCompiled();f.exports=c("XController").create("\/notifications\/settings\/dialog\/",{thread_key_id:{type:"String",required:true},modify:{type:"Bool",defaultValue:false},__asyncDialog:{type:"Int"}});},null);
__d("XNFXMessengerBlockActionController",["XController"],function a(b,c,d,e,f,g){c.__markCompiled&&c.__markCompiled();f.exports=c("XController").create("\/nfx\/block_messages\/",{thread_fbid:{type:"Int",required:true},av:{type:"Int"},location:{type:"Enum",required:true,enumType:1},__asyncDialog:{type:"Int"}});},null);
__d('MercuryThreadActions',['cssVar','AsyncDialog','AsyncRequest','EmojiLikeConstants','IrisProtocolMessageLifetime','MercuryMessageActions','MercuryActionType','MercuryAPIArgsSource','MercuryDispatcher','MercuryIDs','MercuryLogMessageType','MercuryMessengerBlockingUtils','MercuryMessageObject','MercuryPayloadSource','MercuryServerPayloadPreprocessor','MercuryServerRequests','MercurySingletonMixin','MercurySourceType','MercuryThreads','MercuryThreadIDMap','MercuryViewer','MessagingGenericAdminTextType','MessagingTag','XNFXMessengerBlockActionController','URI','XMercuryThreadLikeIconController','XMessagingSaveAdminsController','XMessagingSaveNicknameController','XMessagingSaveThreadColorController','XMessagingSaveThreadEmojiController','MercuryAssert','XMessengerNotificationsSettingsDialogController'],function a(b,c,d,e,f,g,h){'use strict';if(c.__markCompiled)c.__markCompiled();var i=c('MercuryMessageActions').get(),j=c('MercuryMessageObject').get(),k=c('MercuryThreads').get(),l=c('MercuryThreadIDMap').get();function m(n){this.$MercuryThreadActions1=n;this.__serverRequests=c('MercuryServerRequests').getForFBID(this.$MercuryThreadActions1);this.__dispatcher=c('MercuryDispatcher').getForFBID(this.$MercuryThreadActions1);this.__payloadPreprocessor=c('MercuryServerPayloadPreprocessor').getForFBID(this.$MercuryThreadActions1);}m.prototype.markRead=function(n,o){this.batchMarkRead([n],o);};m.prototype.batchMarkRead=function(n,o){this.__dispatcher.handleUpdate(this.$MercuryThreadActions2(n,true,o));};m.prototype.markUnread=function(n,o){this.batchMarkUnread([n],o);};m.prototype.batchMarkUnread=function(n,o){this.__dispatcher.handleUpdate(this.$MercuryThreadActions2(n,false,o));};m.prototype.markSeen=function(n,o){this.__dispatcher.handleUpdate(this.__constructClientPayload([n],c('MercuryActionType').MARK_THREAD_SEEN,c('MercuryPayloadSource').CLIENT_MARK_THREAD_SEEN,{persistent:o}));};m.prototype.archive=function(n,o){this.batchArchive([n],o);};m.prototype.batchArchive=function(n,o){n.forEach(function(p){this.__serverRequests.changeThreadArchivedStatus(p,true,o);}.bind(this));this.__dispatcher.handleUpdate(this.$MercuryThreadActions3(n,true));};m.prototype.unarchive=function(n,o){this.batchUnarchive([n],o);};m.prototype.batchUnarchive=function(n,o){n.forEach(function(p){this.__serverRequests.changeThreadArchivedStatus(p,false,o);}.bind(this));this.__dispatcher.handleUpdate(this.$MercuryThreadActions3(n,false));};m.prototype.markSpam=function(n,o){this.batchMarkSpam([n],o);};m.prototype.batchMarkSpam=function(n,o){n.forEach(function(p){this.__serverRequests.markThreadSpam(p,o);}.bind(this));this.__dispatcher.handleUpdate(this.$MercuryThreadActions4(n,c('MessagingTag').SPAM));};m.prototype.unmarkSpam=function(n,o){this.batchUnmarkSpam([n],o);};m.prototype.batchUnmarkSpam=function(n,o){n.forEach(function(p){this.__serverRequests.unmarkThreadSpam(p,o);}.bind(this));this.__dispatcher.handleUpdate(this.$MercuryThreadActions4(n,c('MessagingTag').INBOX));};m.prototype.changeFolder=function(n,o){this.batchChangeFolder([n],o);};m.prototype.batchChangeFolder=function(n,o){n.forEach(function(p){this.__serverRequests.changeThreadFolder(p,o);}.bind(this));this.__dispatcher.handleUpdate(this.$MercuryThreadActions4(n,o));};m.prototype['delete']=function(n,o){this.batchDelete([n],o);};m.prototype.batchDelete=function(n,o){n.forEach(function(p){this.__serverRequests.deleteThread(p,o);}.bind(this));this.__dispatcher.handleUpdate(this.__constructClientPayload(n,c('MercuryActionType').DELETE_THREAD,c('MercuryPayloadSource').CLIENT_DELETE_THREAD));};m.prototype.openNotificationSettings=function(n){c('MercuryAssert').isThreadID(n);this.__threadIDMap.getServerIDFromClientID(n,function(o){var p=c('XMessengerNotificationsSettingsDialogController').getURIBuilder().setString('thread_key_id',o).setBool('modify',false).getURI();new (c('AsyncRequest'))().setURI(p).send();});};m.prototype.unmute=function(n){this.updateMuteSetting(n,0);};m.prototype.updateMuteSetting=function(n,o){this.__serverRequests.changeMutingOnThread(n,o);this.__dispatcher.handleUpdate(this.__constructClientPayload([n],c('MercuryActionType').CHANGE_MUTE_SETTINGS,c('MercuryPayloadSource').CLIENT_CHANGE_MUTE_SETTINGS,{mute_settings:o}));};m.prototype.blockMessages=function(n){var o=c('XNFXMessengerBlockActionController').getURIBuilder().setInt('thread_fbid',c('MercuryIDs').getUserIDFromThreadID(n)).setEnum('location','www_chat_head').getURI();c('AsyncDialog').send(new (c('AsyncRequest'))(o));};m.prototype.unblockMessages=function(n){var o=JSON.stringify({reportable_ent_token:c('MercuryIDs').getUserIDFromThreadID(n),initial_action_name:c('MercuryMessengerBlockingUtils').block_messages});new (c('AsyncRequest'))(new (c('URI'))('/ajax/nfx/messenger_undo_block').addQueryData({story_location:'messenger',context:o})).send();};m.prototype.turnOffSecretMode=function(n){if(k.isEmptyLocalThread(n))return;i.send(j.constructLogMessageObject(c('MercurySourceType').TITAN_WEB,n,c('MercuryLogMessageType').GENERIC_ADMIN_TEXT,{message_type:c('MessagingGenericAdminTextType').THREAD_EPHEMERAL_SEND_MODE,untypedData:{ttl:c('IrisProtocolMessageLifetime').TTL_OFF}}),null,c('MercuryAPIArgsSource').WEBMESSENGER);};m.prototype.turnOnSecretMode=function(n){if(k.isEmptyLocalThread(n))return;i.send(j.constructLogMessageObject(c('MercurySourceType').TITAN_WEB,n,c('MercuryLogMessageType').GENERIC_ADMIN_TEXT,{message_type:c('MessagingGenericAdminTextType').THREAD_EPHEMERAL_SEND_MODE,untypedData:{ttl:c('IrisProtocolMessageLifetime').TTL_1HOUR}}),null,c('MercuryAPIArgsSource').WEBMESSENGER);};m.prototype.leaveGroup=function(n){if(!k.isEmptyLocalThread(n))i.send(j.constructLogMessageObject(c('MercurySourceType').TITAN_WEB,n,c('MercuryLogMessageType').UNSUBSCRIBE,{removed_participants:[c('MercuryViewer').getID()]}),null,c('MercuryAPIArgsSource').WEBMESSENGER);};m.prototype.changeThreadColor=function(n,o,p){if(k.isEmptyLocalThread(n))return;l.getServerIDFromClientID(n,function(q){var r={};if(o!="#0084ff")r.color_choice=o;r.thread_or_other_fbid=q;var s=c('XMessagingSaveThreadColorController').getURIBuilder().setEnum('source',p).getURI();new (c('AsyncRequest'))(s).setMethod('POST').setData(r).send();});};m.prototype.changeThreadEmoji=function(n,o,p){if(k.isEmptyLocalThread(n))return;l.getServerIDFromClientID(n,function(q){var r={};if(o!=c('EmojiLikeConstants').THUMBS_UP_EMOJI)r.emoji_choice=o;r.thread_or_other_fbid=q;var s=c('XMessagingSaveThreadEmojiController').getURIBuilder().setEnum('source',p).getURI();new (c('AsyncRequest'))(s).setMethod('POST').setData(r).send();});};m.prototype.changeThreadNicknames=function(n,o,p,q){if(k.isEmptyLocalThread(n))return;l.getServerIDFromClientID(n,function(r){var s={thread_or_other_fbid:r,participant_id:o,nickname:p},t=c('XMessagingSaveNicknameController').getURIBuilder().setEnum('source',q).getURI();new (c('AsyncRequest'))(t).setMethod('POST').setData(s).send();});};m.prototype.changeGroupAdmins=function(n,o,p){var q={thread_fbid:n,admin_ids:o,add:p},r=c('XMessagingSaveAdminsController').getURIBuilder().getURI();new (c('AsyncRequest'))(r).setMethod('POST').setData(q).send();};m.prototype.addParticipants=function(n,o){this.__dispatcher.handleUpdate(this.__constructClientPayload([n],c('MercuryActionType').ADD_PARTICIPANTS,c('MercuryPayloadSource').CLIENT_ADD_PARTICIPANTS,{participants:o}));};m.prototype.unpinThread=function(n){this.__serverRequests.unpinThread(n);this.__dispatcher.handleUpdate(this.__constructClientPayload([n],c('MercuryActionType').UNPIN_THREAD,c('MercuryPayloadSource').CLIENT_UNPIN_THREAD));};m.prototype.updateCustomLike=function(n,o){var p=c('XMercuryThreadLikeIconController').getURIBuilder().setString('emoji',o).getURI();new (c('AsyncRequest'))().setURI(p).setHandler(function(q){this.__dispatcher.handleUpdate(this.__constructClientPayload([n],c('MercuryActionType').UPDATE_CUSTOM_LIKE,c('MercuryPayloadSource').CLIENT_CHANGE_CUSTOM_LIKE,{custom_like:q.getPayload()}));}.bind(this)).send();};m.prototype.movePendingToInbox=function(n){this.__dispatcher.handleUpdate(this.__constructClientPayload([n],c('MercuryActionType').MOVE_PENDING_TO_INBOX,c('MercuryPayloadSource').CLIENT_MOVE_PENDING_TO_INBOX));};m.prototype.updateSnippet=function(n,o){this.__dispatcher.handleUpdate(this.__constructClientPayload([n],c('MercuryActionType').UPDATE_SNIPPET,c('MercuryPayloadSource').CLIENT_UPDATE_SNIPPET,{deleted_ids:o}));};m.prototype.$MercuryThreadActions2=function(n,o,p){return this.__constructClientPayload(n,c('MercuryActionType').CHANGE_READ_STATUS,c('MercuryPayloadSource').CLIENT_CHANGE_READ_STATUS,{mark_as_read:o,source:p});};m.prototype.$MercuryThreadActions3=function(n,o){return this.__constructClientPayload(n,c('MercuryActionType').CHANGE_ARCHIVED_STATUS,c('MercuryPayloadSource').CLIENT_CHANGE_ARCHIVED_STATUS,{archived:o});};m.prototype.$MercuryThreadActions4=function(n,o){return this.__constructClientPayload(n,c('MercuryActionType').CHANGE_FOLDER,c('MercuryPayloadSource').CLIENT_CHANGE_FOLDER,{new_folder:o});};m.prototype.__constructClientPayload=function(n,o,p,q){return {actions:n.map(function(r){return babelHelpers['extends']({action_type:o,thread_id:r},q);}),from_client:true,payload_source:p};};Object.assign(m,c('MercurySingletonMixin'));f.exports=m;},null);
__d('ChatOpenTabImpl',['csx','Promise','Bootloader','ChatApp','ChatOpenTabEventLogger','ChatWelcomeMessage','DOM','LogHistory','MercuryIDs','MercuryThreadActions','MercuryThreadIDMap','MercuryThreads','Toggler','requireWeak'],function a(b,c,d,e,f,g,h){'use strict';if(c.__markCompiled)c.__markCompiled();var i=c('MercuryThreadActions').get(),j=c('MercuryThreadIDMap').get(),k=c('MercuryThreads').get(),l=null;c('requireWeak')('ChatTabModel',function(n){return l=n;});var m={canOpenTab:function(){return !!(c('ChatApp')&&!c('ChatApp').isHidden());},openEmptyTab:function(n,o,p){if(this.canOpenTab()&&l){var q=l.getEmptyTab();this._openClientTab(q,null);this._logChatOpenTabEvent(o,q,null,p);this._closeJewelFlyout();}},openThreadTab:function(n,o,p,q,r){if(!c('MercuryIDs').isValid(n)){j.getClientIDFromServerID(n,function(s){m.openThreadTabImpl(s,o,p,q,r);});}else m.openThreadTabImpl(n,o,p,q,r);},openThreadTabImpl:function(n,o,p,q,r){var s=new (c('Promise'))(function(u,v){k.getThreadMeta(n,function(w){u(w);});}),t=new (c('Promise'))(function(u,v){c('Bootloader').loadModules(["MercuryBlockedParticipants","GroupChatMessageBlockAlert"],function(w,x){u({MercuryBlockedParticipants:w.get(),GroupChatMessageBlockAlert:x});});});c('Promise').all([t,s]).then(this._whenThreadLoaded.bind(this,n,o,p,q,r),this._whenThreadNotLoaded.bind(this,{thread_id:n})).done();},_whenThreadLoaded:function(n,o,p,q,r,s){var t=s[0],u=t.MercuryBlockedParticipants,v=t.GroupChatMessageBlockAlert,w=s[1];if(u.isPresentInGroupThread(w)){v.show(u.inGroupThread(w),function(){this.openClientTab(n,o,p,q,r);}.bind(this),function(){i.leaveGroup(n);});}else this.openClientTab(n,o,p,q,r);},_whenThreadNotLoaded:function(n,o){c('LogHistory').getInstance('mercury').error('Unable to load modules and/or get thread meta',o);},openClientTab:function(n,o,p,q,r){this._openClientTab(n,q,r);this._logChatOpenTabEvent(o,n,null,p);this._closeJewelFlyout();},openUserTab:function(n,o,p){var q=c('MercuryIDs').getThreadIDFromUserID(n);this._openClientTab(q);this._logChatOpenTabEvent(o,q,n,p);},openPageTab:function(n,o,p){var q=c('MercuryIDs').getThreadIDFromUserID(o);k.getThreadMeta(q,function(r){if(n&&n.length>0){var s=(Date.now()-r.timestamp)/1000,t=s/3600;if(r.message_count===0||t>24)c('ChatWelcomeMessage').setWelcomeMessage(q,c('MercuryIDs').getParticipantIDFromUserID(o),n);}});this._openClientTab(q);this._logChatOpenTabEvent(p,q,o);},_closeJewelFlyout:function(){var n=c('DOM').scry(document,"div._1z4y")[0],o=c('Toggler').getInstance(n);if(o&&o.getActive())o.hide();},_openClientTab:function(n,o,p){k.getThreadMeta(n,function(q){if(!this.canOpenTab())c('LogHistory').getInstance('mercury').error('Unable to open chat tab',n);c('ChatApp').tabController.openTab(n,c('ChatApp').tabsViewport,o,!!p);}.bind(this));},_logChatOpenTabEvent:function(n,o,p,q){c('ChatOpenTabEventLogger').log(n,o,p,q);}};f.exports=m;},null);
__d('Dcode',[],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();var h,i={},j={_:'%',A:'%2',B:'000',C:'%7d',D:'%7b%22',E:'%2c%22',F:'%22%3a',G:'%2c%22ut%22%3a1',H:'%2c%22bls%22%3a',I:'%2c%22n%22%3a%22%',J:'%22%3a%7b%22i%22%3a0%7d',K:'%2c%22pt%22%3a0%2c%22vis%22%3a',L:'%2c%22ch%22%3a%7b%22h%22%3a%22',M:'%7b%22v%22%3a2%2c%22time%22%3a1',N:'.channel%22%2c%22sub%22%3a%5b',O:'%2c%22sb%22%3a1%2c%22t%22%3a%5b',P:'%2c%22ud%22%3a100%2c%22lc%22%3a0',Q:'%5d%2c%22f%22%3anull%2c%22uct%22%3a',R:'.channel%22%2c%22sub%22%3a%5b1%5d',S:'%22%2c%22m%22%3a0%7d%2c%7b%22i%22%3a',T:'%2c%22blc%22%3a1%2c%22snd%22%3a1%2c%22ct%22%3a',U:'%2c%22blc%22%3a0%2c%22snd%22%3a1%2c%22ct%22%3a',V:'%2c%22blc%22%3a0%2c%22snd%22%3a0%2c%22ct%22%3a',W:'%2c%22s%22%3a0%2c%22blo%22%3a0%7d%2c%22bl%22%3a%7b%22ac%22%3a',X:'%2c%22ri%22%3a0%7d%2c%22state%22%3a%7b%22p%22%3a0%2c%22ut%22%3a1',Y:'%2c%22pt%22%3a0%2c%22vis%22%3a1%2c%22bls%22%3a0%2c%22blc%22%3a0%2c%22snd%22%3a1%2c%22ct%22%3a',Z:'%2c%22sb%22%3a1%2c%22t%22%3a%5b%5d%2c%22f%22%3anull%2c%22uct%22%3a0%2c%22s%22%3a0%2c%22blo%22%3a0%7d%2c%22bl%22%3a%7b%22ac%22%3a'};(function(){var l=[];for(var m in j){i[j[m]]=m;l.push(j[m]);}l.reverse();h=new RegExp(l.join("|"),'g');})();var k={encode:function(l){return encodeURIComponent(l).replace(/([_A-Z])|%../g,function(m,n){return n?'%'+n.charCodeAt(0).toString(16):m;}).toLowerCase().replace(h,function(m){return i[m];});},decode:function(l){return decodeURIComponent(l.replace(/[_A-Z]/g,function(m){return j[m];}));}};f.exports=k;},null);
__d('PresenceCookieManager',['Cookie','CurrentUser','Dcode','ErrorUtils','JSLogger','PresenceInitialData','PresenceUtil','URI'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();var h=c('PresenceInitialData').cookieVersion,i='presence',j={},k=null,l=null,m=c('JSLogger').create('presence_cookie');function n(){try{var r=c('Cookie').get(i);if(k!==r){k=r;l=null;if(r&&r.charAt(0)=='E')r=c('Dcode').decode(r.substring(1));if(r)l=JSON.parse(r);}if(l){if(l.user&&l.user!==c('CurrentUser').getID())return null;if(l.v!==h)return null;return l;}}catch(q){m.warn('getcookie_error',q);}return null;}function o(){return parseInt(Date.now()/1000,10);}var p={register:function(q,r){j[q]=r;},store:function(){var q=n();if(q&&q.v&&h<q.v){m.debug('stale_cookie',h);return;}var r={v:h,time:o(),user:c('CurrentUser').getID()};for(var s in j)r[s]=c('ErrorUtils').applyWithGuard(j[s],j,[q&&q[s]],function(w){w.presence_subcookie=s;});var t='E'+c('Dcode').encode(JSON.stringify(r));if(c('PresenceUtil').hasUserCookie()){var u=t.length;if(u>1024)m.warn('big_cookie',u);var v=c('URI').getRequestURI(false).isSecure()&&!!c('Cookie').get('csm');c('Cookie').set(i,t,null,null,v);}},clear:function(){c('Cookie').clear(i);},getSubCookie:function(q){var r=n();if(!r)return null;return r[q];}};f.exports=p;},null);
__d('PresenceState',['Arbiter','ErrorUtils','JSLogger','PresenceCookieManager','debounceAcrossTransitions','setIntervalAcrossTransitions','PresenceInitialData'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();var h=c('PresenceInitialData').cookiePollInterval||2000,i=c('PresenceInitialData').shouldSuppress||false,j=[],k=[],l=null,m=null,n=0,o=null,p=0,q=['sb2','t2','lm2','uct2','tr','tw','at','wml'],r=c('JSLogger').create('presence_state');function s(){return c('PresenceCookieManager').getSubCookie('state');}function t(){n=Date.now();c('PresenceCookieManager').store();x(m);}var u=c('debounceAcrossTransitions')(t,0);function v(ca){if(typeof ca=='undefined'||isNaN(ca)||ca==Number.POSITIVE_INFINITY||ca==Number.NEGATIVE_INFINITY)ca=0;return ca;}function w(ca){var da={};if(ca){q.forEach(function(ga){da[ga]=ca[ga];});if(n<ca.ut)r.error('new_cookie',{cookie_time:ca.ut,local_time:n});}da.ut=n;for(var ea=0,fa=j.length;ea<fa;ea++)c('ErrorUtils').applyWithGuard(j[ea],null,[da]);m=da;return m;}function x(ca){p++;n=v(ca.ut);if(!l)l=c('setIntervalAcrossTransitions')(aa,h);m=ca;if(o===null)o=ca;for(var da=0,ea=k.length;da<ea;da++)c('ErrorUtils').applyWithGuard(k[da],null,[ca]);p--;}function y(ca){if(ca&&ca.ut)if(n<ca.ut){return true;}else if(ca.ut<n)r.error('old_cookie',{cookie_time:ca.ut,local_time:n});return false;}function z(){var ca=s();if(y(ca))m=ca;return m;}function aa(){var ca=s();if(y(ca))x(ca);}c('PresenceCookieManager').register('state',w);c('Arbiter').subscribe(c('JSLogger').DUMP_EVENT,function(ca,da){da.presence_state={initial:babelHelpers['extends']({},o),state:babelHelpers['extends']({},m),update_time:n,sync_paused:p,poll_time:h};});(function(){var ca=z();if(ca){x(ca);}else{r.debug('no_cookie_initial');x(w());return;}})();var ba={doSync:function(ca){if(p)return;if(ca){t();}else u();},registerStateStorer:function(ca){j.push(ca);},registerStateLoader:function(ca){k.push(ca);},get:function(){return z();},getInitial:function(){return o;},shouldSuppress:function(){return i;},verifyNumber:v};f.exports=ba;},null);
__d('ChatActivity',['Arbiter','Event','JSLogger','MercuryConfig','PresenceState','UserActivity'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();var h=c('MercuryConfig').activity_limit||60000,i=c('MercuryConfig').idle_limit||1800000,j=c('MercuryConfig').idle_poll_interval||300000,k=c('JSLogger').create('chat_activity'),l=Date.now(),m=true;function n(){var r=Date.now();return !!(m&&r-l<h);}var o=Object.assign(new (c('Arbiter'))(),{isActive:n});function p(){var r=l;l=Date.now();if(l-r>i){k.debug('idle_to_active',r);c('PresenceState').doSync();}o.inform('activity');}c('Event').listen(window,'focus',function(){m=true;p();});c('Event').listen(window,'blur',function(){m=false;});c('UserActivity').subscribe(function(){p();});function q(r){var s=r&&r.at&&c('PresenceState').verifyNumber(r.at);if(typeof s!=='number')s=null;return s||0;}setInterval(function(){var r=Date.now(),s=q(c('PresenceState').get()),t=Math.max(l,s);if(r-t>i){k.debug('idle',{cookie:s,local:l});o.inform('idle',r-t);}},j);c('PresenceState').registerStateStorer(function(r){var s=q(r);if(s<l)r.at=l;return r;});c('Arbiter').subscribe(c('JSLogger').DUMP_EVENT,function(r,s){s.chat_activity={activity_limit:h,idle_limit:i,idle_poll_interval:j,last_active_time:l};});f.exports=o;},null);
__d('ChatMentionsNotifications',['fbt','CurrentUser','MercuryParticipants'],function a(b,c,d,e,f,g,h){if(c.__markCompiled)c.__markCompiled();var i={notifyIfMessageToMe:function(j){var k='fbid:'+c('CurrentUser').getID(),l=j.body;c('MercuryParticipants').get(k,function(m){var n=new RegExp(m.short_name,"i");if(n.test(l))i._notify(j);});},_notify:function(j){var k=48,l=j.body;if(l.length>k)l=l.substr(0,k-3)+"...";new Notification(h._("You were tagged in a message!"),{body:l,icon:"http://facebook.com//images/icons-large/fb-xl.png"});}};f.exports=i;},null);
__d('ChatBehavior',['Arbiter','AvailableList','AvailableListConstants','ChatNotificationConstants'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();var h=false,i=c('AvailableList').getWebChatNotification&&c('AvailableList').getWebChatNotification(),j=h,k=true,l=Object.assign(new (c('Arbiter'))(),{ON_CHANGED:'changed',notifiesUserMessages:function(){return i!==c('ChatNotificationConstants').NO_USER_MESSAGE_NOTIFICATION;},ignoresRemoteTabRaise:function(){return j;},showsTabUnreadUI:function(){return k;}});function m(){l.inform(l.ON_CHANGED);}c('AvailableList').subscribe&&c('AvailableList').subscribe(c('AvailableListConstants').ON_CHAT_NOTIFICATION_CHANGED,function(){var n=i,o=c('AvailableList').getWebChatNotification();i=o;if(n!=o)m();});c('Arbiter').subscribe('chat/set_does_page_occlude_tabs',function(n,o){j=!!o;m();});c('Arbiter').subscribe('chat/set_show_tab_unread_ui',function(n,o){k=!!o;m();});f.exports=l;},null);
__d('ChatCookieInterface',['ChatConfig','InitialServerTime','MercuryIDs','LogHistory','PresenceState','PresenceUtil'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();var h=c('LogHistory').getInstance('chat_cookie'),i=c('InitialServerTime').serverTime,j=c('ChatConfig').get('tab_max_load_age')||3600000,k=i-j,l={store:function(p,q){if(p.uct2==q.lastChangeTime)return p;var r=o(p,q),s={};if(!r){s.old_tabs=p&&p.t2&&JSON.stringify(p.t2);s.old_promoted=p&&p.lm2;s.old_time=p&&p.uct2;s.old_reason=p&&p.tr;s.old_window=p&&p.tw;var t=[];q.tabs.forEach(function(u){if(!u.fragile||u.server_id){var v={i:u.fragile?c('MercuryIDs').getThreadIDFromThreadFBID(u.server_id):u.id,si:u.server_id};if(u.raised)v.r=1;t.push(v);}});p.t2=t;p.lm2=q.promotedID;p.uct2=q.lastChangeTime;p.tr=q.lastChangeReason;p.tw=c('PresenceUtil').getSessionID();h.debug('store','{}');}else h.warn('store_bad_state','{}');return p;},load:function(p,q){if(!p){h.warn('load_bad_state','{}');return false;}var r=o(p,q);if(!r||r===q.lastChangeTime)return false;q.lastChangeTime=r;q.lastChangeReason='load';var s=m(q,p.t2,p.lm2||null),event='load';if(!q.isInitialized)event+='_init';h.log(event,'{}');return s;},tabsChanged:function(){return n.apply(undefined,arguments);}};function m(p,q,r){var s;if(!n(p,q,r))return false;var t=p.tabs.filter(function(w){return !!w.fragile;}),u={};p.promotedID=null;p.tabs=q.map(function(w){var x={id:w.i,server_id:w.si};if(x.id==r)p.promotedID=x.id;if(w.r)x.raised=true;var y=t.find(function(z){return z.server_id&&z.server_id===x.server_id;});if(y){if(x.raised){y.raised=true;}else delete y.raised;t=t.filter(function(z){return !z.server_id||z.server_id!==x.server_id;});t.push(y);return null;}u[x.id]=x;return x;});p.tabs=p.tabs.filter(function(w){return !!w;});if(p.localRaised)for(var v in p.localRaised)if(!u[v]||!u[v].raised)delete p.localRaised[v];t=t.filter(function(w){return !u[w.id];});(s=p.tabs).push.apply(s,t);return true;}function n(p,q,r){if(r&&r!=p.promotedID)return true;var s=p.tabs.filter(function(v){return !v.fragile||v.server_id;});if(q.length!=s.length)return true;for(var t=0,u=q.length;t<u;t++)if(!!q[t].r!==s[t].raised||!q[t].si&&q[t].i!==s[t].id||q[t].si&&q[t].si!==s[t].server_id)return true;return false;}function o(p,q){var r=c('PresenceState').verifyNumber(p.uct2);if(!r||typeof r!=='number'){h.warn('bad_cookie_version','{}');return null;}if(r<q.lastChangeTime||r<k)return null;return r;}f.exports=l;},null);
__d('ChatTabActions',['ChatDispatcher','keyMirror'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();var h=c('keyMirror')({CLOSE_TAB:null,CLOSE_ALL_TABS:null,CLOSE_FRAGILE_TABS:null,LOWER_TAB:null,OPEN_FRAGILE_TAB:null,OPEN_TAB:null,PERSIST_LOCAL_STATE:null,PROMOTE_TAB:null,RAISE_TAB:null}),i={Types:h,closeTab:function(j,k){c('ChatDispatcher').dispatch({actionType:h.CLOSE_TAB,reason:k,threadID:j});},closeAllTabs:function(){c('ChatDispatcher').dispatch({actionType:h.CLOSE_ALL_TABS});},closeFragileTabs:function(){c('ChatDispatcher').dispatch({actionType:h.CLOSE_FRAGILE_TABS});},lowerTab:function(j){c('ChatDispatcher').dispatch({actionType:h.LOWER_TAB,threadID:j});},openFragileTab:function(j){c('ChatDispatcher').dispatch({actionType:h.OPEN_FRAGILE_TAB,threadID:j});},openTab:function(j){c('ChatDispatcher').dispatch({actionType:h.OPEN_TAB,threadID:j});},persistLocalState:function(){c('ChatDispatcher').dispatch({actionType:h.PERSIST_LOCAL_STATE});},promoteTab:function(j){c('ChatDispatcher').dispatch({actionType:h.PROMOTE_TAB,threadID:j});},raiseTab:function(j,k,l){c('ChatDispatcher').dispatch({actionType:h.RAISE_TAB,signatureID:l,threadID:j,userAction:k});}};f.exports=i;},null);
__d('MercuryTimestampTracker',['MercuryActionType','MercuryPayloadSource','MercurySingletonMixin','MercuryDispatcher'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();function h(i){this._fbid=i;this._dispatcher=c('MercuryDispatcher').getForFBID(this._fbid);this._lastTimestamp=0;this._dispatcher.subscribe('update-messages',function(j,k){if(!k.actions||!k.actions.length)return;if(k.payload_source==c('MercuryPayloadSource').CLIENT_SEND_MESSAGE||k.payload_source==c('MercuryPayloadSource').UNKNOWN)return;for(var l=0;l<k.actions.length;l++){var m=k.actions[l],n=m.action_type;if(n==c('MercuryActionType').USER_GENERATED_MESSAGE&&m.thread_id&&m.timestamp>this._lastTimestamp)this._lastTimestamp=m.timestamp;}}.bind(this));}Object.assign(h.prototype,{getLastUserMessageTimestamp:function(){return this._lastTimestamp;}});Object.assign(h,c('MercurySingletonMixin'));f.exports=h;},null);
__d('ChatTabModel',['Arbiter','ChatBehavior','ChatDispatcher','ChatConfig','ChatCookieInterface','ChatTabActions','EventEmitter','InitialServerTime','LogHistory','JSLogger','MercuryAssert','MercuryIDs','MercuryLocalIDs','MercuryThreadIDMap','MercuryThreads','MercuryTimestampTracker','PresenceState','PresenceUtil'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();var h=c('MercuryThreadIDMap').get(),i=c('MercuryThreads').get(),j=c('MercuryTimestampTracker').get(),k=c('InitialServerTime').serverTime,l=c('ChatConfig').get('tab_max_load_age')||3600000,m=20,n=new (c('EventEmitter'))(),o=c('LogHistory').getInstance('chat_tab_model'),p={tabs:[],promotedID:null,lastChangeTime:0,lastChangeReason:null,isInitialized:false,localRaised:null};function q(ma){var na=c('ChatCookieInterface').load(ma,p);na&&u();return na;}function r(ma,na,oa){var pa=q(c('PresenceState').get());if(na===undefined||na>p.lastChangeTime){if(ma()){pa=true;p.lastChangeReason=oa||null;t(na);}}else o.error('rejected',JSON.stringify({change_time:na,state_time:p.lastChangeTime}));pa&&s();}function s(){if(p.isInitialized)n.emit('change');}function t(ma){if(ma===undefined)ma=Math.max(j.getLastUserMessageTimestamp()||1,p.lastChangeTime+1);p.lastChangeTime=ma;c('PresenceState').doSync();}function u(ma){var na=p.tabs.length-m;if(na>0)p.tabs=p.tabs.filter(function(oa){return oa.raised||oa.id==ma||na--<=0;});if(na>0)p.tabs=p.tabs.filter(function(oa){return (oa.id==p.promotedID||oa.id==ma||na--<=0);});}function v(ma){for(var na=0;na<p.tabs.length;na++)if(p.tabs[na].id==ma)return na;return -1;}function w(ma,na){var oa=i.getThreadMetaNow(ma);if(!oa)return false;if(oa.is_canonical_user){return z(ma,na);}else{var pa=y(ma);if(pa)h.getServerIDFromClientID(ma,function(qa){if(ca(ma,qa)){t();s();}});return pa;}}function x(ma){c('MercuryAssert').isThreadID(ma);if(y(ma))s();}function y(ma){if(v(ma)===-1){p.tabs.push({id:ma,fragile:true});o.log('open_fragile_tab',JSON.stringify({tabs:JSON.stringify(p.tabs),opened:ma,window_id:c('PresenceUtil').getSessionID()}));return true;}return false;}function z(ma,na){var oa=v(ma);if(oa!=-1)if(p.tabs[oa].fragile){p.tabs.splice(oa,1);}else{na&&(p.tabs[oa].signatureID=na);return true;}for(var pa=0;pa<=p.tabs.length;pa++)if(pa==p.tabs.length||p.tabs[pa].fragile){p.tabs.splice(pa,0,{id:ma,signatureID:na});u(ma);o.log('open_tab',JSON.stringify({tabs:JSON.stringify(p.tabs),opened:ma,window_id:c('PresenceUtil').getSessionID()}));return true;}}function aa(ma,na,oa){c('MercuryAssert').isThreadID(ma);var pa=false;if(p.localRaised&&na){p.localRaised[ma]=true;pa=true;}r(function(){if(w(ma,oa))pa=true;var qa=v(ma);if(qa!=-1&&!p.tabs[qa].raised){p.tabs[qa].raised=true;pa=true;o.log('raise_tab',JSON.stringify({tabs:JSON.stringify(p.tabs),raised:ma,window_id:c('PresenceUtil').getSessionID()}));}return pa;});}function ba(ma){if(v(ma)!==-1&&p.promotedID!==ma){p.promotedID=ma;return true;}return false;}function ca(ma,na){var oa=v(ma);if(oa!=-1&&p.tabs[oa].fragile){var pa=p.tabs[oa];pa.fragile=c('MercuryIDs').isLocalThread(ma);pa.server_id=na;var qa=[];p.tabs.forEach(function(ra){if(ra.id!=ma){if(pa&&ra.fragile){qa.push(pa);pa=null;}qa.push(ra);}});if(pa)qa.push(pa);p.tabs=qa;o.log('make_permanent',JSON.stringify({tabs:JSON.stringify(p.tabs),tab_id:ma,window_id:c('PresenceUtil').getSessionID()}));return true;}return false;}function da(ma,na){c('MercuryAssert').isThreadID(ma);var oa=false;if(p.localRaised){delete p.localRaised[ma];oa=true;}r(function(){if(ea(ma))oa=true;return oa;},undefined,na);}function ea(ma){var na=v(ma);if(ma==p.promotedID)p.promotedID=null;if(na!=-1){p.tabs.splice(na,1);o.log('close_tab',JSON.stringify({tabs:JSON.stringify(p.tabs),closed:ma,window_id:c('PresenceUtil').getSessionID()}));return true;}return false;}function fa(){if(p.tabs.length){o.log('close_all_tabs',JSON.stringify({closed_tabs:JSON.stringify(p.tabs),window_id:c('PresenceUtil').getSessionID()}));p.tabs=[];p.promotedID=null;if(p.localRaised)p.localRaised={};t();s();}}function ga(){var ma=[];for(var na=0;na<p.tabs.length;na++)if(p.tabs[na].fragile&&!i.isNewEmptyLocalThread(p.tabs[na].id)){ma.push(p.tabs[na]);p.tabs.splice(na);s();break;}o.log('close_fragile_tabs',JSON.stringify({tabs:JSON.stringify(p.tabs),fragile_closed:ma,window_id:c('PresenceUtil').getSessionID()}));}function ha(ma){c('MercuryAssert').isThreadID(ma);var na=false;if(p.localRaised){delete p.localRaised[ma];na=true;}r(function(){var oa=v(ma);if(oa!=-1&&p.tabs[oa].raised){delete p.tabs[oa].raised;o.log('lower_tab',JSON.stringify({tabs:JSON.stringify(p.tabs),lowered:ma,window_id:c('PresenceUtil').getSessionID()}));na=true;}return na;});}function ia(){if(p.localRaised){r(function(){var ma=false;p.tabs.forEach(function(na){if(na.raised!=p.localRaised[na.id]){ma=true;if(p.localRaised[na.id]){na.raised=true;}else delete na.raised;}});return ma;});o.log('persist_local_raise',JSON.stringify({tabs:JSON.stringify(p.tabs),window_id:c('PresenceUtil').getSessionID()}));}}c('PresenceState').registerStateStorer(function(ma){return c('ChatCookieInterface').store(ma,p);});c('PresenceState').registerStateLoader(function(ma){if(q(ma))s();});var ja=null,ka={getDispatchToken:function(){return ja;},isTabPromoted:function(ma){if(ma)return ma==p.promotedID;return false;},indexOf:function(ma){return v(ma);},getTab:function(ma){c('MercuryAssert').isThreadID(ma);var na=this.indexOf(ma);if(na>-1){var oa=p.tabs[na];return babelHelpers['extends']({},oa);}return null;},getEmptyTab:function(){var ma;for(var na=0;na<p.tabs.length;na++){ma=p.tabs[na].id;if(i.isNewEmptyLocalThread(ma))return ma;}ma=c('MercuryLocalIDs').generateThreadID();i.createNewLocalThread(ma,[]);return ma;},get:function(){var ma=p.tabs.map(function(na){var oa=babelHelpers['extends']({},na);delete oa.fragile;if(p.localRaised)oa.raised=p.localRaised[oa.id];return oa;});return {tabs:ma,promoted:p.promotedID};},promoteThreadInPlaceOfThread:function(ma,na,oa,pa){c('MercuryAssert').isThreadID(ma);c('MercuryAssert').isThreadID(na);r(function(){var qa=v(ma),ra=v(na);if(pa){p.promotedID=ma;}else if(p.promotedID===na)return true;var sa=p.tabs[qa];if(oa){c('MercuryAssert').isThreadID(oa);var ta=v(oa),ua=p.tabs[ra];p.tabs[ra]=sa;p.tabs.splice(qa,1);p.tabs.splice(ta,0,ua);}else{p.tabs[qa]=p.tabs[ra];p.tabs[ra]=sa;}return true;});},addListener:function(ma){return n.addListener('change',ma);}};c('Arbiter').subscribe(c('JSLogger').DUMP_EVENT,function(ma,na){na.chat_tabs={promoted:p.promotedID,tabs:p.tabs.map(function(oa){return babelHelpers['extends']({},oa);}),time:p.lastChangeTime,max_load_age:l};});function la(){var ma=c('ChatBehavior').ignoresRemoteTabRaise();if(ma&&!p.localRaised){o.log('start_ignore_remote_raise','{}');p.localRaised={};s();}else if(!ma&&p.localRaised){o.log('stop_ignore_remote_raise','{}');p.localRaised=null;s();}}ja=c('ChatDispatcher').register(function(ma){switch(ma.actionType){case c('ChatTabActions').Types.CLOSE_TAB:da(ma.threadID,ma.reason);break;case c('ChatTabActions').Types.CLOSE_ALL_TABS:fa();break;case c('ChatTabActions').Types.CLOSE_FRAGILE_TABS:ga();break;case c('ChatTabActions').Types.LOWER_TAB:ha(ma.threadID);break;case c('ChatTabActions').Types.OPEN_FRAGILE_TAB:x(ma.threadID);break;case c('ChatTabActions').Types.OPEN_TAB:c('MercuryAssert').isThreadID(ma.threadID);r(function(){return w(ma.threadID);});break;case c('ChatTabActions').Types.PERSIST_LOCAL_STATE:ia();break;case c('ChatTabActions').Types.PROMOTE_TAB:c('MercuryAssert').isThreadID(ma.threadID);r(ba.bind(null,ma.threadID));break;case c('ChatTabActions').Types.RAISE_TAB:aa(ma.threadID,ma.userAction,ma.signatureID);break;}});c('ChatBehavior').subscribe(c('ChatBehavior').ON_CHANGED,la);la();q(c('PresenceState').getInitial(),true);if(p.lastChangeTime===0)p.lastChangeTime=k-600000;p.isInitialized=true;f.exports=ka;},null);
__d('ChatTabViewInstances',['Map'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();f.exports=new (c('Map'))();},null);
__d('MercuryMessages',['invariant','BanzaiODS','ChatReliabilityInstrumentation','EventEmitter','ImmutableObject','LogHistory','Map','MercuryActionStatus','MercuryActionType','MercuryAssert','MercuryDispatcher','MercuryLogMessageType','MercuryMessageClientState','MercuryPayloadSource','MercurySingletonProvider','MercuryMessageActions','MercuryMessageIDs','MessagingGiftWrapConstants','RangedCallbackManager','MercurySendMessageFields','MercuryServerRequests','MercuryThreadActions','MercuryThreadInformer','MercuryThreads','URI','isMessengerDotComURI','setImmediate'],function a(b,c,d,e,f,g,h){'use strict';if(c.__markCompiled)c.__markCompiled();var i=new (c('EventEmitter'))(),j=c('LogHistory').getInstance('mercury_messages');function k(p){switch(p){case c('MercuryPayloadSource').UNKNOWN:case c('MercuryPayloadSource').SERVER_INITIAL_DATA:case c('MercuryPayloadSource').SERVER_FETCH_THREAD_INFO:case c('MercuryPayloadSource').SERVER_THREAD_SYNC:return true;}return false;}l.getForFBID=function(p){return o.getForFBID(p);};l.get=function(){return o.get();};function l(p){this.$MercuryMessages1=p;this.$MercuryMessages2=c('MercuryMessageActions').getForFBID(this.$MercuryMessages1);this.$MercuryMessages3=c('MercuryServerRequests').getForFBID(this.$MercuryMessages1);this.$MercuryMessages4=c('MercuryThreadInformer').getForFBID(this.$MercuryMessages1);this.$MercuryMessages5=c('MercuryThreads').getForFBID(this.$MercuryMessages1);this.$MercuryMessages6=c('MercuryThreadActions').getForFBID(this.$MercuryMessages1);this.$MercuryMessages7=c('MercuryDispatcher').getForFBID(this.$MercuryMessages1);this.$MercuryMessages8=false;this.$MercuryMessages9={};this.$MercuryMessages10={};this.$MercuryMessages11={};this.$MercuryMessages12=new (c('Map'))();this.$MercuryMessages13={};this.$MercuryMessages14={};this.$MercuryMessages7.subscribe('update-messages',function(q,r){var s=(r.actions||[]).filter(function(u){var v=u.action_type,w=(u.is_forward||u.thread_id)&&(v==c('MercuryActionType').LOG_MESSAGE||v==c('MercuryActionType').USER_GENERATED_MESSAGE||v==c('MercuryActionType').SEND_MESSAGE||v==c('MercuryActionType').DELETE_THREAD||v==c('MercuryActionType').DELETE_MESSAGES),x=u.upload_id&&u.upload_data&&(v==c('MercuryActionType').CANCEL_ATTACHMENT_PLACEHOLDER||v==c('MercuryActionType').CONFIRM_ATTACHMENT_PLACEHOLDER),y=u.note&&v==c('MercuryActionType').CREATE_PAGE_ADMIN_NOTE,z=u.replaced_message_id&&v==c('MercuryActionType').REPLACE_MESSAGE,aa=u.unwrapped_message_id&&v==c('MercuryActionType').UNWRAP_MESSAGE;return w||x||y||z||aa;}),t=k(r.payload_source);this.handleUpdates(s,t,r.payload_source,r.from_client);if(r.end_of_history)this.$MercuryMessages15(r.end_of_history,r.payload_source);if(this.$MercuryMessages8){this.$MercuryMessages8=false;i.emit('change');}}.bind(this));this.$MercuryMessages7.subscribe('invalidate-thread-state',function(q,r){this.$MercuryMessages16(r);}.bind(this));this.$MercuryMessages7.subscribe('invalidate-global-state',function(){return this.invalidateGlobalState();}.bind(this));j.debug('constructed',JSON.stringify({fbid:this.$MercuryMessages1}));}l.prototype.getMessagesFromIDs=function(p){return (p||[]).map(function(q){return this.$MercuryMessages17(q);}.bind(this)).filter(function(q){return q;});};l.prototype.getServerMessageID=function(p){var q=p;if(this.$MercuryMessages13[p])q=this.$MercuryMessages13[p];return q;};l.prototype.hasLoadedNMessages=function(p,q){var r=this.$MercuryMessages18(p);return r.hasReachedEndOfArray()||r.getCurrentArraySize()>=q;};l.prototype.hasLoadedExactlyNMessages=function(p,q){var r=this.$MercuryMessages18(p);return r.getCurrentArraySize()==q;};l.prototype.invalidateGlobalState=function(){var p=Object.keys(this.$MercuryMessages10);this.$MercuryMessages9={};this.$MercuryMessages10={};this.$MercuryMessages11={};this.$MercuryMessages12=new (c('Map'))();this.$MercuryMessages13={};p.map(function(q){return this.$MercuryMessages4.invalidatedThread(q);}.bind(this));};l.prototype.getThreadMessagesRange=function(p,q,r,s,t,u){var v=this.$MercuryMessages18(p),w=function(ga){s(this.$MercuryMessages19(ga));}.bind(this),x=v.executeOrEnqueue(q,r,w),y=v.getUnavailableResources(x),z=this.$MercuryMessages9[p];if(y.length&&!z){var aa=v.getCurrentArraySize(),ba=this.$MercuryMessages11[p]||0,ca=aa-ba,da=y.length+ba,ea=this.getCurrentlyLoadedMessages(p),fa=ea.length?ea[0].timestamp:null;j.debug('fetch_missing_messages',JSON.stringify({threadID:p,offset:q,limit:r,timestamp:fa,missingIndices:y,messageCount:aa,localMessageCount:ba}));this.$MercuryMessages3.fetchThreadMessages(p,ca,da,fa,t,u);}else this.$MercuryMessages9[p]=false;return x;};l.prototype.getThreadMessagesRangeNow=function(p,q,r){var s=this.$MercuryMessages18(p),t=[];for(var u=q;u<q+r;u++){var v=s.getResourceAtIndex(u),w=v&&this.$MercuryMessages17(v);w&&t.push(w);}return t;};l.prototype.getThreadMessagesSinceTimestamp=function(p,q){var r=this.$MercuryMessages18(p),s=r.getElementsUntil(q);return this.$MercuryMessages19(s);};l.prototype.hasLoadedAllMessages=function(p){return this.$MercuryMessages18(p).hasReachedEndOfArray();};l.prototype.getCurrentlyLoadedMessages=function(p){var q=this.$MercuryMessages18(p).getAllResources();return this.$MercuryMessages19(q);};l.prototype.unsubscribe=function(p,q){c('MercuryAssert').isThreadID(q);var r=this.$MercuryMessages18(q);r.unsubscribe(p);};l.prototype.$MercuryMessages20=function(p,q){n(q);this.$MercuryMessages12.set(p,new (c('ImmutableObject'))(q));};l.prototype.$MercuryMessages21=function(p,q){var r=this.$MercuryMessages12.get(p);if(r){var s=r.page_admin_notes?r.page_admin_notes.slice():[],t=false,u=true;for(var v=0;v<s.length;++v)if(s[v].id===q.id){t=true;u=false;break;}else if((s[v].id===null||s[v].id===undefined)&&s[v].body===q.body){t=true;s[v]=q;}if(!t)s.push(q);if(u){var w={};w.page_admin_notes=s;this.$MercuryMessages22(p,r,w);}}};l.prototype.$MercuryMessages22=function(p,q,r){var s=c('ImmutableObject').set(q,r);this.$MercuryMessages12.set(p,s);return s;};l.prototype.$MercuryMessages23=function(p,q,r){if(p==c('MercuryPayloadSource').CLIENT_CHANNEL_MESSAGE){var s=this.getThreadMessagesSinceTimestamp(q,r);if(s.length>0){c('BanzaiODS').bumpEntityKey('chat.web','channel.messages_reordered');return true;}}else if(p===c('MercuryPayloadSource').SERVER_INVALIDATE_THREAD_STATE||p===c('MercuryPayloadSource').SERVER_INVALIDATE_GLOBAL_STATE)return true;return false;};l.prototype.$MercuryMessages24=function(p,q){var r=p.action_type;if(q==c('MercuryPayloadSource').CLIENT_CHANNEL_MESSAGE&&r==c('MercuryActionType').USER_GENERATED_MESSAGE&&p.offline_threading_id&&this.$MercuryMessages13[p.offline_threading_id]===p.offline_threading_id){p.client_message_id=p.offline_threading_id;p.status=c('MercuryActionStatus').SUCCESS;p.action_type=c('MercuryActionType').SEND_MESSAGE;r=p.action_type;}if(q===c('MercuryPayloadSource').CLIENT_CHANNEL_MESSAGE&&r==c('MercuryActionType').USER_GENERATED_MESSAGE){var s=this.$MercuryMessages5.getThreadMetaNow(p.thread_id);if(s&&s.folder)p.folder=s.folder;c('ChatReliabilityInstrumentation').logMESSAGE_RECEIVED();}return p;};l.prototype.handleUpdates=function(p,q,r,s){var t,u={};for(var v=0;v<p.length;v++){var w=this.$MercuryMessages24(p[v],r),x=w.action_type,y=this.$MercuryMessages17(w.message_id);if(x==c('MercuryActionType').LOG_MESSAGE)if(this.isLocalMessage(w))continue;if(w.is_forward||r==c('MercuryPayloadSource').SERVER_SEARCH){if(!this.$MercuryMessages12.has(w.message_id))this.$MercuryMessages20(w.message_id,w);continue;}else if(w.client_state===c('MercuryMessageClientState').SEND_TO_SERVER){this.$MercuryMessages20(w.message_id,w);continue;}else if(x==c('MercuryActionType').SEND_MESSAGE){var z=w.client_message_id,aa=this.$MercuryMessages17(z);if(z&&aa&&w.status){var ba=aa.status;if(aa.status==c('MercuryActionStatus').SUCCESS)continue;if(!u[w.thread_id])u[w.thread_id]=[];this.$MercuryMessages25(w);if(typeof ba!==undefined||w.status==c('MercuryActionStatus').FAILED_UNKNOWN_REASON||w.status==c('MercuryActionStatus').UNABLE_TO_CONFIRM||w.status==c('MercuryActionStatus').SUCCESS||w.status==c('MercuryActionStatus').ERROR){var ca=this.$MercuryMessages17(z);if(ca)this.$MercuryMessages26(w.thread_id,ca.message_id,r);}}continue;}else if(x==c('MercuryActionType').DELETE_THREAD){this.$MercuryMessages18(w.thread_id).removeAllResources();continue;}else if(x==c('MercuryActionType').DELETE_MESSAGES){this.$MercuryMessages27(w.thread_id,w.message_ids,r);c('setImmediate')(function(){this.$MercuryMessages6.updateSnippet(w.thread_id,w.message_ids);}.bind(this));continue;}else if(x==c('MercuryActionType').CREATE_PAGE_ADMIN_NOTE){this.$MercuryMessages21(w.message_id,w.note);this.$MercuryMessages26(w.thread_id,w.message_id,'link_shim');continue;}else if(w.offline_threading_id&&this.$MercuryMessages13[w.offline_threading_id]&&(r!=c('MercuryPayloadSource').SERVER_FETCH_THREAD_INFO||this.$MercuryMessages13[w.offline_threading_id]===w.message_id)||y&&!y.is_forward){if(y&&w.ranges&&w.ranges.length>0){var da=y.message_id;this.$MercuryMessages22(this.$MercuryMessages13[da]||da,y,{ranges:w.ranges});this.$MercuryMessages26(y.thread_id,y.message_id,'link_shim');}continue;}else if(x===c('MercuryActionType').CONFIRM_ATTACHMENT_PLACEHOLDER){this.$MercuryMessages28(w.upload_id,w.upload_data);continue;}else if(x===c('MercuryActionType').CANCEL_ATTACHMENT_PLACEHOLDER){this.$MercuryMessages29(w.upload_id,w.upload_data);continue;}else if(x==c('MercuryActionType').REPLACE_MESSAGE){if(this.$MercuryMessages30(w)){if(!u[w.thread_id])u[w.thread_id]=[];u[w.thread_id].push(w.message_id);this.$MercuryMessages26(w.thread_id,w.replaced_message_id,r);this.$MercuryMessages26(w.thread_id,w.message_id,r);q=true;}continue;}else if(x==c('MercuryActionType').UNWRAP_MESSAGE){if(this.$MercuryMessages31(w))this.$MercuryMessages26(w.thread_id,w.unwrapped_message_id,r);}else{if(r===c('MercuryPayloadSource').CLIENT_SEND_MESSAGE){this.$MercuryMessages13[w.message_id]=w.message_id;if(w.thread_id=='root:'+w.offline_threading_id)this.$MercuryMessages18(w.thread_id).setReachedEndOfArray();}if(x==c('MercuryActionType').LOG_MESSAGE&&w.log_message_type==c('MercuryLogMessageType').SERVER_ERROR)this.$MercuryMessages9[w.thread_id]=true;if(w.client_state===c('MercuryMessageClientState').DO_NOT_SEND_TO_SERVER&&w.upload_id)this.$MercuryMessages14[w.upload_id]=w;if(!u[w.thread_id])u[w.thread_id]=[];u[w.thread_id].push(w.message_id);this.$MercuryMessages20(w.message_id,w);if(w.offline_threading_id&&w.offline_threading_id!=w.message_id){this.$MercuryMessages13[w.offline_threading_id]=w.message_id;c('MercuryMessageIDs').addServerID(w.offline_threading_id,w.message_id);if(w.threading_id)c('MercuryMessageIDs').addServerID(w.threading_id,w.message_id);}if(w[c('MercurySendMessageFields').MANUAL_RETRY_CNT]>0){t=this.$MercuryMessages18(w.thread_id);t.resortResources([w.message_id]);this.$MercuryMessages32(w.thread_id,c('MercuryPayloadSource').CLIENT_SEND_MESSAGE);}q=q||this.$MercuryMessages23(r,w.thread_id,w.timestamp);if(!q){var ea=this.$MercuryMessages17(w.message_id);if(ea)this.$MercuryMessages33(ea);}continue;}}for(var fa in u){t=this.$MercuryMessages18(fa);var ga=t.getAllResources(),ha=ga.filter(function(ia){var ja=this.$MercuryMessages12.get(ia);if(!ja)return true;return ja.action_type==c('MercuryActionType').LOG_MESSAGE&&ja.log_message_type==c('MercuryLogMessageType').SERVER_ERROR;}.bind(this));t.removeResources(ha);if(s)this.$MercuryMessages34(fa,u[fa]);if(q){t.addResources(u[fa]);this.$MercuryMessages32(fa,r);}else t.addResourcesWithoutSorting(u[fa].reverse(),0);this.$MercuryMessages4.updatedThread(fa);}this.$MercuryMessages8&&j.debug('handle_updates',JSON.stringify({localMessageCounts:this.$MercuryMessages11}));};l.prototype.isFirstMessage=function(p){var q=this.$MercuryMessages18(p.thread_id);if(q.getCurrentArraySize()===0)return false;var r=q.getResourceAtIndex(q.getCurrentArraySize()-1),s=this.$MercuryMessages17(r),t=s&&s.message_id,u=this.$MercuryMessages17(p.message_id),v=u&&u.message_id;if(!t||!v)return false;return q.hasReachedEndOfArray()&&t==v;};l.prototype.isLocalMessage=function(p){if(p.offline_threading_id!==null&&p.offline_threading_id===p.message_id)return true;return false;};l.prototype.$MercuryMessages27=function(p,q,r){if(!q.length)return;this.$MercuryMessages35(p,q,r);if(r!==c('MercuryPayloadSource').CLIENT_CHANNEL_MESSAGE)this.$MercuryMessages3.deleteMessages(p,q);};l.prototype.$MercuryMessages35=function(p,q,r){var s=q.map(function(u){return this.$MercuryMessages17(u).message_id;},this),t=this.$MercuryMessages18(p);t.removeResources(s);this.$MercuryMessages32(p,r);};l.prototype.$MercuryMessages25=function(p){var q=p.client_message_id;if(!q)return false;var r=this.$MercuryMessages17(q);if(!r)return false;var s={};s.status=p.status;if(p.status===c('MercuryActionStatus').SUCCESS||p.error_data)s.error_data=p.error_data;var t=p.message_id;if(this.$MercuryMessages12.has(t)){if(r)this.$MercuryMessages22(t,r,s);return false;}if(p.threading_id)s.threading_id=p.threading_id;if(p.timestamp)s.timestamp=p.timestamp;if(p.log_message_data)s.log_message_data=p.log_message_data;if(p.ranges&&p.ranges.length){n(p);s.ranges=p.ranges;}if(p.attachments&&p.attachments.length){s.raw_attachments=null;s.attachments=p.attachments;}this.$MercuryMessages13[q]=t;c('MercuryMessageIDs').addServerID(q,t);if(r){var u=this.$MercuryMessages22(t,r,s);this.$MercuryMessages12.set(q,new (c('ImmutableObject'))());if(m(u))this.$MercuryMessages11[u.thread_id]--;}return true;};l.prototype.$MercuryMessages30=function(p){var q=p.replaced_message_id;if(!q)return false;var r=this.$MercuryMessages17(q);if(!r)return false;var s={};s.status=p.status;if(p.timestamp)s.timestamp=p.timestamp;if(p.log_message_data)s.log_message_data=p.log_message_data;if(p.ranges&&p.ranges.length){n(p);s.ranges=p.ranges;}if(p.attachments&&p.attachments.length){s.raw_attachments=null;s.attachments=p.attachments;}if(p.body)s.body=p.body;var t=p.message_id;c('MercuryMessageIDs').addServerID(t,t);this.$MercuryMessages22(t,r,s);this.$MercuryMessages12['delete'](q);return true;};l.prototype.$MercuryMessages31=function(p){var q=this.$MercuryMessages17(p.unwrapped_message_id);if(!q||!q.tags)return false;var r=q.tags.slice(0);r.push(c('MessagingGiftWrapConstants').UNWRAPPED_TAG);var s={tags:r};this.$MercuryMessages22(p.unwrapped_message_id,q,s);return true;};l.prototype.getNumberLocalMessages=function(p){return this.$MercuryMessages11[p]||0;};l.prototype.$MercuryMessages28=function(p,q){var r=this.$MercuryMessages36(p,q);delete r.preview_attachments;this.$MercuryMessages3.sendNewMessage(r);};l.prototype.$MercuryMessages29=function(p,q){var r=this.$MercuryMessages36(p,q);this.$MercuryMessages35(r.thread_id,[r.message_id]);if(this.$MercuryMessages11[r.thread_id])this.$MercuryMessages11[r.thread_id]--;};l.prototype.$MercuryMessages36=function(p,q){var r=this.$MercuryMessages14[p];!r?h(0):void 0;r.image_ids=q.image_ids;r.file_ids=q.file_ids;r.audio_ids=q.audio_ids;r.gif_ids=q.gif_ids;r.video_ids=q.video_ids;r.client_state=c('MercuryMessageClientState').SEND_TO_SERVER;delete this.$MercuryMessages14[p];return r;};l.prototype.$MercuryMessages26=function(p,q,r){this.$MercuryMessages8=true;this.$MercuryMessages4.updatedMessage(p,q,r);};l.prototype.$MercuryMessages33=function(p){this.$MercuryMessages8=true;this.$MercuryMessages4.receivedMessage(p);};l.prototype.$MercuryMessages32=function(p,q){this.$MercuryMessages8=true;this.$MercuryMessages4.reorderedMessages(p,q);};l.prototype.$MercuryMessages16=function(p){if(!this.$MercuryMessages10[p])return;var q=this.$MercuryMessages10[p].getAllResources();q.forEach(function(r){var s=this.$MercuryMessages17(r),t=undefined;if(s)t=s.offline_threading_id;this.$MercuryMessages12['delete'](r);if(t){var u=this.$MercuryMessages13[t];if(u)this.$MercuryMessages12['delete'](u);delete this.$MercuryMessages13[t];}delete this.$MercuryMessages13[r];}.bind(this));delete this.$MercuryMessages10[p];};l.addListener=function(p,q){return i.addListener(p,q);};l.prototype.$MercuryMessages17=function(p){var q=p;if(this.$MercuryMessages13[p])q=this.$MercuryMessages13[p];return this.$MercuryMessages12.get(q);};l.prototype.$MercuryMessages18=function(p){if(!this.$MercuryMessages10[p])this.$MercuryMessages10[p]=new (c('RangedCallbackManager'))(function(q){var r=this.$MercuryMessages17(q);return r&&r.timestamp;}.bind(this),function(q,r){return r-q;});return this.$MercuryMessages10[p];};l.prototype.$MercuryMessages15=function(p,q){p.forEach(function(r){var s=this.$MercuryMessages18(r);s.setReachedEndOfArray();this.$MercuryMessages32(r,q);}.bind(this));};l.prototype.$MercuryMessages19=function(p){var q=p.map(function(r){return this.$MercuryMessages17(r);}.bind(this));return q.reverse();};l.prototype.$MercuryMessages34=function(p,q){var r=q.filter(function(s){return (m(this.$MercuryMessages17(s)));}.bind(this));if(!this.$MercuryMessages11[p])this.$MercuryMessages11[p]=0;this.$MercuryMessages11[p]+=r.length;};function m(p){var q=p.action_type;if(q==c('MercuryActionType').USER_GENERATED_MESSAGE)return true;switch(p.log_message_type){case c('MercuryLogMessageType').SUBSCRIBE:case c('MercuryLogMessageType').UNSUBSCRIBE:case c('MercuryLogMessageType').SERVER_ERROR:case c('MercuryLogMessageType').LIVE_LISTEN:return false;default:return true;}}function n(p){if(!p.ranges)return;p.ranges.forEach(function(q){if(!q.entity||q.entity.external||!q.entity.url)return;var r=new (c('URI'))(q.entity.url);if(c('isMessengerDotComURI')(c('URI').getRequestURI())&&!r.getDomain()){r.setProtocol('https').setDomain('www.facebook.com');q.entity.url=r.toString();}});}var o=new (c('MercurySingletonProvider'))(l);f.exports=l;},null);
__d('MercuryNotificationRenderer',['fbt','MercuryAssert','MercuryIDs','MercuryMessages','MercuryParticipants','MercuryThreads','MercuryViewer'],function a(b,c,d,e,f,g,h){if(c.__markCompiled)c.__markCompiled();var i=c('MercuryMessages').get(),j=c('MercuryThreads').get();function k(l,m){c('MercuryAssert').isThreadID(l);j.getThreadMeta(l,function(n){i.getThreadMessagesRange(l,0,1,function(o){var p=o.length&&o[o.length-1];if(p&&p.author!=c('MercuryViewer').getID()){c('MercuryParticipants').get(p.author,function(q){var r=q.short_name;if(n.custom_nickname){var s=c('MercuryIDs').getUserIDFromParticipantID(q.id);if(n.custom_nickname[s])r=n.custom_nickname[s];}if(n.name){m(h._("{senderName} messaged {groupName}",[h.param('senderName',r),h.param('groupName',n.name)]));}else if(c('MercuryIDs').isGroupChat(l)){m(h._("{name} messaged your group",[h.param('name',r)]));}else m(h._("{name} messaged you",[h.param('name',r)]));});}else m(h._("New message!"));});});}f.exports={renderDocumentTitle:k};},null);
__d('ChatTitleBarBlinker',['ChatActivity','ChatConfig','DocumentTitle','JSLogger','MercuryThreadInformer','MercuryNotificationRenderer','PresenceState','MercuryTimestampTracker'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();var h=c('MercuryThreadInformer').get(),i=c('MercuryTimestampTracker').get(),j=c('JSLogger').create('chat_title'),k=null,l=0,m=false;function n(){if(k){k.stop();k=null;return true;}return false;}function o(t){var u=t||i.getLastUserMessageTimestamp();if(l<=u){l=u;if(n()||m)c('PresenceState').doSync();}}var p={blink:function(t,u){if(!k&&l<u)c('MercuryNotificationRenderer').renderDocumentTitle(t,function(v){if(!k)k=c('DocumentTitle').blink(v);});},stopBlinking:function(){o();},blinkingElsewhere:function(){m=true;}};function q(t){var u=c('PresenceState').verifyNumber(t.sb2);if(!u||u<=l)return null;return u;}function r(t){var u=t&&q(t);if(u){l=u;j.debug('load',l);n();m=false;}}function s(t){var u=q(t);if(!u){j.debug('store',l);t.sb2=l;m=false;}return t;}c('PresenceState').registerStateStorer(s);c('PresenceState').registerStateLoader(r);h.subscribe('thread-read-changed',function(t,u){var v=i.getLastUserMessageTimestamp(),w=0;for(var x in u)if(u[x].mark_as_read&&u[x].timestamp>=v&&u[x].timestamp>w)w=u[x].timestamp;w&&o(w);});c('ChatActivity').subscribe('activity',function(){o();});(function(){var t=c('PresenceState').getInitial();if(t)l=q(t)||0;})();f.exports=p;},null);
__d('MercuryBlockedParticipants',['MercuryIDs','MercuryActionType','MercuryDispatcher','MercurySingletonProvider','Set'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();h.getForFBID=function(j){return i.getForFBID(j);};h.get=function(){return i.get();};function h(j){this.$MercuryBlockedParticipants1=j;this.$MercuryBlockedParticipants2=new (c('Set'))();this.$MercuryBlockedParticipants3=c('MercuryDispatcher').getForFBID(this.$MercuryBlockedParticipants1);this.$MercuryBlockedParticipants3.subscribe('update-blocked-users',function(k,l){if(l.message_blocked_ids)this.$MercuryBlockedParticipants2=new (c('Set'))(l.message_blocked_ids);var m=l.actions||l.global_actions;for(var n=m,o=Array.isArray(n),p=0,n=o?n:n[typeof Symbol==='function'?Symbol.iterator:'@@iterator']();;){var q;if(o){if(p>=n.length)break;q=n[p++];}else{p=n.next();if(p.done)break;q=p.value;}var r=q;if(r.action_type!==c('MercuryActionType').UPDATE_BLOCKER_STATUS)continue;if(r.message_blocked){this.$MercuryBlockedParticipants4(r.thread_fbid);}else this.$MercuryBlockedParticipants5(r.thread_fbid);}}.bind(this));}h.prototype.getFBID=function(){return this.$MercuryBlockedParticipants1;};h.prototype.setIDs=function(j){this.$MercuryBlockedParticipants2=j;};h.prototype.getIDs=function(){return this.$MercuryBlockedParticipants6();};h.prototype.$MercuryBlockedParticipants6=function(){return this.$MercuryBlockedParticipants2;};h.prototype.$MercuryBlockedParticipants4=function(j){this.$MercuryBlockedParticipants2.add(c('MercuryIDs').getParticipantIDFromUserID(j));};h.prototype.$MercuryBlockedParticipants5=function(j){this.$MercuryBlockedParticipants2['delete'](c('MercuryIDs').getParticipantIDFromUserID(j));};h.prototype.isMessageBlocked=function(j){if(!j.is_canonical)return false;var k=j.participants.filter(function(l){return l!=c('MercuryIDs').getParticipantIDFromUserID(this.getFBID());}.bind(this));return !k.every(function(l){return !this.$MercuryBlockedParticipants2.has(l);}.bind(this));};h.prototype.isPresentInGroupThread=function(j){if(!j.is_canonical&&this.$MercuryBlockedParticipants7(j).length>0)return true;return false;};h.prototype.inGroupThread=function(j){if(j.is_canonical)return [];return this.$MercuryBlockedParticipants7(j);};h.prototype.$MercuryBlockedParticipants7=function(j){var k=j.participants.filter(function(m){return m!=c('MercuryIDs').getParticipantIDFromUserID(this.getFBID());}.bind(this)),l=k.filter(function(m){return this.$MercuryBlockedParticipants2.has(m)!==false;}.bind(this));return l;};var i=new (c('MercurySingletonProvider'))(h);f.exports=h;},null);
__d('MercuryGroupThreadMentions',['CurrentUser','ShortProfiles'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();var h={messageMentionsViewer:function(i,j){c('ShortProfiles').get(c('CurrentUser').getID(),function(k){j(new RegExp('@'+k.firstName,'i').test(i.body));});}};f.exports=h;},null);
__d('SoundPlayer',['Arbiter','Flash','URI','createArrayFromMixed'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();var h={},i=null,j=false,k='so_sound_player',l='/swf/cigars/SoundPlayer.swf?v=1',m=null,n={};function o(y){var z=new (c('URI'))(y);if(!z.getDomain())return new (c('URI'))(window.location.href).setPath(z.getPath()).toString();return y;}function p(y){var z=new (c('URI'))(y).getPath();if(/\.mp3$/.test(z))return 'audio/mpeg';if(/\.og[ga]$/.test(z))return 'audio/ogg';return '';}function q(){if(!m){var y=document.createElement('audio');if(!y||!y.canPlayType)return null;y.setAttribute('preload','auto');document.body.appendChild(y);m=y;}return m;}function r(y){return n[y];}function s(y,z){n[y]=z;}function t(){var y=document[k]||window[k];if(y)if(!y.playSound&&y.length)y=y[0];return y&&y.playSound&&y.loopSound?y:null;}function u(){return j;}function v(y,z,aa){i={path:y,sync:z,loop:aa};}function w(){j=true;if(i){var y=t();if(i.loop){y.loopSound(i.path,i.sync);}else y.playSound(i.path,i.sync);}}var x={init:function(y){y=c('createArrayFromMixed')(y);var z;for(var aa=0;aa<y.length;++aa){z=y[aa];if(h[z])return;}var ba=q();for(aa=0;ba&&aa<y.length;++aa){z=y[aa];if(ba.canPlayType(z)){h[z]=true;return;}}h['audio/mpeg']=true;if(t())return;try{c('Arbiter').registerCallback(w,['sound/player_ready','sound/ready']);var da=document.createElement('div');da.id='sound_player_holder';document.body.appendChild(da);var ea=window[k]=c('Flash').embed(l,da,{allowscriptaccess:'always',wmode:'transparent'},{swf_id:k});ea.setAttribute('id',k);ea.setAttribute('width','1px');ea.setAttribute('height','1px');c('Arbiter').inform('sound/player_ready');}catch(ca){}},createAndPlayNewNative:function(y,z){var aa=document.createElement('audio');aa.setAttribute('preload','auto');document.body.appendChild(aa);aa.src=o(y);if(z){aa.setAttribute('loop','');}else aa.removeAttribute('loop');aa.play();s(y,aa);return;},play:function(y,z){y=c('createArrayFromMixed')(y);var aa=q(),ba,ca;for(var da=0;aa&&da<y.length;++da){ba=y[da];var ea=r(ba);if(ea){if(z){ea.setAttribute('loop','');}else ea.removeAttribute('loop');ea.play();return;}ca=p(ba);if(!aa.canPlayType(ca))continue;x.init([ca]);x.createAndPlayNewNative(ba,z);return;}for(da=0;da<y.length;++da){ba=o(y[da]);ca=p(ba);if(ca!='audio/mpeg')continue;x.init([ca]);var fa=t();if(!u()){v(ba,true,z);return;}else if(fa){if(z){fa.loopSound(ba,true);}else fa.playSound(ba,true);return;}}},stop:function(y){y=c('createArrayFromMixed')(y);for(var z=0;z<y.length;++z){var aa=o(y[z]),ba=r(y[z]),ca=t();if(ba&&ba.src==aa){ba.pause();ba.removeAttribute('src');ba.src=aa;}else ca&&ca.stopSound(aa);}}};f.exports=x;},null);
__d('SoundSynchronizer',['SoundPlayer','WebStorage','createArrayFromMixed'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();var h='fb_sounds_playing3';function i(){var m=c('WebStorage').getLocalStorage();if(m)try{var o=m[h];if(o){o=JSON.parse(o);if(Array.isArray(o))return o;}}catch(n){}return [];}function j(m){var n=c('WebStorage').getLocalStorage();if(n){var o=i();o.push(m);while(o.length>5)o.shift();try{n[h]=JSON.stringify(o);}catch(p){}}}function k(m){return i().some(function(n){return n===m;});}var l={play:function(m,n,o){m=c('createArrayFromMixed')(m);n=n||m[0]+Math.floor(Date.now()/1000);if(k(n))return;c('SoundPlayer').play(m,o);j(n);},isSupported:function(){return !!c('WebStorage').getLocalStorage();}};f.exports=l;},null);
__d('SoundRPC',['Event','FBJSON','SoundSynchronizer'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();function h(j,k,l){c('SoundSynchronizer').play(j,k,l);}var i={playLocal:h,playRemote:function(j,k,l,m){var n={name:'SoundRPC',data:{paths:k,sync:l,loop:m}};j.postMessage(c('FBJSON').stringify(n),'*');},supportsRPC:function(){return !!window.postMessage;},_listen:function(){c('Event').listen(window,'message',function(j){if(!/\.facebook.com$/.test(j.origin))return;var k={};try{k=c('FBJSON').parse(j.data);}catch(l){}if(k.name==='SoundRPC')h(k.data.paths,k.data.sync,k.data.loop);});}};f.exports=i;},null);
__d('Sound',['SoundInitialData','SoundPlayer','SoundRPC','SoundSynchronizer','URI','UserAgent_DEPRECATED','Visibility','isFacebookURI'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();var h=null,i=false,j={init:function(n){if(!h)c('SoundPlayer').init(n);},play:function(n,o,p){if(h){c('SoundRPC').playRemote(h.contentWindow,n,o,false);}else c('SoundRPC').playLocal(n,o,p);i=true;},hasPlayedSoundBefore:function(){return i;},playOnlyIfImmediate:function(n,o,p){if(!i&&c('Visibility').isHidden())return;this.play(n,o,p);},stop:function(n){if(!h)c('SoundPlayer').stop(n);}},k=new (c('URI'))(location.href);if(k.getSubdomain()&&k.getSubdomain()!=='www')k.setSubdomain('www');var l=k.getDomain();function m(){if(c('UserAgent_DEPRECATED').ie()<9)return false;if(c('SoundInitialData').RPC_DISABLED)return false;return c('SoundSynchronizer').isSupported()&&c('SoundRPC').supportsRPC();}if(c('isFacebookURI')(k)&&location.host!==l&&m()){h=document.createElement('iframe');h.setAttribute('src','//'+l+'/sound_iframe.php');h.style.display='none';document.body.appendChild(h);}f.exports=j;},null);
__d('MercuryBrowserAlerts',['ArbiterMixin','ChatActivity','ChatConfig','ChatOptions','ChatTitleBarBlinker','MercuryBlockedParticipants','MercuryConfig','MercuryGroupThreadMentions','MercuryThreadInfo','MercuryThreads','MercuryViewer','MessagingTag','Sound','UserActivity'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();var h=c('MercuryBlockedParticipants').get(),i=c('MercuryThreads').get();c('Sound').init(['audio/ogg','audio/mpeg']);function j(){return !c('UserActivity').isOnTab()&&!c('UserActivity').hasBeenInactive();}function k(m){if(c('ChatOptions').getSetting('sound')&&!j())c('Sound').play([c('ChatConfig').get('sound.notif_ogg_url'),c('ChatConfig').get('sound.notif_mp3_url')],m,false);}var l={messageReceived:function(m){if(c('MercuryViewer').isViewer(m.author)||!m.is_unread||m.folder!=c('MessagingTag').INBOX&&m.folder!=c('MessagingTag').ARCHIVED)return;var n=m.thread_id,o=c('ChatActivity').isActive();if(o){var p=false;l.inform('before-alert',{threadID:n,cancelAlert:function(){p=true;}});}i.getThreadMeta(n,function(q){var r=c('MercuryThreadInfo').isMuted(q);c('MercuryGroupThreadMentions').messageMentionsViewer(m,function(s){if(r&&(!c('MercuryConfig').GroupChatMentionsGK||!s))return;if(h.isPresentInGroupThread(q))return;var t=m.timestamp;if(o){!p&&k(t);}else{c('ChatTitleBarBlinker').blink(n,t);k(t);}c('ChatTitleBarBlinker').blinkingElsewhere();});});}};f.exports=Object.assign(l,c('ArbiterMixin'));},null);
__d('ChatNewMessageHandler',['ChatActivity','ChatMentionsNotifications','ChatTabModel','ChatTabViewInstances','JSLogger','MercuryAssert','MercuryBrowserAlerts','UserActivity','MercuryConfig','MercuryThreadlistConstants'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();var h=c('JSLogger').create('chat_new_message'),i={_notify:function(j,k,l){if(c('MercuryConfig').DesktopNotificationsGK)c('ChatMentionsNotifications').notifyIfMessageToMe(k);var m=c('ChatTabViewInstances').get(j);l.view_is_visible=m&&m.isVisible();l.view_is_focused=m&&m.isFocused();if(!l.view_is_visible)h.log('message_to_hidden');l.is_active=c('ChatActivity').isActive();c('MercuryBrowserAlerts').messageReceived(k);},newMessage:function(j,k){c('MercuryAssert').isThreadID(j);var l=c('ChatTabModel').getTab(j),m={thread_id:j,message_id:k.message_id,to_new_tab:!l,to_raised_tab:l?!!l.raised:true};this._notify(j,k,m);h.log('message',m);}};c('MercuryBrowserAlerts').subscribe('before-alert',function(j,event){var k=event.threadID,l=c('ChatTabViewInstances').get(k),m=c('ChatTabModel').getTab(k),n=c('MercuryThreadlistConstants').MESSAGE_NOTICE_INACTIVITY_THRESHOLD;if(m&&m.raised&&l&&l.isVisible()&&l.isFocused()&&c('UserActivity').isActive(n)){l.tryMarkAsRead();event.cancelAlert();}});f.exports=i;},null);
__d('ChatTabLRUManager',['ChatTabViewInstances','ChatTabModel','InitialServerTime','MercuryThreads'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();var h=c('MercuryThreads').get(),i={getLRUVisibleTab:function(j){if(j.hasRoomForRaisedTab())return undefined;var k=Object.keys(j.getTabsToShow()||{}),l=1*60,m=null,n=Infinity;for(var o=0;o<k.length;o++){var p=k[o],q=h.getThreadMetaNow(p);if(c('ChatTabModel').isTabPromoted(p))continue;if(!c('ChatTabViewInstances').get(p).hasEmptyInput()||!q)continue;var r=(c('InitialServerTime').serverTime-q.timestamp)/1000;if(!q.timestamp||q.timestamp&&q.timestamp<n&&r>l){m=q.thread_id;n=q.timestamp;}}return m;}};f.exports=i;},null);
__d('ChatTabPolicy',['ChatBehavior','JSLogger','MercuryActionType','MercuryLogMessageType','MercuryAssert','MercuryBlockedParticipants','MercuryConfig','MercuryGroupThreadMentions','MercuryIDs','MercuryParticipantTypes','MercurySourceType','MercuryThreadActions','MercuryThreadInfo','MercuryViewer','MessagingTag','OzConstants','PresencePrivacy','Set','ShortProfiles','WorkModeConfig'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();var h=c('MercuryBlockedParticipants').get(),i=c('MercuryThreadActions').get(),j=c('OzConstants').M_FBIDS,k=j.M_DEV,l=j.M,m=j.P,n=new (c('Set'))([k,l,m]),o=c('JSLogger').create('tab_policy');f.exports={messageIsAllowed:function(p,q,r){var s=p.thread_id,t=q.message_id;c('MercuryAssert').isThreadID(s);c('MercuryAssert').isParticipantID(q.author);var u;if(c('MercuryThreadInfo').isMuted(p)){u={thread_id:s,message_id:t,mute_settings:p.mute_settings};o.log('message_thread_muted',u);if(c('MercuryConfig').GroupChatMentionsGK)c('MercuryGroupThreadMentions').messageMentionsViewer(q,function(x){if(x)r();});return;}if(p.read_only){u={thread_id:s,message_id:t,mode:p.mode};o.log('message_read_only',u);return;}if(q.source==c('MercurySourceType').EMAIL||q.source==c('MercurySourceType').TITAN_EMAIL_REPLY){u={thread_id:s,message_id:t,source:q.source};o.log('message_source_not_allowed',u);return;}var v=c('MercuryIDs').getUserIDFromParticipantID(q.author);if(!v){o.log('message_bad_author',{thread_id:s,message_id:t,user:v});return;}if(q.action_type!=c('MercuryActionType').USER_GENERATED_MESSAGE&&!this._messageIsNewlyCreatedGroup(q,p)){u={thread_id:s,message_id:t,type:q.action_type};o.log('message_non_user_generated',u);return;}if(p.is_canonical_user&&!c('ChatBehavior').notifiesUserMessages()){o.log('message_jabber',{thread_id:s,message_id:t});i.markSeen(s,true);return;}if(p.is_canonical&&!p.other_user_fbid){o.log('message_canonical_contact',{thread_id:s,message_id:t});return;}if(p.folder!=c('MessagingTag').INBOX){o.log('message_folder',{thread_id:s,message_id:t,folder:p.folder});return;}if(h.isPresentInGroupThread(p)){u={thread_id:s,message_id:t};o.log('message_blocked_participants',u);return;}var w=c('MercuryIDs').getUserIDFromParticipantID(c('MercuryViewer').getID());c('ShortProfiles').getMulti([v,w],function(x){if(!c('PresencePrivacy').allows(v)){o.log('message_privacy',{thread_id:s,message_id:t,user:v});return;}var y=x[v].employee&&x[w].employee,z=c('WorkModeConfig').is_work_user;if(!y&&!z&&!x[v].isCommercePage&&!n.has(v)&&x[v].type!==c('MercuryParticipantTypes').FRIEND){o.log('message_non_friend',{thread_id:s,message_id:t,user:v});return;}r();});},_messageIsNewlyCreatedGroup:function(p,q){return p.action_type===c('MercuryActionType').LOG_MESSAGE&&p.log_message_type===c('MercuryLogMessageType').THREAD_NAME&&q.message_count===1;}};},null);
__d('ChatTabPresence',['AvailableList','ChatTabModel','MercuryIDs'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();var h={};function i(j){var k=c('MercuryIDs').getUserIDFromThreadID(j);if(k)c('AvailableList').updateForID(k);}c('ChatTabModel').addListener(function(){var j=c('ChatTabModel').get();j.tabs.forEach(function(k){if(k.raised&&!h[k.id])i(k.id);});h={};j.tabs.forEach(function(k){if(k.raised)h[k.id]=true;});});f.exports={};},null);
__d('ChatTabViewEvents',['Arbiter'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();f.exports=new (c('Arbiter'))();},null);
__d('MercuryThreadTitle.react',['fbt','MercuryConfig','MercuryIDs','MercuryParticipantListRenderer','MercuryParticipants','React','TextWithEmoticons.react'],function a(b,c,d,e,f,g,h){'use strict';if(c.__markCompiled)c.__markCompiled();var i=c('React').PropTypes,j=c('React').createClass({displayName:'MercuryThreadTitle',propTypes:{isNewThread:i.bool,thread:i.object.isRequired,viewer:i.string.isRequired,showUnreadCount:i.bool,useShortName:i.bool,useAndSeparator:i.bool},getDefaultProps:function(){return {isNewThread:false,showUnreadCount:false,useShortName:false,useAndSeparator:false};},getInitialState:function(){return {participantNames:''};},componentDidMount:function(){this._renderParticipantsList(this.props);},componentWillReceiveProps:function(k){this._renderParticipantsList(k);},render:function(){return (c('React').createElement('span',{className:this.props.className},this.props.thread.name?this._renderThreadTitle():this.state.participantNames,this.props.children));},getTitle:function(){return this.state.participantNames;},_renderThreadTitle:function(){var k=this.props.thread,l=c('React').createElement(c('TextWithEmoticons.react'),{renderEmoticons:true,renderEmoji:true,text:k.name});if(c('MercuryConfig').MessengerNewEmojiGK&&c('MercuryConfig').MessengerTextWithEmoticonsModule){var m=c('MercuryConfig').MessengerTextWithEmoticonsModule;l=c('React').createElement(m,{renderEmoticons:true,renderEmoji:true,text:k.name});}if(!k.unread_count||!this.props.showUnreadCount)return l;return this._renderTitleWithUnreadCount(l,k.unread_count);},_renderParticipantsList:function(k){if(k.thread.name)return;var l=c('MercuryIDs').getParticipantIDFromUserID(k.viewer),m=k.thread.participants;if(m.length>1)m=m.filter(function(n){return n!=l;});c('MercuryParticipants').getMulti(m,function(n){if(!this.isMounted())return;var o=m.map(function(u){return n[u];}),p=k.thread.custom_nickname?{}:null;if(p&&c('MercuryConfig').MessengerNewEmojiGK&&c('MercuryConfig').MessengerTextWithEmoticonsModule){var q=c('MercuryConfig').MessengerTextWithEmoticonsModule;for(var r in k.thread.custom_nickname)p[r]=c('React').createElement(q,{renderEmoticons:true,renderEmoji:true,text:k.thread.custom_nickname[r]});}else if(p)p=k.thread.custom_nickname;var s=new (c('MercuryParticipantListRenderer'))().setUseShortName(k.useShortName).setUseAndSeparator(k.useAndSeparator).setIsNewThread(k.isNewThread).setNickname(p).renderParticipantList(o),t=k.showUnreadCount&&k.thread.unread_count?this._renderTitleWithUnreadCount(s,k.thread.unread_count):s;this.setState({participantNames:t});}.bind(this));},_renderTitleWithUnreadCount:function(k,l){return h._("{conversation-title} ({unread-count})",[h.param('conversation-title',k),h.param('unread-count',l)]);}});f.exports=j;},null);
__d('WebMessengerEvents',['Arbiter'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();var h=Object.assign(new (c('Arbiter'))(),{MASTER_DOM_CHANGED:'master-dom-changed',DETAIL_DOM_CHANGED:'detail-dom-changed',FOCUS_COMPOSER:'focus-composer',FOCUS_SEARCH:'focus-search',FOCUS_AND_SELECT_SEARCH:'focus-and-select-search',STICKER_CLICKED:'sticker-clicked',SUBMIT_REPLY:'submit-reply',UPDATE_SELECTION:'update-selection',masterDOMChanged:function(){this.inform(h.MASTER_DOM_CHANGED);},detailDOMChanged:function(){this.inform(h.DETAIL_DOM_CHANGED);},focusComposer:function(){this.inform(h.FOCUS_COMPOSER);},focusSearch:function(){this.inform(h.FOCUS_SEARCH);},focusAndSelectSearch:function(){this.inform(h.FOCUS_AND_SELECT_SEARCH);},updateSelection:function(i){this.inform(h.UPDATE_SELECTION,i);},stickerClicked:function(i,j){this.inform(h.STICKER_CLICKED,{packID:i,stickerID:j});},submitReply:function(){this.inform(h.SUBMIT_REPLY);}});f.exports=h;},null);
__d('WebMessengerSubscriptionsHandler',['SubscriptionsHandler'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();var h=new (c('SubscriptionsHandler'))('webmessenger');f.exports=h;},null);
__d("isWebMessengerURI",[],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();function h(i){return (/^(\/messages)/.test(i.getPath()));}f.exports=h;},null);
__d('WebMessengerWidthControl',['csx','cx','Arbiter','BlueBar','CSS','CSSClassTransition','Event','Style','URI','ViewportBounds','WebMessengerEvents','WebMessengerSubscriptionsHandler','$','getViewportDimensions','isWebMessengerURI','requestAnimationFrame','setTimeoutAcrossTransitions','shield','throttle'],function a(b,c,d,e,f,g,h,i){if(c.__markCompiled)c.__markCompiled();var j=205,k=981,l=257,m=18,n=848,o=724,p=.57,q=56,r,s,t;function u(z,aa,ba){this.masterChanged=z;this.detailChaned=aa;c('WebMessengerSubscriptionsHandler').addSubscriptions(c('Event').listen(window,'resize',c('throttle')(c('shield')(v,this,this),100)),c('Arbiter').subscribe(['sidebar/initialized','sidebar/visibility','minisidebar/show'],c('shield')(v,this,this),c('Arbiter').SUBSCRIBE_NEW));var ca=y()?q:0;if(ba)ca=j;this._width=y()?0:n;t=true;v(this,ca);}function v(z,aa){var ba=c('ViewportBounds').getRight()+c('ViewportBounds').getLeft();ba=ba||aa||0;var ca=c('getViewportDimensions').withoutScrollbars().width-ba,da=Math.round(Math.max(0,ca/2-k/2));ca=k+da-l;ca-=m;ca=Math.max(o,Math.min(n,ca));if(!isNaN(ca)&&z._width!==ca){z._width=ca;var ea=Math.round(ca/(1+p)),fa=ca-ea;z.masterChanged(fa);z.detailChaned(ea);if(y()){var ga=ca+l;w(function(){if(s){document.body.className=s;s='';}x(ga+'px');c('CSS').removeClass(document.body,"_5uj5");t&&c('WebMessengerEvents').detailDOMChanged();t=false;},s);}}}function w(z,aa){aa&&c('CSS').addClass(document.documentElement,"_5uj6");c('requestAnimationFrame')(z);aa&&c('setTimeoutAcrossTransitions')(c('CSS').removeClass.bind(null,document.documentElement,"_5uj6"),1000);}function x(z){c('Style').set(c('BlueBar').getNavRoot(),'width',z);c('Style').set(c('$')('globalContainer'),'width',z);}function y(){if(!r)r=c('CSS').matchesSelector(document.body,"._6nw");return r;}c('CSSClassTransition').registerHandler(function(z,aa,ba,ca){function da(ea){return y()&&c('isWebMessengerURI')(new (c('URI'))(ea));}if(da(ca)){s=aa;return true;}else if(da(ba)){w(function(){z.className=aa;x('');},true);return true;}});f.exports=u;},null);
__d('Dock',['csx','Event','shield','WebMessengerWidthControl','Arbiter','ArbiterMixin','BlueBar','ChatQuietLinks','CSS','DataStore','DOM','Parent','Scroll','Style','Toggler','Vector','emptyFunction'],function a(b,c,d,e,f,g,h){if(c.__markCompiled)c.__markCompiled();c('WebMessengerWidthControl');function i(){}Object.assign(i,c('ArbiterMixin'),{MIN_HEIGHT:140,INITIAL_FLYOUT_HEIGHT_OFFSET:10,init:function(j){this.init=c('emptyFunction');this.rootEl=j;this.calculateViewportDimensions();this.calculateFlyoutHeightOffset();c('ChatQuietLinks').removeEmptyHrefs(this.rootEl);c('Event').listen(j,'click',this._onClick.bind(this));c('Event').listen(window,'resize',this._onWindowResize.bind(this));c('Toggler').subscribe(['show','hide'],function(k,l){var m=l.getActive();if(!c('DOM').contains(j,m))return;if(c('CSS').hasClass(m,'fbNub')){this.notifyNub(m,k);if(k==='show')this._resizeNubFlyout(m);}else{var n=c('Parent').byClass(m,'fbNubFlyout');if(n)c('CSS').conditionClass(n,'menuOpened',k==='show');}}.bind(this));this.inform('init',{},c('Arbiter').BEHAVIOR_PERSISTENT);},calculateViewportDimensions:function(){return this.viewportDimensions=c('Vector').getViewportDimensions();},calculateFlyoutHeightOffset:function(){this.flyoutHeightOffset=this.INITIAL_FLYOUT_HEIGHT_OFFSET+c('Vector').getElementDimensions(this.rootEl).y;var j=c('BlueBar').getBar();if(j){var k=c('Style').isFixed(j)?'viewport':'document';this.flyoutHeightOffset+=c('Vector').getElementPosition(j,k).y+c('Vector').getElementDimensions(j).y;}},toggle:function(j){var k=this._findFlyout(j);if(!k)return;this.subscribe('init',function(){c('Toggler').toggle(j);});},show:function(j){this.subscribe('init',function(){c('Toggler').show(j);});},showNub:function(j){c('CSS').show(j);},hide:function(j){this.subscribe('init',function(){var k=c('Toggler').getInstance(j);c('DOM').contains(j,k.getActive())&&k.hide();});},hideNub:function(j){c('CSS').hide(j);this.hide(j);},setUseMaxHeight:function(j,k){c('CSS').conditionClass(j,'maxHeight',k!==false);this._resizeNubFlyout(j);},_resizeNubFlyout:function(j){var k=this._findFlyout(j);if(!k||c('CSS').hasClass(j,'placeholder')||!(c('CSS').hasClass(j,'openToggler')||c('CSS').hasClass(j,'opened')))return;var l=c('DOM').find(k,'div.fbNubFlyoutOuter'),m=c('DOM').find(l,'div.fbNubFlyoutInner'),n=c('DOM').find(m,'div.fbNubFlyoutBody'),o=c('Scroll').getTop(n),p=n.offsetHeight;c('Style').set(n,'height','auto');var q=c('Vector').getElementDimensions(k),r=c('Vector').getElementDimensions(n),s=this.getMaxFlyoutHeight(j);c('Style').set(k,'max-height',s+'px');c('Style').set(l,'max-height',s+'px');q=c('Vector').getElementDimensions(k);var t=c('Vector').getElementDimensions(m),u=t.y-r.y,v=q.y-u,w=parseInt(n.style.height||n.clientHeight,10),x=v!==w;if(q.y>u&&x)c('Style').set(n,'height',v+'px');c('CSS').removeClass(k,'swapDirection');var y=c('Vector').getElementPosition(k).x;c('CSS').conditionClass(k,'swapDirection',function(){if(y<0)return true;return y+q.x>this.viewportDimensions.x;}.bind(this)());if(x&&o+p>=r.y){c('Scroll').setTop(n,n.scrollHeight);}else c('Scroll').setTop(n,o);this.notifyNub(j,'resize');},getMaxFlyoutHeight:function(j){var k=this._findFlyout(j),l=c('Vector').getElementPosition(k,'viewport'),m=c('Vector').getElementDimensions(k),n=Math.max(this.MIN_HEIGHT,this.viewportDimensions.y-this.flyoutHeightOffset)-(this.viewportDimensions.y-l.y-m.y);return Math.max(n,0);},resizeAllFlyouts:function(){var j=this._getAllNubs(),k=j.length;while(k--)this._resizeNubFlyout(j[k]);},hideAllFlyouts:function(){var j=this._getAllNubs(),k=j.length;while(k--)this.hide(j[k]);},_getAllNubs:function(){var j=c('DOM').scry(this.rootEl,"div._50-v.openToggler");return j.concat(c('DOM').scry(this.rootEl,"div._50-v.opened"));},_onClick:function(event){var j=event.getTarget(),k=c('Parent').byClass(j,'fbNub');if(k){if(c('Parent').byClass(j,'fbNubFlyoutTitlebar')){var l=c('Parent').byTag(j,'a'),m=j.nodeName=='INPUT'&&j.getAttribute('type')=='submit';if(!l&&!m){this.hide(k);return false;}}this.notifyNub(k,'click');}},_onWindowResize:function(event){this.calculateViewportDimensions();this.resizeAllFlyouts();},_findFlyout:function(j){return c('CSS').hasClass(j,'fbNubFlyout')?j:c('DOM').scry(j,'div.fbNubFlyout')[0]||null;},registerNubController:function(j,k){c('DataStore').set(j,'dock:nub:controller',k);k.subscribe('nub/button/content-changed',c('shield')(this.inform,this,'resize',j));k.subscribe('nub/flyout/content-changed',c('shield')(this._resizeNubFlyout,this,j));},unregisterNubController:function(j){c('DataStore').remove(j,'dock:nub:controller');},notifyNub:function(j,k,l){var m=c('DataStore').get(j,'dock:nub:controller');m&&m.inform(k,l);}});f.exports=b.Dock||i;},null);
__d('NubController',['ArbiterMixin','Dock'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();function h(){}Object.assign(h.prototype,c('ArbiterMixin'),{init:function(i){this.el=i;c('Dock').registerNubController(i,this);return this;},buttonContentChanged:function(){this.inform('nub/button/content-changed');},flyoutContentChanged:function(){this.inform('nub/flyout/content-changed');},hide:function(){c('Dock').hide(this.el);},show:function(){c('Dock').show(this.el);}});f.exports=h;},null);
__d('ChatTabViewSelector',['Arbiter','ArbiterMixin','CSS','ChatTabActions','CurrentUser','DOM','DataStore','Event','MenuDeprecated','MercuryThreadInformer','MercuryThreadTitle.react','MercuryThreads','NubController','React','ReactDOM','ChatTabTemplates','Toggler'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();var h=c('MercuryThreadInformer').get(),i=c('MercuryThreads').get();function j(k){var l=c('ChatTabTemplates')[':fb:chat:tab:selector'].build(),m=l.getRoot(),n=l.getNode('menu'),o=c('DOM').find(n,'.uiMenuInner'),p={},q=new (c('NubController'))().init(m);c('CSS').hide(m);c('DOM').insertBefore(k,m);function r(u){var v=0;for(var w in p){var x=p[w],y=i.getThreadMetaNow(w),z=x.getNode('unreadCount'),aa=y&&y.unread_count||0;v+=aa;if(aa>9)aa='+';c('CSS').conditionClass(z,'invisible_elem',!aa);c('DOM').setContent(z,aa);}var ba=l.getNode('numMessages');c('CSS').conditionShow(ba,v);c('DOM').setContent(ba,v);}this.setTabData=function(u){var v=p;p={};if(u.length<1){c('CSS').hide(m);return;}c('CSS').show(m);c('DOM').empty(o);u.forEach(function(y){var z=c('ChatTabTemplates')[':fb:chat:tab:selector:item'].build(),aa=z.getNode('content');p[y.id]=z;i.getThreadMeta(y.id,function(ca){c('ReactDOM').render(c('React').createElement(c('MercuryThreadTitle.react'),{thread:ca,useAndSeparator:true,viewer:c('CurrentUser').getID()}),aa);});c('DOM').prependContent(o,z.getRoot());c('DataStore').set(z.getRoot(),'threadID',y.id);var ba=z.getNode('closeButton');c('Event').listen(ba,'click',function(event){c('ChatTabActions').closeTab(y.id,'selector/close-tab');event.kill();});});for(var w in v)if(v.hasOwnProperty(w)){var x=v[w].getNode('content');x&&c('ReactDOM').unmountComponentAtNode(x);}q.flyoutContentChanged();c('DOM').setContent(l.getNode('numTabs'),u.length);r();};function s(event,u){if(u.menu!=n)return;var v=c('DataStore').get(u.item,'threadID');j.inform('selected',v);c('Toggler').hide(m);}function t(event,u){c('MenuDeprecated').register(n);}c('MenuDeprecated').subscribe('select',s.bind(this));c('Toggler').listen('show',m,function(){c('Arbiter').inform('layer_shown',{type:'ChatTabSelector'});t();});c('Toggler').listen('hide',m,function(){c('Arbiter').inform('layer_hidden',{type:'ChatTabSelector'});});h.subscribe('threads-updated',r);}Object.assign(j,c('ArbiterMixin'));f.exports=j;},null);
__d('ChatTabController',['ChatTabPresence','Arbiter','ChatActivity','ChatConfig','ChatNewMessageHandler','ChatTabActions','ChatTabLRUManager','ChatTabModel','ChatTabPolicy','ChatTabViewEvents','ChatTabViewInstances','ChatTabViewSelector','JSLogger','MercuryThreadInformer','MercuryThreadActions','MercuryThreads','MercuryViewer','Style','UserAgent_DEPRECATED'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();c('ChatTabPresence');var h=c('MercuryThreadInformer').get(),i=c('MercuryThreadActions').get(),j=c('MercuryThreads').get(),k=c('ChatConfig').get('tab_auto_close_timeout')||7200000,l=c('JSLogger').create('tab_controller');function m(x,y,z){var aa=c('ChatTabModel').get().tabs,ba=aa[x],ca,da;if(!z&&aa.length<2)return false;var ea=aa.slice(x+1),fa=aa.slice(0,x),ga=ea.concat(fa);if(!y)ga.reverse();if(ba)ga.push(ba);for(var ha=0;ha<ga.length;ha++){ca=ga[ha];da=c('ChatTabViewInstances').get(ca.id);var ia=ca.raised||!z;if(da&&da.isVisible()&&ia){da.focus();return true;}}return false;}function n(x,y){var z=y&&y.getRightmostHiddenTab();if(z===x)return null;return z;}function o(){return Math.floor(Math.random()*2147483648).toString(16);}function p(x,y,z,aa){c('ChatTabActions').raiseTab(x,true,z);var ba=y&&y.getLeftmostVisibleTab(),ca=y&&y.getTabsToShow();if(ca&&!ca[x]&&ba){c('ChatTabModel').promoteThreadInPlaceOfThread(x,ba,n(x,y),true);}else c('ChatTabActions').promoteTab(x);if(aa)return;var da=c('ChatTabViewInstances').get(x);da&&da.focus();}function q(x,y){if(!c('ChatTabModel').getTab(x))c('ChatTabActions').raiseTab(x,false);var z=y&&c('ChatTabLRUManager').getLRUVisibleTab(y),aa=y&&y.getTabsToShow();if(aa&&!aa[x]&&z)c('ChatTabModel').promoteThreadInPlaceOfThread(x,z,n(x,y));}function r(x){c('ChatTabViewSelector').subscribe('selected',function(y,z){p(z,x);});c('Arbiter').subscribe('page_transition',function(y,z){c('ChatTabActions').closeFragileTabs();});c('Arbiter').subscribe('chat-visibility/go-offline',function(){c('ChatTabActions').closeAllTabs();});c('ChatActivity').subscribe('idle',function(y,z){if(z>k){var aa=c('ChatTabModel').get().tabs;aa.forEach(function(ba){var ca=ba.id;j.getThreadMeta(ca,function(da){if(!da.unread_count){l.log('autoclose_idle_seen',{thread_id:ca,idleness:z});c('ChatTabActions').closeTab(ca,'autoclose_idle_seen');}});});}});c('ChatTabViewEvents').subscribe('nub-activated',function(y,z){p(z,x);});c('ChatTabViewEvents').subscribe('focus-tab',function(y,z){var aa=c('ChatTabModel').getTab(z);if(aa&&aa.raised)p(z,x,aa.signatureID,false);});c('ChatTabViewEvents').subscribe('interaction-with-tab',function(y,z){var aa=c('ChatTabModel').getTab(z);aa&&aa.raised&&i.markSeen(z);});c('ChatTabViewEvents').subscribe('esc-pressed',function(y,z){l.log('close_esc',{thread_id:z});var aa=c('ChatTabModel').indexOf(z);c('ChatTabActions').closeTab(z,'close_esc');setTimeout(function(){m(aa-1,true,true);},0);});h.subscribe('messages-received',function(y,z){for(var aa in z){var ba=z[aa];for(var ca=0;ca<ba.length;ca++){var da=ba[ca];if(da.author!=c('MercuryViewer').getID()){if(!da.is_unread){l.log('message_already_read',{thread_id:da.thread_id});continue;}j.getThreadMeta(aa,function(ea){c('ChatTabPolicy').messageIsAllowed(ea,da,function(){q(aa,x);c('ChatNewMessageHandler').newMessage(aa,da);});});}}}});h.subscribe('thread-read-changed',function(y,z){for(var aa in z)if(!z[aa].mark_as_read){l.log('autoclose_marked_unread',{thread_id:aa});c('ChatTabActions').closeTab(aa,'autoclose_marked_unread');}});c('ChatTabViewEvents').subscribe('tab-pressed',function(y,z){return !m(c('ChatTabModel').indexOf(z.id),z.shiftPressed);});c('Arbiter').subscribe(c('JSLogger').DUMP_EVENT,function(y,z){z.chat_controller={auto_close_timeout:k};});this.openTab=function(y,z,aa,ba){p(y,z,o(),ba);if(aa)aa(c('ChatTabViewInstances').get(y));};}if(c('UserAgent_DEPRECATED').firefox()){var s=function(){return c('Style').get(document.body,'overflowX')+' '+c('Style').get(document.body,'overflowY');},t=s(),u=function(){var x=s();if(x!==t){t=x;c('Arbiter').inform('overflow-applied-to-body');}};if('MutationObserver' in window){var v=new MutationObserver(u),w={attributes:true,attributeFilter:['class','style']};v.observe(document.documentElement,w);}else document.documentElement.addEventListener('DOMAttrModified',function(event){if(event.getTarget()===document.documentElement&&(event.attrName==='class'||event.attrName==='style'))u();},false);}f.exports=r;},null);
__d('FBRTCSupport',['ChannelConstants','RTCConfig','UserAgent'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();var h={isSendWebrtcSupported:function(){return c('RTCConfig').SendNewVCGK;},isReceiveWebrtcSupported:function(){return c('RTCConfig').ReceiveNewVCGK;},isVideoInteropSupported:function(){return c('RTCConfig').VideoInteropGK;},isVideoCallBlockingSupported:function(){return c('RTCConfig').VideoCallBlockingGK;},isWebrtcSupported:function(){return (c('UserAgent').isBrowser('Chrome >= 28')||c('UserAgent').isBrowser('Firefox >= 25')||c('UserAgent').isBrowser('Opera >= 20'));},isOSSupported:function(){return !c('UserAgent').isPlatform('Android')&&!c('UserAgent').isPlatform('iOS');},getCapabilities:function(){var i=0;if(this.isReceiveWebrtcSupported())i=c('ChannelConstants').CAPABILITY_VOIP_INTEROP;return i;}};f.exports=h;},null);
__d('ChatTabViewCoordinator',['Arbiter','Bootloader','ChatTabModel','ChatTabViewSelector','CSS','ErrorUtils','FBRTCSupport','LogHistory'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();var h=c('LogHistory').getInstance('chat_tab_coordinator');function i(j,k){var l=new (c('ChatTabViewSelector'))(j),m={},n=false;function o(){var s=c('ChatTabModel').get(),t={};s.tabs.forEach(function(v){t[v.id]=1;});h.log('process_tab_changed',{model_tabs:Object.keys(t),view_tabs:Object.keys(m)});for(var u in m)if(!t[u]){h.log('remove_tab',{tab_id:u});m[u].destroy();delete m[u];}p(s,function(){q(s);if(s.tabNeedsFocus&&!s.tabNeedsFocus.isFocused())s.tabNeedsFocus.focus();});}function p(s,t){if(!s.tabs.length){t();return;}c('Bootloader').loadModules(["ChatTabView"],function(u){var v=null;s.tabs.forEach(function(w){var x=w.id,y=false;if(!m[x]){h.log('add_tab',{tab_id:x});m[x]=new u(x,w.server_id,w.signatureID,j,v);y=true;}else m[x].updateSignatureID(w.signatureID);if(m[x].isFocused())s.tabNeedsFocus=m[x];if(!y&&!m[x].nextTabIs(v)){var z=m[x].getScrollTop();if(v){try{m[x].insertBefore(v);}catch(aa){h.log('insertBeforeFailed','{}');m[x].appendTo(j);c('ErrorUtils').reportError(aa);}}else m[x].appendTo(j);if(z)m[x].setScrollTop(z);}v=m[x];});t();});}function q(s){var t=k.getTabsToShow(s),u=[],v=false;s.tabs.forEach(function(w){if(!t[w.id]){m[w.id].setVisibleState(false,w.raised);u.push(w);}});s.tabs.forEach(function(w){if(t[w.id]){m[w.id].setVisibleState(true,w.raised);v|=w.raised;}});l.setTabData(u);r(v);}function r(s){if(!s&&n){c('Arbiter').inform('layer_hidden',{type:'ChatTab'});n=false;}else if(s&&!n){c('Arbiter').inform('layer_shown',{type:'ChatTab'});n=true;}}if(c('FBRTCSupport').isSendWebrtcSupported())c('CSS').addClass(j,'videoCallEnabled');k.subscribe('tabs-changed',o);o();}f.exports=i;},null);
__d('FBRTCCallControlActions',['FBRTCDispatcher','keyMirror'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();var h=c('keyMirror')({ACCEPT_ESCALATION:null,HANG_UP:null,PARENT_WINDOW_START_CALL:null,TOGGLE_FULL_SCREEN:null,TOGGLE_MUTE_AUDIO:null,TOGGLE_MUTE_VIDEO:null,TOGGLE_SCREEN_SHARING:null,TOGGLE_SELF_VIEW:null,SHOW_SETTINGS:null,START_CALL:null,DECLINE_ESCALATION:null,RECEIVED_SIGNALING_MESSAGE:null,RESET_CALL:null,OPEN_SCREEN_IN_NEW:null,CLOSE_STANDALONE_SCREEN:null}),i={Types:h,hangUp:function(){c('FBRTCDispatcher').dispatch({type:h.HANG_UP});},toggleMuteAudio:function(){c('FBRTCDispatcher').dispatch({type:h.TOGGLE_MUTE_AUDIO});},toggleMuteVideo:function(){c('FBRTCDispatcher').dispatch({type:h.TOGGLE_MUTE_VIDEO});},toggleFullScreen:function(){c('FBRTCDispatcher').dispatch({type:h.TOGGLE_FULL_SCREEN});},toggleSelfView:function(){c('FBRTCDispatcher').dispatch({type:h.TOGGLE_SELF_VIEW});},showSettings:function(){c('FBRTCDispatcher').dispatch({type:h.SHOW_SETTINGS});},toggleScreenSharing:function(){c('FBRTCDispatcher').dispatch({type:h.TOGGLE_SCREEN_SHARING});},startCall:function(){c('FBRTCDispatcher').dispatch({type:h.START_CALL});},openScreenInNewWindow:function(){c('FBRTCDispatcher').dispatch({type:h.OPEN_SCREEN_IN_NEW});},receivedSignalingMessage:function(j){c('FBRTCDispatcher').dispatch({type:h.RECEIVED_SIGNALING_MESSAGE,message_type:j.msgType,message:j});},acceptEscalation:function(){c('FBRTCDispatcher').dispatch({type:h.ACCEPT_ESCALATION});},declineEscalation:function(){c('FBRTCDispatcher').dispatch({type:h.DECLINE_ESCALATION});},resetCall:function(j){c('FBRTCDispatcher').dispatch({type:h.RESET_CALL,trigger:j});},parentWindowStartCall:function(){c('FBRTCDispatcher').dispatch({type:h.PARENT_WINDOW_START_CALL});}};f.exports=i;},null);
__d('FBRTCLogger',['Log','LogHistory','MarauderLogger','formatDate','pageID'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();var h='webrtc',i='sent_message',j='received_message',k='send_succeeded',l='send_failed',m='info',n='call_action',o='client_event',p='client_error',q='type',r='msg_id',s='ack_msg_id',t='call_id',u='from',v='to',w='content',x='tag',y='peer_id',z='error_code',aa='trigger',ba='endcallstats',ca=null;da.getInstance=function(){'use strict';if(!ca)ca=new da();return ca;};function da(){'use strict';this.$FBRTCLogger1=c('LogHistory').getInstance(h);}da.prototype.logToConsole=function(ea){'use strict';var fa='Console';this.$FBRTCLogger2(null,null,fa,ea);this.$FBRTCLogger1.log(fa,ea);};da.prototype.logReceivedMessage=function(ea,fa,ga){'use strict';var ha={};ha[u]=ea;ha[t]=fa;ha[q]=ga.type;ha[r]=ga.msg_id;if(ga.sdp)ha[w]=ga.sdp;if(ga.ack_id)ha[s]=ga.ack_id;this.$FBRTCLogger3(j,ha);this.$FBRTCLogger2(ea,fa,'Received',ga.type+', '+ga.msg_id);};da.prototype.logSentMessage=function(ea,fa,ga){'use strict';var ha={};ha[v]=ea;ha[t]=fa;ha[q]=ga.type;ha[r]=ga.msg_id;if(ga.sdp)ha[w]=ga.sdp;if(ga.ack_id)ha[s]=ga.ack_id;this.$FBRTCLogger3(i,ha);this.$FBRTCLogger2(ea,fa,'Sent',ga.type+', '+ga.msg_id);};da.prototype.logSentMessageSuccess=function(ea,fa,ga,ha){'use strict';var ia={};ia[y]=ea;ia[t]=fa;ia[q]=ga;ia[r]=ha;this.$FBRTCLogger3(k,ia);};da.prototype.logSentMessageFailure=function(ea,fa,ga,ha,ia){'use strict';var ja={};ja[y]=ea;ja[t]=fa;ja[q]=ga;ja[r]=ha;ja[z]=ia;this.$FBRTCLogger3(l,ja);this.$FBRTCLogger2(ea,fa,'Send Failed',ga+', '+ia);};da.prototype.logCallAction=function(ea,fa,ga,ha,ia){'use strict';var ja={};ja[y]=ea;ja[t]=fa;ja[n]=ga;ja[w]=ha;if(ia)ja[aa]=ia;this.$FBRTCLogger3(n,ja);this.$FBRTCLogger2(ea,fa,'CallAction',ga+', '+ha);};da.prototype.logEvent=function(ea,fa,event){'use strict';var ga={};ga[y]=ea;ga[t]=fa;ga[w]=event;this.$FBRTCLogger3(o,ga);this.$FBRTCLogger2(ea,fa,'Event',event);};da.prototype.logInfo=function(ea,fa,ga){'use strict';var ha={};ha[y]=ea;ha[t]=fa;ha[w]=ga;this.$FBRTCLogger3(m,ha);this.$FBRTCLogger2(ea,fa,'Info',ga);};da.prototype.logError=function(ea,fa,ga){'use strict';var ha={};ha[y]=ea;ha[t]=fa;ha[w]=ga;this.$FBRTCLogger3(p,ha);this.$FBRTCLogger2(ea,fa,'Error',ga);};da.prototype.logErrorWithoutID=function(ea){'use strict';this.logError(null,null,ea);};da.prototype.logEndCallSummary=function(ea){'use strict';if(!ea)return;var fa={};fa[y]=ea.peerID;fa[t]=ea.callID;fa[x]=ba;fa[w]=ea.toString();var ga=ea.getExtraInfo();for(var ha in ga)if(ga.hasOwnProperty(ha))fa[ha]=ga[ha];this.$FBRTCLogger3(m,fa);this.$FBRTCLogger2(ea.peerID,ea.callID,'Call Summary',fa);};da.prototype.$FBRTCLogger3=function(ea,fa){'use strict';fa.page_id=c('pageID');this.$FBRTCLogger1.log(ea,fa);c('MarauderLogger').log(ea,h,fa);};da.prototype.$FBRTCLogger2=function(ea,fa,ga,ha){'use strict';};da.CallAction={START_CALL:'start_call',RECEIVED_CALL:'received_call',ANSWER_CALL:'answer_call',END_CALL:'end_call',DENIED_PERMISSION:'denied_permission',SET_MUTE:'set_mute',SET_VIDEO_ON:'set_video_on',SET_SELF_VIEW_ON:'set_self_view_on',SET_FULLSCREEN_ON:'set_fullscreen_on',START_SKYPE:'start_skype',TRY_NEW:'try_new',OPEN_POPUP:'open_popup',POPUP_OPENED:'popup_opened',AUTO_DISABLE_VIDEO:'auto_disable_video',FAILED_GETTING_URI:'failed_getting_uri',OLD_URI:'old_uri',USER_SETTINGS_CHANGED:'user_settings_changed'};da.Trigger={ADMIN_MESSAGE:'admin_message',CHAT_TAB_ICON:'chat_tab_icon',CHAT_TAB_ICON_TOUR:'chat_tab_icon_tour',CHAT_TAB_VOICE_ICON:'chat_tab_voice_icon',SKYPE_DEPRECATION_DIALOG:'skype_deprecation_dialog',REDIAL_BUTTON:'redial_button',RETURN_CALL:'return_call',WEB_MESSENGER:'web_messenger',POPUP_CALL_START_BUTTON:'popup_start_call_button',TIMELINE_PROFILE:'timeline_profile',UNKNOWN:'unknown',RESET_CALL:'install_screen_sharing_ext_dialog'};da.Key={DEVICE_INFO:'device_info',RATING:'rating5',RATING_SHOWN:'rating_shown',SURVEY_CHOICE:'survey_choice',SURVEY_DETAILS:'survey_details',SURVEY_SHOWN:'survey_shown',INITIATED_BY_PAGE_ID:'initiated_by_page_id',PEER_IS_MOBILE:'peer_is_mobile'};f.exports=da;},null);
__d('FBRTCLocalMessageQueue',['CacheStorage','FBRTCLogger','Map','RTCConfig'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();var h='localstorage',i='RTC_',j='offer',k='offer_msg',l='data_',m=30*1000,n=15*1000,o=500,p=new (c('Map'))();function q(){'use strict';this.$FBRTCLocalMessageQueue1=c('FBRTCLogger').getInstance();}q.prototype.enqueueOffer=function(r,s){'use strict';var t=this.$FBRTCLocalMessageQueue2(r,k);this.$FBRTCLocalMessageQueue3(t,j,s);};q.prototype.getOffer=function(r){'use strict';var s=this.$FBRTCLocalMessageQueue2(r,k);return this.$FBRTCLocalMessageQueue4(s,j);};q.prototype.removeOffer=function(r){'use strict';var s=this.$FBRTCLocalMessageQueue2(r,k);s.remove(j);};q.prototype.enqueueMessage=function(r,s,t,u){'use strict';var v=l+t.toString(),w=p.get(r)||new (c('Map'))();w.set(v,u);p.set(r,w);this.$FBRTCLocalMessageQueue1.logToConsole('Queued '+v);};q.prototype.drainQueue=function(r,s){'use strict';var t=p.get(r)||new (c('Map'))(),u,v;for(var w=t,x=Array.isArray(w),y=0,w=x?w:w[typeof Symbol==='function'?Symbol.iterator:'@@iterator']();;){if(x){if(y>=w.length)break;var z=w[y++];u=z[0];v=z[1];}else{y=w.next();if(y.done)break;var aa=y.value;u=aa[0];v=aa[1];}void u;s(v);}p.set(r,new (c('Map'))());};q.prototype.enableDequeuing=function(r,s,t,u){'use strict';if(u===undefined)u=n;this.$FBRTCLocalMessageQueue5(r,s,t,u);};q.prototype.$FBRTCLocalMessageQueue5=function(r,s,t,u){'use strict';var v=this.$FBRTCLocalMessageQueue2(r,s),w=v.keys(),x=w.length;for(var y=0;y<x;y++){var z=this.$FBRTCLocalMessageQueue6(v,w[y]);if(z&&t)t(z);}this.$FBRTCLocalMessageQueue1.logToConsole('Dequeued '+x+' ('+r+') with '+u+' left)');if(u>0){u-=o;setTimeout(function(){this.$FBRTCLocalMessageQueue5(r,s,t,u);}.bind(this),o);}};q.prototype.$FBRTCLocalMessageQueue3=function(r,s,t){'use strict';var u={__t:Date.now(),__d:t};r.set(s,u);};q.prototype.$FBRTCLocalMessageQueue4=function(r,s){'use strict';var t=r.get(s);if(t&&this.$FBRTCLocalMessageQueue7(t)){return t.__d;}else if(t)r.remove(s);return null;};q.prototype.$FBRTCLocalMessageQueue6=function(r,s){'use strict';var t=this.$FBRTCLocalMessageQueue4(r,s);if(t!==null){r.remove(s);return t;}return null;};q.prototype.$FBRTCLocalMessageQueue7=function(r){'use strict';return Date.now()-r.__t<m;};q.prototype.$FBRTCLocalMessageQueue2=function(r,s){'use strict';return new (c('CacheStorage'))(h,''+i+r+'_'+s+'_');};f.exports=q;},null);
__d('FBRTCMessageListener',['invariant','Arbiter','ChannelConstants','FBRTCCallControlActions','FBRTCLocalMessageQueue','FBRTCSupport','RTCConfig','guid','mixInEventEmitter'],function a(b,c,d,e,f,g,h){'use strict';if(c.__markCompiled)c.__markCompiled();var i=45*1000,j='rtc_child_window_ready',k='rtc_child_window_start_call',l='rtc_child_window_message',m=[],n=null,o=null,p=null,q=null,r=null,s=false,t=null,u={init:function(v,w){if(s)return;s=true;c('Arbiter').subscribe(c('ChannelConstants').getArbiterType('webrtc'),function(y,z){this._onMessage(z.obj);}.bind(this));c('Arbiter').subscribe(c('ChannelConstants').getArbiterType('webrtc_offer'),function(y,z){this._onMessage(z.obj);}.bind(this));c('Arbiter').subscribe(c('ChannelConstants').getArbiterType('webrtc_offerack'),function(y,z){this._onMessage(z.obj);}.bind(this));if(c('RTCConfig').RtcConferencingGK)c('Arbiter').subscribe(c('ChannelConstants').getArbiterType('rtc_multi_json'),function(y,z){this._onMultiwayMessage(z.obj);}.bind(this));this._localMessageQueue=new (c('FBRTCLocalMessageQueue'))();if(c('RTCConfig').PassMessagesBetweenWindowsGK){if(c('FBRTCSupport').isWebrtcSupported()&&window.addEventListener){var x=v?this._handleWindowMessageToChild.bind(this):this._handleWindowMessageToParent.bind(this);window.addEventListener('message',x,false);}if(v)this._connectToParentWindow(w);}},setParentWindowNonce:function(v){q=v;},generateNewNonce:function(){r=c('guid')();return r;},setMultiwayMessageHandler:function(v,w){!!t?h(0):void 0;t=w?v.bind(w):v;},_onMultiwayMessage:function(v){this.emit('multiwayMessageReceived',v);if(t)t(v);},setMessageHandler:function(v,w){!!n?h(0):void 0;n=w?v.bind(w):v;while(m.length)n(m.shift());},removeMessageHandler:function(){n=null;},_onMessage:function(v){this.emit('messageReceived',v);if(n){n(v);}else m.push(v);this._passMessageToChildWindow(v);},_connectToParentWindow:function(v){if(window.opener&&window.opener.postMessage){var w={type:j,nonce:q,childNonce:this.generateNewNonce(),peerID:v};window.opener.postMessage(w,window.location.origin);}},_verifyWindowMessage:function(event){return event.origin===window.location.origin&&event.data&&r&&event.data.nonce===r;},_handleWindowMessageToParent:function(event){if(!this._verifyWindowMessage(event))return;if(event.data.type===j){this.setParentWindowNonce(event.data.childNonce);this._setChildWindow(event.source);this._replayQueuedMessagesToChild(event.data.peerID,o);}},_handleWindowMessageToChild:function(event){if(!this._verifyWindowMessage(event))return;if(event.data.type===l)this._onMessage(event.data.message);if(event.data.type===k)c('FBRTCCallControlActions').parentWindowStartCall();},_replayQueuedMessagesToChild:function(v,w){this._localMessageQueue.drainQueue(v,function(x){var y={type:l,nonce:q,message:x};w.postMessage(y,window.location.origin);});},_setChildWindow:function(v){o=v;clearTimeout(p);p=setTimeout(function(){o=null;},i);this._startCallInChildWindow();this.generateNewNonce();},_passMessageToChildWindow:function(v){if(o){var w={type:l,nonce:q,message:v};o.postMessage(w,window.location.origin);}},_startCallInChildWindow:function(){if(o){var v={type:k,nonce:q};o.postMessage(v,window.location.origin);}}};c('mixInEventEmitter')(u,{messageReceived:true,multiwayMessageReceived:true});f.exports=u;},null);
__d('FBRTCMessageHandler',['invariant','Bootloader','FBRTCMessageListener','FBRTCSupport'],function a(b,c,d,e,f,g,h){if(c.__markCompiled)c.__markCompiled();var i=null,j=false,k=null,l={init:function(){if(!j&&c('FBRTCSupport').isReceiveWebrtcSupported()){j=true;c('FBRTCMessageListener').init(false);c('FBRTCMessageListener').once('messageReceived',function(o){m();});c('FBRTCMessageListener').once('multiwayMessageReceived',function(o){n(o);});}},resetListener:function(){!i?h(0):void 0;c('FBRTCMessageListener').removeMessageHandler();c('FBRTCMessageListener').setMessageHandler(i.onMessageReceived,i);}};function m(){if(!i)c('Bootloader').loadModules(["FBRTCIncomingCallController","FBRTCIncomingCallDialog","FBRTCMissedVideoCallHandler","FBRTCUnsupportedBrowserMessage"],function(o,p,q,r){i=new o(p,r,new q());c('FBRTCMessageListener').setMessageHandler(i.onMessageReceived,i);});}function n(o){if(!k)c('Bootloader').loadModules(["FBRTCGroupCallIncomingController"],function(p){k=new p();c('FBRTCMessageListener').setMultiwayMessageHandler(k.onMessageReceived,k);k.onMessageReceived(o);});}f.exports=l;},null);
__d('HotLikeSound',['MercuryConfig','SoundPlayer','StickerConstants'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();c('SoundPlayer').init(['audio/ogg','audio/mpeg']);var h=[c('MercuryConfig')['sound.hot_like_grow_mp3_url'],c('MercuryConfig')['sound.hot_like_grow_ogg_url']],i=[c('MercuryConfig')['sound.hot_like_pop_mp3_url'],c('MercuryConfig')['sound.hot_like_pop_ogg_url']],j=[c('MercuryConfig')['sound.hot_like_outgoing_small_mp3_url'],c('MercuryConfig')['sound.hot_like_outgoing_small_ogg_url']],k=[c('MercuryConfig')['sound.hot_like_outgoing_medium_mp3_url'],c('MercuryConfig')['sound.hot_like_outgoing_medium_ogg_url']],l=[c('MercuryConfig')['sound.hot_like_outgoing_large_mp3_url'],c('MercuryConfig')['sound.hot_like_outgoing_large_ogg_url']],m=function(){return false;},n={setCheckSoundEnabledFunc:function(o){m=o;},start:function(){this._play(h);},stop:function(){c('SoundPlayer').stop(h);},pop:function(){this.stop();this._play(i);},snap:function(o){this.stop();if(o===c('StickerConstants').HOT_LIKE_SMALL_STICKER_ID)this._play(j);if(o===c('StickerConstants').HOT_LIKE_MEDIUM_STICKER_ID)this._play(k);if(o===c('StickerConstants').HOT_LIKE_LARGE_STICKER_ID)this._play(l);},_play:function(o){if(m())c('SoundPlayer').play(o);}};f.exports=n;},null);
__d('MNCommerceActionTypes',['keyMirrorRecursive'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();var h=c('keyMirrorRecursive')({RECEIPT:{LOADED:null,LOAD_ERROR:null,RELOAD:null},SHIPMENT:{LOADED:null,LOAD_ERROR:null,RELOAD:null},DIALOG:{SHOW:null,HIDE:null},RETAIL_ITEM:{LOADED:null,LOAD_ERROR:null,RELOAD:null},PROMOTION_STATE:{LOADED:null,LOAD_ERROR:null,RELOAD:null},TRANSACTION_INVOICE:{LOADED:null,LOAD_ERROR:null,RELOAD:null}});f.exports=h;},null);
__d('MessengerDispatcher',['Dispatcher_DEPRECATED'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();f.exports=new (c('Dispatcher_DEPRECATED'))();},null);
__d('MNCommerceDialogStateStore',['FluxStore','MessengerDispatcher','MNCommerceActionTypes'],function a(b,c,d,e,f,g){'use strict';var h,i;if(c.__markCompiled)c.__markCompiled();h=babelHelpers.inherits(j,c('FluxStore'));i=h&&h.prototype;function j(){i.constructor.call(this,c('MessengerDispatcher'));this.$MNCommerceDialogStateStore1=null;this.$MNCommerceDialogStateStore2=null;}j.prototype.__onDispatch=function(k){var l=k.type;switch(l){case c('MNCommerceActionTypes').DIALOG.SHOW:this.$MNCommerceDialogStateStore1=k.dialogContainer;this.$MNCommerceDialogStateStore2=k.state;this.__emitChange();break;case c('MNCommerceActionTypes').DIALOG.HIDE:this.$MNCommerceDialogStateStore1=null;this.$MNCommerceDialogStateStore2=null;this.__emitChange();break;}};j.prototype.getDialogContainer=function(){return this.$MNCommerceDialogStateStore1;};j.prototype.getState=function(){return this.$MNCommerceDialogStateStore2;};f.exports=new j();},null);
__d('PureStoreBasedStateMixin',['invariant','StoreBasedStateMixinHelper','setImmediate'],function a(b,c,d,e,f,g,h){'use strict';if(c.__markCompiled)c.__markCompiled();var i=function(){for(var j=arguments.length,k=Array(j),l=0;l<j;l++)k[l]=arguments[l];return {getInitialState:function(){return this.constructor.calculateState();},componentWillMount:function(){!this.constructor.calculateState?h(0):void 0;this._recalculateStateID=null;var m=function(){if(this.isMounted())this.setState(this.constructor.calculateState());this._recalculateStateID=null;}.bind(this);this._mixin=new (c('StoreBasedStateMixinHelper'))(k);this._mixin.subscribeCallback(function(){if(this._recalculateStateID===null)this._recalculateStateID=c('setImmediate')(m);}.bind(this));},componentWillUnmount:function(){this._mixin.release();this._mixin=null;}};}.bind(this);f.exports=i;},null);
__d('MNCommerceDialogContainer.react',['MNCommerceDialogStateStore','PureStoreBasedStateMixin','React'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();var h=c('React').createClass({displayName:'MNCommerceDialogContainer',mixins:[c('PureStoreBasedStateMixin')(c('MNCommerceDialogStateStore'))],statics:{calculateState:function(){var i=c('MNCommerceDialogStateStore').getDialogContainer();return {dialogContainer:i};}},render:function(){var i=this.state.dialogContainer;if(!i)return null;return c('React').createElement(i,null);}});f.exports=h;},null);
__d('MercuryChannelMessageTransformer',['MercuryActionType'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();function h(i,j){var k={author:i.mercury_author_id,author_email:i.mercury_author_email,body:i.body,subject:i.subject,has_attachment:i.has_attachment,attachments:i.attachments,ephemeral_ttl_mode:i.ephemeral_ttl_mode,html_body:i.html_body,thread_id:i.tid,thread_fbid:i.thread_fbid&&i.thread_fbid.toString(),other_user_fbid:i.other_user_fbid&&i.other_user_fbid.toString(),offline_threading_id:i.offline_threading_id,message_id:i.mid,is_spoof_warning:i.is_spoof_warning,ranges:i.ranges,source:i.mercury_source,source_tags:i.mercury_source_tags,tags:i.tags&&i.tags.split(','),threading_id:i.threading_id,timestamp:i.timestamp,timestamp_absolute:i.timestamp_absolute,timestamp_relative:i.timestamp_relative,timestamp_datetime:i.timestamp_datetime,timestamp_time_passed:i.timestamp_time_passed,action_type:c('MercuryActionType').USER_GENERATED_MESSAGE,is_unread:i.is_unread,is_forward:false,forward_count:i.forward_count||i.forward,forward_message_ids:i.forward_msg_ids,folder:j,sync_id:i.sync_id};return k;}f.exports={transform:h};},null);
__d('MercuryDelayedDispatcher',['MercuryDispatcher','MercuryServerPayloadPreprocessor','MercuryServerRequests','MercurySingletonProvider','MercuryThreadIDMap'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();function h(j){this.$MercuryDelayedDispatcher1=j;this.$MercuryDelayedDispatcher2=[];this.$MercuryDelayedDispatcher3=c('MercuryThreadIDMap').getForFBID(this.$MercuryDelayedDispatcher1);this.$MercuryDelayedDispatcher4=c('MercuryDispatcher').getForFBID(this.$MercuryDelayedDispatcher1);this.$MercuryDelayedDispatcher5=c('MercuryServerRequests').getForFBID(this.$MercuryDelayedDispatcher1);this.$MercuryDelayedDispatcher6=c('MercuryServerPayloadPreprocessor').getForFBID(this.$MercuryDelayedDispatcher1);this.$MercuryDelayedDispatcher4.subscribe('model-update-completed',function(k,l){return this.$MercuryDelayedDispatcher7();}.bind(this));}h.getForFBID=function(j){return i.getForFBID(j);};h.get=function(){return i.get();};h.prototype.handleUpdateWaitForThread=function(j,k){var l=this.$MercuryDelayedDispatcher3.getClientIDFromServerIDNow(k);if(l){this.$MercuryDelayedDispatcher8(j);return;}this.$MercuryDelayedDispatcher3.getClientIDFromServerID(k,function(){return this.$MercuryDelayedDispatcher2.push(j);}.bind(this));this.$MercuryDelayedDispatcher5.ensureThreadIsFetched(k);};h.prototype.$MercuryDelayedDispatcher7=function(){if(this.$MercuryDelayedDispatcher2&&this.$MercuryDelayedDispatcher2.length){var j=this.$MercuryDelayedDispatcher2[0];this.$MercuryDelayedDispatcher2=this.$MercuryDelayedDispatcher2.slice(1);this.$MercuryDelayedDispatcher8(j);}};h.prototype.$MercuryDelayedDispatcher8=function(j){if(j.from_client){this.$MercuryDelayedDispatcher4.handleUpdate(j);}else this.$MercuryDelayedDispatcher6.handleUpdate(j);};var i=new (c('MercurySingletonProvider'))(h);f.exports=h;},null);
__d('MercuryChannelHandler',['Arbiter','ChannelConstants','LogHistory','MercuryActionType','MercuryChannelMessageTransformer','MercuryConfig','MercuryDelayedDispatcher','MercuryGlobalActionType','MercuryLogMessageType','MercuryMessages','MercuryPayloadSource','MercuryServerPayloadPreprocessor','MercurySingletonMixin','MercuryThreadInformer','MercuryViewer','MessagingEvent','MessagingTag','PresenceUtil','mixin'],function a(b,c,d,e,f,g){var h,i;if(c.__markCompiled)c.__markCompiled();var j=c('LogHistory').getInstance('mercury_channel_handler');h=babelHelpers.inherits(k,c('mixin')(c('MercurySingletonMixin')));i=h&&h.prototype;function k(l){'use strict';i.constructor.call(this);this.$MercuryChannelHandler1=l;this.__payloadPreprocessor=c('MercuryServerPayloadPreprocessor').getForFBID(this.$MercuryChannelHandler1);this.$MercuryChannelHandler2=c('MercuryThreadInformer').getForFBID(this.$MercuryChannelHandler1);this.$MercuryChannelHandler3=c('MercuryMessages').getForFBID(this.$MercuryChannelHandler1);this.__delayedDispatcher=c('MercuryDelayedDispatcher').getForFBID(this.$MercuryChannelHandler1);this.$MercuryChannelHandler4=[];}k.prototype.getInstanceFBID=function(){'use strict';return this.$MercuryChannelHandler1;};k.prototype.$MercuryChannelHandler5=function(l,m){'use strict';if(!this.$MercuryChannelHandler6(l)||!m.obj||!m.obj.message)return;var n=m.obj.message,o=n.other_user_fbid?n.other_user_fbid:n.thread_fbid;o=o.toString();var p=c('MercuryChannelMessageTransformer').transform(n,m.obj.folder);if(this.__shouldDropMessageBecauseOfSync(n)){j.debug('dropped',JSON.stringify(n));return;}var q=[babelHelpers['extends']({},p)];q=q.concat(n.forward_actions||[]);var r=c('MercuryPayloadSource').CLIENT_CHANNEL_MESSAGE;this.__delayedDispatcher.handleUpdateWaitForThread({actions:q,payload_source:r},o);};k.prototype.$MercuryChannelHandler7=function(l,m){'use strict';if(c('MercuryConfig').WWWSyncDeliveryReceipt)return;var n=m.obj.other_user_fbid,o=m.obj.thread_fbid;if(!this.$MercuryChannelHandler6(l)||!n&&!o)return;this.__payloadPreprocessor.handleUpdate({delivery_receipts:[{other_user_fbid:n?n.toString():'',thread_fbid:o?o.toString():'',time:m.obj.timestamp}]});};k.prototype.$MercuryChannelHandler8=function(l,m){'use strict';if(!this.$MercuryChannelHandler6(l)||!m.obj||!m.obj.thread_fbids&&!m.obj.other_user_fbids)return;var n=[],o=m.obj.event==c('MessagingEvent').READ;if(o&&this.__shouldDropMarkReadBecauseOfSync())return;(m.obj.thread_fbids||[]).forEach(function(p){n.push({action_type:c('MercuryActionType').CHANGE_READ_STATUS,thread_fbid:p,mark_as_read:o,timestamp:m.obj.timestamp||0,folder:m.obj.folder_info[p]});});(m.obj.other_user_fbids||[]).forEach(function(p){n.push({action_type:c('MercuryActionType').CHANGE_READ_STATUS,other_user_fbid:p,mark_as_read:o,timestamp:m.obj.timestamp||0,folder:m.obj.folder_info[p]});});this.__payloadPreprocessor.handleUpdate({actions:n,payload_source:c('MercuryPayloadSource').CLIENT_CHANNEL_MESSAGE});};k.prototype.$MercuryChannelHandler9=function(l,m){'use strict';if(this.__shoudDropDeleteThreadBecauseOfSync())return;if(!this.$MercuryChannelHandler6(l)||!m.obj||!(m.obj.thread_fbids||m.obj.other_user_fbids))return;var n=[];(m.obj.thread_fbids||[]).forEach(function(o){n.push({action_type:c('MercuryActionType').DELETE_THREAD,thread_fbid:o});});(m.obj.other_user_fbids||[]).forEach(function(o){n.push({action_type:c('MercuryActionType').DELETE_THREAD,other_user_fbid:o});});this.__payloadPreprocessor.handleUpdate({actions:n,payload_source:c('MercuryPayloadSource').CLIENT_CHANNEL_MESSAGE});};k.prototype.$MercuryChannelHandler10=function(l,m){'use strict';if(c('MercuryConfig').WWWSyncDeleteMessage)return;if(!this.$MercuryChannelHandler6(l)||!m.obj||!m.obj.thread_fbids&&!m.obj.other_user_fbids||!m.obj.mids)return;var n=m.obj.thread_fbids.length?m.obj.thread_fbids[0]:null,o=m.obj.other_user_fbids.length?m.obj.other_user_fbids[0]:null,p={action_type:c('MercuryActionType').DELETE_MESSAGES,thread_fbid:n,other_user_fbid:o,message_ids:m.obj.mids};if(c('MercuryConfig').MessengerGlobalDeleteGK){if(m.obj.updated_thread)return;this.__payloadPreprocessor.handleUpdate({actions:[p],payload_source:c('MercuryPayloadSource').CLIENT_CHANNEL_MESSAGE});return;}this.__payloadPreprocessor.handleUpdate({actions:[p],payload_source:c('MercuryPayloadSource').CLIENT_CHANNEL_MESSAGE});};k.prototype.$MercuryChannelHandler11=function(l,m){'use strict';if(!this.$MercuryChannelHandler6(l)||!m.obj||!m.obj.folder)return;if(c('MercuryConfig').WWWSyncMarkRead)return;var n={action_type:c('MercuryGlobalActionType').MARK_ALL_READ,folder:m.obj.folder};this.__payloadPreprocessor.handleUpdate({global_actions:[n]});};k.prototype.$MercuryChannelHandler12=function(l,m){'use strict';if(c('MercuryConfig').WWWSyncMsgLog)return;if(!this.$MercuryChannelHandler6(l)||!m.obj.thread_fbids&&!m.obj.other_user_fbids)return;var n=c('MercuryPayloadSource').CLIENT_CHANNEL_MESSAGE;(m.obj.thread_fbids||[]).forEach(function(o){var p={action_type:c('MercuryActionType').CHANGE_ARCHIVED_STATUS,thread_fbid:o.toString(),other_user_fbid:null,archived:m.obj.state};this.__delayedDispatcher.handleUpdateWaitForThread({actions:[babelHelpers['extends']({},p)],payload_source:n},o.toString());},this);(m.obj.other_user_fbids||[]).forEach(function(o){var p={action_type:c('MercuryActionType').CHANGE_ARCHIVED_STATUS,thread_fbid:null,other_user_fbid:o.toString(),archived:m.obj.state};this.__delayedDispatcher.handleUpdateWaitForThread({actions:[babelHelpers['extends']({},p)],payload_source:n},o.toString());},this);};k.prototype.$MercuryChannelHandler13=function(l,m){'use strict';if(!this.$MercuryChannelHandler6(l)||!m.obj.thread_fbids&&!m.obj.other_user_fbids)return;var n=c('MercuryPayloadSource').CLIENT_CHANNEL_MESSAGE,o;(m.obj.thread_fbids||[]).forEach(function(p){if(m.obj.event==c('MessagingEvent').TAG){o=m.obj.tag;}else o=m.obj.marked_as_spam?c('MessagingTag').SPAM:c('MessagingTag').INBOX;var q={action_type:c('MercuryActionType').CHANGE_FOLDER,thread_fbid:p.toString(),other_user_fbid:null,new_folder:o};this.__delayedDispatcher.handleUpdateWaitForThread({actions:[babelHelpers['extends']({},q)],payload_source:n},p.toString());},this);(m.obj.other_user_fbids||[]).forEach(function(p){if(m.obj.event==c('MessagingEvent').TAG){o=m.obj.tag;}else o=m.obj.marked_as_spam?c('MessagingTag').SPAM:c('MessagingTag').INBOX;var q={action_type:c('MercuryActionType').CHANGE_FOLDER,other_user_fbid:p.toString(),thread_fbid:null,new_folder:o};this.__delayedDispatcher.handleUpdateWaitForThread({actions:[babelHelpers['extends']({},q)],payload_source:n},p.toString());},this);};k.prototype.$MercuryChannelHandler14=function(l,m){'use strict';if(!this.$MercuryChannelHandler6(l)||!m.obj.tag)return;switch(m.obj.tag){case c('MessagingTag').ACTION_ARCHIVED:this.$MercuryChannelHandler12(l,m);break;case c('MessagingTag').INBOX:case c('MessagingTag').OTHER:this.$MercuryChannelHandler13(l,m);break;}};k.prototype.__markAsSeen=function(l,m){'use strict';if(!this.$MercuryChannelHandler15(l)||!m.obj||!m.obj.seen_timestamp)return;this.__payloadPreprocessor.handleUpdate({message_counts:[{seen_timestamp:m.obj.seen_timestamp,folder:c('MessagingTag').INBOX}],unseen_thread_fbids:[{thread_fbids:[],other_user_fbids:[],folder:c('MessagingTag').INBOX}],payload_source:c('MercuryPayloadSource').CLIENT_CHANNEL_MESSAGE});};k.prototype.__updateModelsFromMercuryPayload=function(l,m){'use strict';if(!this.$MercuryChannelHandler16(l)||!m.obj)return;this.$MercuryChannelHandler2.synchronizeInforms(function(){var n=m.obj,o=[];(n.actions||[]).forEach(function(p){var q=c('MercuryActionType').USER_GENERATED_MESSAGE;if(p.action_type==c('MercuryActionType').LOG_MESSAGE){if(this.__shouldDropLogMessageBecauseOfSync(p))return;var r=c('MercuryPayloadSource').CLIENT_CHANNEL_MESSAGE,s;s=p.other_user_fbid||p.thread_fbid;this.__delayedDispatcher.handleUpdateWaitForThread({actions:[babelHelpers['extends']({},p)],payload_source:r},s);}else if(p.action_type!=q)o.push(p);},this);n.actions=o;n.payload_source=c('MercuryPayloadSource').CLIENT_CHANNEL_MESSAGE;this.__payloadPreprocessor.handleUpdate(n);}.bind(this));};k.prototype.$MercuryChannelHandler17=function(l,m){var n,o;'use strict';if(this.__shouldDropReadReceiptBecauseOfSync())return;var p=m.obj.time,q=m.obj.reader,r=m.obj.thread_fbid||'';this.__payloadPreprocessor.handleUpdate({roger:(o={},o[r]=(n={},n[q]=p,n),o)});};k.prototype.$MercuryChannelHandler18=function(l,m){'use strict';if(!this.$MercuryChannelHandler6(l)||!m.obj||m.obj.message_blocked===undefined||!m.obj.thread_fbid)return;var n=c('MercuryActionType').UPDATE_BLOCKER_STATUS,o=[{action_type:n,thread_fbid:m.obj.thread_fbid,message_blocked:m.obj.message_blocked,is_blocked_by_recipient:m.obj.is_blocked_by_recipient}];this.__payloadPreprocessor.handleUpdate({actions:o,payload_source:c('MercuryPayloadSource').CLIENT_CHANNEL_MESSAGE});};k.prototype.$MercuryChannelHandler19=function(l,m){'use strict';if(!this.$MercuryChannelHandler6(l)||!m.obj||m.obj.got_blocked===undefined||!m.obj.thread_fbid)return;var n=c('MercuryActionType').UPDATE_BLOCKEE_STATUS,o=[{action_type:n,thread_fbid:m.obj.thread_fbid,got_blocked:m.obj.got_blocked}];this.__payloadPreprocessor.handleUpdate({actions:o,payload_source:c('MercuryPayloadSource').CLIENT_CHANNEL_MESSAGE});};k.prototype.$MercuryChannelHandler20=function(l,m){'use strict';if(!this.$MercuryChannelHandler6(l)||!m.obj||m.obj.mute_settings===undefined||!m.obj.thread_fbid&&!m.obj.other_user_fbid)return;if(c('MercuryConfig').WWWSyncMsgLog)return;var n=c('MercuryActionType').CHANGE_MUTE_SETTINGS,o=[{action_type:n,thread_fbid:m.obj.thread_fbid,other_user_fbid:m.obj.other_user_fbid,mute_settings:m.obj.mute_settings}];this.__payloadPreprocessor.handleUpdate({actions:o,payload_source:c('MercuryPayloadSource').CLIENT_CHANNEL_MESSAGE});};k.prototype.__handleMessagingPayload=function(l,m){'use strict';switch(m.obj.event){case c('MessagingEvent').DELIVER:this.$MercuryChannelHandler5(l,m);break;case c('MessagingEvent').DELIVERY_RECEIPT:this.$MercuryChannelHandler7(l,m);break;case c('MessagingEvent').READ:case c('MessagingEvent').UNREAD:this.$MercuryChannelHandler8(l,m);break;case c('MessagingEvent').READ_ALL:this.$MercuryChannelHandler11(l,m);break;case c('MessagingEvent').DELETE:this.$MercuryChannelHandler9(l,m);break;case c('MessagingEvent').DELETE_MESSAGES:this.$MercuryChannelHandler10(l,m);break;case c('MessagingEvent').TAG:this.$MercuryChannelHandler14(l,m);break;case c('MessagingEvent').REPORT_SPAM:this.$MercuryChannelHandler13(l,m);break;case c('MessagingEvent').READ_RECEIPT:this.$MercuryChannelHandler17(l,m);break;case c('MessagingEvent').CHANGE_MUTE_SETTINGS:this.$MercuryChannelHandler20(l,m);break;case c('MessagingEvent').UPDATE_BLOCKER_STATUS:this.$MercuryChannelHandler18(l,m);break;case c('MessagingEvent').UPDATE_BLOCKEE_STATUS:this.$MercuryChannelHandler19(l,m);break;}};k.prototype.getRouting=function(){'use strict';return {mercury:this.__updateModelsFromMercuryPayload,messaging:this.__handleMessagingPayload,inbox:this.__markAsSeen};};k.prototype.__getMessagingPayloadType=function(){'use strict';return c('ChannelConstants').getArbiterType('messaging');};k.prototype.__getMercuryPayloadType=function(){'use strict';return c('ChannelConstants').getArbiterType('mercury');};k.prototype.__getInboxPayloadType=function(){'use strict';return c('ChannelConstants').getArbiterType('inbox');};k.prototype.$MercuryChannelHandler6=function(l){'use strict';return l==this.__getMessagingPayloadType();};k.prototype.$MercuryChannelHandler16=function(l){'use strict';return l==this.__getMercuryPayloadType();};k.prototype.$MercuryChannelHandler15=function(l){'use strict';return l==this.__getInboxPayloadType();};k.prototype.turnOn=function(){'use strict';if(!this.$MercuryChannelHandler4.length){var l=this.getRouting();for(var m in l)this.$MercuryChannelHandler4.push(c('Arbiter').subscribe(c('ChannelConstants').getArbiterType(m),l[m].bind(this)));}return this;};k.prototype.turnOff=function(){'use strict';if(this.$MercuryChannelHandler4.length){this.$MercuryChannelHandler4.forEach(c('Arbiter').unsubscribe);this.$MercuryChannelHandler4=[];}return this;};k.prototype.__shouldDropMessageBecauseOfSync=function(l){'use strict';if(!l.has_attachment&&c('MercuryConfig').WWWSyncMsgText){return true;}else if(l.has_attachment&&c('MercuryConfig').WWWSyncMsgAttach)return true;return false;};k.prototype.__shouldDropLogMessageBecauseOfSync=function(l){'use strict';if(c('MercuryConfig').WWWSyncMsgLog)switch(l.log_message_type){case c('MercuryLogMessageType').UNSUBSCRIBE:case c('MercuryLogMessageType').SUBSCRIBE:case c('MercuryLogMessageType').THREAD_NAME:case c('MercuryLogMessageType').VIDEO_CALL:case c('MercuryLogMessageType').PHONE_CALL:case c('MercuryLogMessageType').THREAD_IMAGE:case c('MercuryLogMessageType').ORION:case c('MercuryLogMessageType').PAGE_REPLY:case c('MercuryLogMessageType').GENERIC_ADMIN_TEXT:return true;case c('MercuryLogMessageType').SERVER_ERROR:case c('MercuryLogMessageType').LIVE_LISTEN:case c('MercuryLogMessageType').SWITCH_TO_WORK:case c('MercuryLogMessageType').WALLPAPER:default:break;}return false;};k.prototype.__shoudDropDeleteThreadBecauseOfSync=function(){'use strict';return c('MercuryConfig').WWWSyncThreadDelete;};k.prototype.__shouldDropMarkReadBecauseOfSync=function(){'use strict';return c('MercuryConfig').WWWSyncMarkRead;};k.prototype.__shouldDropReadReceiptBecauseOfSync=function(){'use strict';return c('MercuryConfig').WWWSyncReadReceipt;};Object.assign(k,c('MercurySingletonMixin'));f.exports=k;},null);
__d('MercuryRoger',['Arbiter','ArbiterMixin','immutable','JSLogger','MercuryActionStatus','MercuryDispatcher','MercurySingletonProvider','MercuryThreads','mixin','mapObject'],function a(b,c,d,e,f,g){var h,i;if(c.__markCompiled)c.__markCompiled();var j=c('MercuryActionStatus').SUCCESS;h=babelHelpers.inherits(k,c('mixin')(c('ArbiterMixin')));i=h&&h.prototype;k.getForFBID=function(o){'use strict';return l.getForFBID(o);};k.get=function(){'use strict';return l.get();};function k(o){'use strict';i.constructor.call(this);this.$MercuryRoger1={};this.$MercuryRoger2=[];this.$MercuryRoger3=o;this.$MercuryRoger4=c('MercuryDispatcher').getForFBID(this.$MercuryRoger3);this.$MercuryRoger5=c('MercuryThreads').getForFBID(this.$MercuryRoger3);this.$MercuryRoger4.subscribe('update-roger',function(p,q){for(var r in q){var s=this.$MercuryRoger1[r]||c('immutable').OrderedMap();s=s.withMutations(function(t){for(var u in q[r]){var v=this.$MercuryRoger5.getThreadMetaNow(r);if(v&&v.participants)if(v.participants.indexOf(u)==-1){this.$MercuryRoger2.push(n(this.$MercuryRoger1));continue;}var w=t.get(u),x=q[r][u];if(!w||x>w)t.set(u,x);}}.bind(this));this.$MercuryRoger1[r]=s.sort();}q&&this.inform('change',q);}.bind(this));this.$MercuryRoger4.subscribe('invalidate-global-state',function(){this.$MercuryRoger6();}.bind(this));c('Arbiter').subscribe(c('JSLogger').DUMP_EVENT,function(p,q){var r={};for(var s in this.$MercuryRoger1)if(this.$MercuryRoger1.hasOwnProperty(s))r[s]=this.$MercuryRoger1[s].toObject();q.read_receipts={valid_receipts:r,bad_receipts:this.$MercuryRoger2};}.bind(this));}k.prototype.getSeenBy=function(o,p){'use strict';if(!o)return [];var q=[],r=this.$MercuryRoger1[o.thread_id];if(!r)return q;r.forEach(function(s,t){if(m(o,s,t,p))q.push(t);});return q;};k.prototype.wasSeenByAll=function(o){'use strict';if(!o)return false;var p=this.$MercuryRoger1[o.thread_id];if(!p)return false;return p.every(function(q,r){return m(o,q,r);});};k.prototype.getSeenTimestamps=function(o){'use strict';var p=this.$MercuryRoger1[o];if(!p){p=c('immutable').OrderedMap();this.$MercuryRoger1[o]=p;}return p;};k.prototype.getSeenTimestamp=function(o,p){'use strict';var q=this.$MercuryRoger1[o];return q?q.get(p):null;};k.prototype.$MercuryRoger6=function(){'use strict';this.$MercuryRoger1={};this.$MercuryRoger2=[];};var l=new (c('MercurySingletonProvider'))(k);function m(o,p,q,r){return !!(p>=o.timestamp&&(o.status===undefined||o.status===j)&&(!r||q!=o.author));}function n(o){return c('mapObject')(o,function(p){return p.toJS();});}f.exports=k;},null);
__d('MercuryDelayedRoger',['ArbiterMixin','LiveTimer','MercuryActionStatus','MercuryConfig','MercuryMessages','MercuryRoger','MercuryThreadInformer','MercuryThreads','setTimeoutAcrossTransitions'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();var h=c('MercuryMessages').get(),i=c('MercuryRoger').get(),j=c('MercuryThreadInformer').get(),k=c('MercuryThreads').get(),l={},m={},n=c('MercuryConfig')['roger.seen_delay'],o={getSeenBy:function(u,v){if(m[u])return [];return i.getSeenBy(p(u),v);},wasSeenByAll:function(u){if(m[u])return false;return i.wasSeenByAll(p(u));}};Object.assign(o,c('ArbiterMixin'));function p(u){if(!l[u]){var v=k.getThreadMetaNow(u);if(v)l[u]={thread_id:u,author:v.participants[0],timestamp:v.timestamp};}return l[u];}function q(u){var v=false;h.getThreadMessagesRange(u,0,1,function(w){var x=w[0];if(!x)return;var y=x.timestamp;if(x.status===c('MercuryActionStatus').SUCCESS)y-=c('LiveTimer').getServerTimeOffset();var z=o.getSeenBy(u);if(m[u]){clearTimeout(m[u]);delete m[u];}var aa=y+n,ba=aa-Date.now();if(ba>0)m[u]=c('setTimeoutAcrossTransitions')(function(){delete m[u];r(u);},ba);l[u]=x;var ca=o.getSeenBy(u);if(z.length||ca.length)v=true;});return v;}function r(u){var v={};v[u]=true;s(v);}function s(u){o.inform('state-changed',u);o.inform('change');}function t(event,u){var v={};for(var w in u)if(q(w))v[w]=true;for(var x in v){s(v);break;}}i.subscribe('change',function(u,v){for(var w in v)!m[w]&&r(w);});j.subscribe('messages-received',t);j.subscribe('messages-reordered',t);j.subscribe('messages-updated',t);f.exports=o;},null);
__d('MercuryDeliveryReceipts',['ArbiterMixin','Map','MercuryDispatcher','MercurySingletonProvider','mixin'],function a(b,c,d,e,f,g){var h,i;if(c.__markCompiled)c.__markCompiled();h=babelHelpers.inherits(j,c('mixin')(c('ArbiterMixin')));i=h&&h.prototype;function j(l){'use strict';i.constructor.call(this);this.$MercuryDeliveryReceipts2=l;this.$MercuryDeliveryReceipts3=new (c('Map'))();this.$MercuryDeliveryReceipts1=c('MercuryDispatcher').getForFBID(this.$MercuryDeliveryReceipts2);this.$MercuryDeliveryReceipts1.subscribe('update-delivery',function(m,n){if(n.delivery_receipts)for(var o in n.delivery_receipts){var p=n.delivery_receipts[o],q=this.$MercuryDeliveryReceipts3.get(o)||0;if(p>q){this.$MercuryDeliveryReceipts3.set(o,p);this.informDeliveryStatusChanged(o);}}}.bind(this));}j.getForFBID=function(l){'use strict';return k.getForFBID(l);};j.get=function(){'use strict';return k.get();};j.prototype.informDeliveryStatusChanged=function(l){'use strict';var m=new (c('Map'))();m.set(l,true);this.inform('change',m);};j.prototype.getDeliveryTime=function(l){'use strict';return this.$MercuryDeliveryReceipts3.get(l)||0;};var k=new (c('MercurySingletonProvider'))(j);f.exports=j;},null);
__d('MercuryDeliveryState',['MercuryConfig','MercuryIDs','MercuryServerRequests','MercurySingletonProvider','MercuryThreadIDMap','MercuryThreadInformer','PresencePrivacy','UserActivity','debounceAcrossTransitions'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();var h=c('MercuryConfig').delivery_timeout||120000;i.getForFBID=function(k){return j.getForFBID(k);};i.get=function(){return j.get();};function i(k){this.$MercuryDeliveryState1=k;this.$MercuryDeliveryState2=c('MercuryServerRequests').getForFBID(this.$MercuryDeliveryState1);this.$MercuryDeliveryState3=c('MercuryThreadInformer').getForFBID(this.$MercuryDeliveryState1);this.$MercuryDeliveryState4=c('MercuryThreadIDMap').getForFBID(this.$MercuryDeliveryState1);this.$MercuryDeliveryState5=[];this.$MercuryDeliveryState6=[];this.$MercuryDeliveryState3.subscribe('messages-received',this.$MercuryDeliveryState7.bind(this));c('UserActivity').subscribe(c('debounceAcrossTransitions')(this.$MercuryDeliveryState8,300,this));}i.prototype.$MercuryDeliveryState7=function(k,l){for(var m in l){var n=l[m];n.forEach(function(o){if(this.$MercuryDeliveryState9(o)){this.$MercuryDeliveryState5.push(o);this.$MercuryDeliveryState4.getServerIDFromClientID(m,function(p){if(!this.$MercuryDeliveryState6[p])this.$MercuryDeliveryState6[p]=[];this.$MercuryDeliveryState6[p].push(o.message_id);}.bind(this));}}.bind(this));}if(c('UserActivity').isActive(h))this.$MercuryDeliveryState8();};i.prototype.$MercuryDeliveryState8=function(){if(this.$MercuryDeliveryState5.length===0&&this.$MercuryDeliveryState6.length===0)return;var k=this.$MercuryDeliveryState5.map(function(l){return l.message_id;});if(k)this.$MercuryDeliveryState2.sendDeliveryReceipts(k,this.$MercuryDeliveryState6);this.$MercuryDeliveryState6=[];this.$MercuryDeliveryState5=[];};i.prototype.$MercuryDeliveryState9=function(k){var l=k.author?c('MercuryIDs').getUserIDFromParticipantID(k.author):null;if(l===this.$MercuryDeliveryState1)return false;if(!k.is_unread)return false;if(!c('PresencePrivacy').allows(l))return false;return true;};var j=new (c('MercurySingletonProvider'))(i);f.exports=i;},null);
__d('MercuryFilters',['MessagingTag','arrayContains'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();var h=[c('MessagingTag').UNREAD],i={ALL:'all',UNREAD:c('MessagingTag').UNREAD,getSupportedFilters:function(){return h.concat();},isSupportedFilter:function(j){return c('arrayContains')(h,j);}};f.exports=i;},null);
__d('MercuryOrderedThreadlist',['LogHistory','MercuryActionType','MercuryDispatcher','MercuryFilters','MercuryFolders','MercuryPayloadSource','MercurySingletonMixin','MercuryThreadIDMap','MessagingTag','PageMessageEnumTag','RangedCallbackManager','MercuryServerRequests','MercuryThreadInformer','MercuryThreads','arrayContains'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();var h=c('LogHistory').getInstance('ordered_threadlist_model'),i=c('MercuryFilters').getSupportedFilters().concat([c('MercuryFilters').ALL,c('MessagingTag').GROUPS]),j=c('MercuryFolders').getSupportedFolders().concat([c('MessagingTag').SPAM]);function k(u,v,w,x){var y=[],z=false,aa=false,ba=(v||[]).filter(function(ia){var ja=ia.filter||c('MercuryFilters').ALL;return (ia.folder==w||!ia.folder&&w==c('MessagingTag').INBOX)&&ja==x;}),ca=u._threadlistOrderMap[w][x].getAllResources(),da;ba.forEach(function(ia){y=y.concat(ia.thread_ids);if(ia.error){if(ia.end>ca.length)aa=ia.error;}else{var ja=ia.end-ia.start;if(ia.thread_ids.length<ja)z=true;}if(!da||ia.end>da)da=ia.end;});o(u,y,w,x);if(z){u._threadlistOrderMap[w][x].setReachedEndOfArray();}else if(aa){u._threadlistOrderMap[w][x].setError(aa);}else{var ea=u._threadlistOrderMap[w][x].getCurrentArraySize();if(da&&ea<da){var fa={},ga=ca.concat(y),ha=ga.filter(function(ia){var ja=fa[ia];fa[ia]=true;return ja;});if(ha.length){h.warn('duplicate_threads',JSON.stringify({folder:w,expected_final_size:da,actual_final_size:ea,duplicate_thread_ids:ha}));u._serverRequests.fetchThreadlistInfo(da,ha.length,w,x==c('MercuryFilters').ALL?null:x);}}}}function l(u,v){j.forEach(function(w){i.forEach(function(x){k(u,v,w,x);});});}function m(u,v){var w={};j.forEach(function(x){w[x]={};i.forEach(function(y){w[x][y]={to_add:[],to_remove:[],to_remove_if_last_after_add:{}};});});v.forEach(function(x){if(x.is_forward)return;var y=x.thread_id,z=p(u,y),aa=q(u,y);function ba(){aa.forEach(function(da){if(!c('arrayContains')(i,da))return;w[z][da].to_add.push(y);if(!u._threadlistOrderMap[z][da].hasReachedEndOfArray()&&!u._threadlistOrderMap[z][da].hasResource(y))w[z][da].to_remove_if_last_after_add[y]=true;});}function ca(da){if(c('arrayContains')(i,da))if(c('arrayContains')(aa,da)){w[z][da].to_add.push(y);}else w[z][da].to_remove.push(y);}if(!z){if(x.action_type===c('MercuryActionType').CHANGE_FOLDER||x.action_type===c('MercuryActionType').CHANGE_ARCHIVED_STATUS)j.forEach(function(da){if(da!==z)i.forEach(function(ea){u._threadlistOrderMap[da][ea].removeResources([y]);});});return;}switch(x.action_type){case c('MercuryActionType').DELETE_THREAD:aa.forEach(function(da){if(!c('arrayContains')(i,da))return;w[z][da].to_remove.push(y);});break;case c('MercuryActionType').CHANGE_ARCHIVED_STATUS:case c('MercuryActionType').CHANGE_FOLDER:ba();break;case c('MercuryActionType').CHANGE_READ_STATUS:ca(c('MessagingTag').UNREAD);break;case c('MercuryActionType').USER_GENERATED_MESSAGE:case c('MercuryActionType').LOG_MESSAGE:aa.forEach(function(da){if(!c('arrayContains')(i,da))return;if(r(u,y,z,da))w[z][da].to_add.push(y);});break;case c('MercuryActionType').CHANGE_FLAG:ca(c('PageMessageEnumTag').FLAG);break;}});j.forEach(function(x){i.forEach(function(y){var z=u._threadlistOrderMap[x][y];o(u,w[x][y].to_add,x,y);for(var aa=z.getCurrentArraySize()-1;aa>=0;aa--){var ba=z.getResourceAtIndex(aa);if(!w[x][y].to_remove_if_last_after_add[ba])break;w[x][y].to_remove.push(ba);}z.removeResources(w[x][y].to_remove);});});}function n(u,v){var w={};j.forEach(function(x){w[x]={};i.forEach(function(y){w[x][y]=[];});});v.forEach(function(x){var y=p(u,x.thread_id),z=q(u,x.thread_id);if(y)z.forEach(function(aa){if(r(u,x.thread_id,y,aa))w[y][aa].push(x.thread_id);});});j.forEach(function(x){i.forEach(function(y){if(w[x][y].length>0)o(u,w[x][y],x,y);});});}function o(u,v,w,x){x=x||c('MercuryFilters').ALL;u._threadlistOrderMap[w][x].addResources(v);j.forEach(function(y){if(y!=w)u._threadlistOrderMap[y][x].removeResources(v);});}function p(u,v){var w=u._threads.getThreadMetaNow(v),x=null;if(!w){x='No thread metadata';}else if(!w.folder)x='No thread folder';if(x){var y={error:x,tid:v};h.warn('no_thread_folder',JSON.stringify(y));return null;}var z=w.folder;if(w.is_archived)z=c('MessagingTag').ACTION_ARCHIVED;if(u._threadlistOrderMap[z]){return z;}else return null;}function q(u,v){var w=u._threads.getThreadMetaNow(v),x=[c('MercuryFilters').ALL];if(!w){var y={error:'no_thread_metadata',tid:v};h.warn('no_thread_metadata',JSON.stringify(y));return [];}if(w.unread_count)x.push(c('MessagingTag').UNREAD);if(!w.is_canonical)x.push(c('MessagingTag').GROUPS);var z=w.page_thread_info;if(z&&z.flagged)x.push(c('PageMessageEnumTag').FLAG);return x;}function r(u,v,w,x){var y=u._threads.getThreadMetaNow(v);return !!(y&&y.timestamp&&p(u,v)==w&&c('arrayContains')(q(u,v),x));}function s(u){this._fbid=u;this._serverRequests=c('MercuryServerRequests').getForFBID(this._fbid);this._threadIDMap=c('MercuryThreadIDMap').getForFBID(this._fbid);this._threadInformer=c('MercuryThreadInformer').getForFBID(this._fbid);this._threads=c('MercuryThreads').getForFBID(this._fbid);this._dispatcher=c('MercuryDispatcher').getForFBID(this._fbid);this._threadlistOrderMap={};this._initializeThreadlistOrderMap();this._dispatcher.subscribe('update-threadlist',function(v,w){if(!t(w))return;var x=w.ordered_threadlists;if(x&&x.length){l(this,x);}else{var y=(w.actions||[]).filter(function(z){return z.thread_id;});n(this,w.threads||[]);m(this,y);}this._threadInformer.updatedThreadlist();}.bind(this));this._dispatcher.subscribe('invalidate-global-state',function(){return this._invalidateGlobalState();}.bind(this));}Object.assign(s.prototype,{getThreadlistOrderMap:function(u,v){if(!this._threadlistOrderMap[u][v]){i=i.concat([v]);j.forEach(function(w){this._threadlistOrderMap[w][v]=new (c('RangedCallbackManager'))(function(x){return this._threads.getThreadMetaNow(x).timestamp;}.bind(this),function(x,y){return y-x;},this._threadIDMap.canLinkExternally.bind(this._threadIDMap));}.bind(this));}return this._threadlistOrderMap[u][v];},getThreadlist:function(u,v,w,x,y,z){return this.getFilteredThreadlist(u,v,w,c('MercuryFilters').ALL,x,y,z);},getFilteredThreadlist:function(u,v,w,x,y,z,aa){var ba=this.getThreadlistOrderMap(w,x),ca=ba.executeOrEnqueue(u,v,y,z),da=ba.getUnavailableResources(ca),ea=ba.getError(u,v,z);if(da.length||ea){if(ba.getCurrentArraySize()<u){var fa={start:u,limit:v,filter:x,resources_size:ba.getCurrentArraySize()};h.warn('range_with_gap',JSON.stringify(fa));}ba.setError(false);this._serverRequests.fetchThreadlistInfo(ba.getCurrentArraySize(),da.length,w,x==c('MercuryFilters').ALL?null:x,aa);}return ca;},getThreadlistUntilTimestamp:function(u,v,w){w=w||c('MercuryFilters').ALL;return this.getThreadlistOrderMap(v,w).getElementsUntil(u);},getAvailableThreadlistNow:function(u,v){v=v||c('MercuryFilters').ALL;return this.getThreadlistOrderMap(u,v).getAllResources();},getThreadCount:function(u,v){v=v||c('MercuryFilters').ALL;return this.getThreadlistOrderMap(u,v).getCurrentArraySize();},hasLoadedThreadlist:function(u,v){v=v||c('MercuryFilters').ALL;return this.getThreadlistOrderMap(u,v).hasReachedEndOfArray();},unsubscribe:function(u,v,w){w=w||c('MercuryFilters').ALL;this.getThreadlistOrderMap(v,w).unsubscribe(u);},_invalidateGlobalState:function(){this._threadlistOrderMap={};this._initializeThreadlistOrderMap();},_initializeThreadlistOrderMap:function(){j.forEach(function(u){this._threadlistOrderMap[u]={};i.forEach(function(v){this._threadlistOrderMap[u][v]=new (c('RangedCallbackManager'))(function(w){return this._threads.getThreadMetaNow(w).timestamp;}.bind(this),function(w,x){return x-w;},this._threadIDMap.canLinkExternally.bind(this._threadIDMap));}.bind(this));}.bind(this));}});Object.assign(s,c('MercurySingletonMixin'));function t(u){switch(u.payload_source){case c('MercuryPayloadSource').CLIENT_CHANGE_ARCHIVED_STATUS:case c('MercuryPayloadSource').CLIENT_CHANGE_READ_STATUS:case c('MercuryPayloadSource').CLIENT_CHANGE_FOLDER:case c('MercuryPayloadSource').CLIENT_CHANNEL_MESSAGE:case c('MercuryPayloadSource').CLIENT_DELETE_MESSAGES:case c('MercuryPayloadSource').CLIENT_DELETE_THREAD:case c('MercuryPayloadSource').CLIENT_SEND_MESSAGE:case c('MercuryPayloadSource').SERVER_SEND_MESSAGE:case c('MercuryPayloadSource').SERVER_FETCH_THREADLIST_INFO:case c('MercuryPayloadSource').SERVER_THREAD_SYNC:case c('MercuryPayloadSource').SERVER_INVALIDATE_GLOBAL_STATE:return true;case c('MercuryPayloadSource').SERVER_INITIAL_DATA:return !!u.ordered_threadlists;default:return false;}}f.exports=s;},null);
__d('MercuryStateCheck',['Arbiter','ChannelConstants','ChatReliabilityInstrumentation','LogHistory','MercuryAPIArgsSource','MercuryConfig','MercuryFolders','MercuryOrderedThreadlist','MercuryServerRequests','MercurySingletonProvider','MercurySyncFakeDFFSender','MessagingTag','URI','requireWeak'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();var h=c('LogHistory').getInstance('mercury_state_check');i.getForFBID=function(k){'use strict';return j.getForFBID(k);};i.get=function(){'use strict';return j.get();};function i(k){'use strict';this.$MercuryStateCheck1=k;this.$MercuryStateCheck3=c('MercuryServerRequests').getForFBID(this.$MercuryStateCheck1);this.$MercuryStateCheck2=c('MercuryOrderedThreadlist').getForFBID(this.$MercuryStateCheck1);this.$MercuryStateCheck4=c('MercurySyncFakeDFFSender').getForFBID(this.$MercuryStateCheck1);if(c('MercuryConfig').WWWSyncIgnoreMercuryStateCheck)return;c('Arbiter').subscribe(c('ChannelConstants').ON_INVALID_HISTORY,function(){this.$MercuryStateCheck5(c('ChannelConstants').ON_INVALID_HISTORY);c('ChatReliabilityInstrumentation').logCHANNEL_HISTORY_INVALID();}.bind(this));c('requireWeak')('ChannelConnection',function(l){l.subscribe(l.CONNECTED,function(m,n){if(!n.init)this.$MercuryStateCheck6(l.CONNECTED);}.bind(this));}.bind(this));}i.prototype.$MercuryStateCheck5=function(k){'use strict';var l;if(c('URI').getRequestURI().getPath().search(/messages/)!==-1){l=c('MercuryFolders').getSupportedFolders();}else l=[c('MessagingTag').INBOX];h.debug('check',JSON.stringify({folders:l,source:k}));if(c('MercuryConfig').WWWSyncGlobalDFFOnChannelReconnect){this.$MercuryStateCheck4.sendGlobalDFF();}else this.$MercuryStateCheck3.fetchMissedMessages(l,c('MercuryAPIArgsSource').MERCURYSYNC);};i.prototype.$MercuryStateCheck6=function(k){'use strict';var l=this.$MercuryStateCheck2.getAvailableThreadlistNow(c('MessagingTag').INBOX)||[];l=l.slice(0,20);h.debug('full_check',JSON.stringify({source:k}));this.$MercuryStateCheck3.fetchThreadData(l,c('MercuryAPIArgsSource').MERCURYSYNC);this.$MercuryStateCheck5(k);};var j=new (c('MercurySingletonProvider'))(i);f.exports=i;},null);
__d('MercurySyncDeltaHolder',['Map'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();function h(){this.$MercurySyncDeltaHolder1=new (c('Map'))();this.$MercurySyncDeltaHolder2=[];}h.prototype.peek=function(){this.$MercurySyncDeltaHolder2=this.$MercurySyncDeltaHolder2.sort(function(i,j){return i-j;});return this.$MercurySyncDeltaHolder2[0];};h.prototype.pop=function(){this.$MercurySyncDeltaHolder2=this.$MercurySyncDeltaHolder2.sort(function(k,l){return k-l;});if(this.$MercurySyncDeltaHolder2.length===0)return undefined;var i=this.$MercurySyncDeltaHolder2.shift(),j=this.$MercurySyncDeltaHolder1.get(i);this.$MercurySyncDeltaHolder1['delete'](i);return {seqID:i,delta:j};};h.prototype.push=function(i,j){if(this.$MercurySyncDeltaHolder1.has(i))return;this.$MercurySyncDeltaHolder1.set(i,j);this.$MercurySyncDeltaHolder2.push(i);};f.exports=h;},null);
__d('MercuryTimestamp',['fbt','formatDate','MercuryTimePassed'],function a(b,c,d,e,f,g,h){if(c.__markCompiled)c.__markCompiled();var i=86400000,j=6*i,k={getFormatedTimestamp:function(l){var m=l/1000;return k.getFormattedTimestampByBucket(m,this.getTimeBucket(l));},getFormattedTimestampByBucket:function(l,m){switch(m){case c('MercuryTimePassed').TODAY:return {absolute:h._("Today"),relative:c('formatDate')(l,'g:ia')};case c('MercuryTimePassed').WEEK_AGO:return {absolute:c('formatDate')(l,'l'),relative:c('formatDate')(l,'D')};case c('MercuryTimePassed').CURRENT_YEAR:return {absolute:c('formatDate')(l,'F j'),relative:c('formatDate')(l,'M j')};default:return {absolute:c('formatDate')(l,'F j, Y'),relative:c('formatDate')(l,'n/j/y')};}},getTimeBucket:function(l){var m=new Date(l),n=new Date(),o=new Date(n.getFullYear(),n.getMonth(),n.getDate());if(o<m){return c('MercuryTimePassed').TODAY;}else if(o-j<m){return c('MercuryTimePassed').WEEK_AGO;}else if(o.getFullYear()===m.getFullYear()){return c('MercuryTimePassed').CURRENT_YEAR;}else return c('MercuryTimePassed').OTHER_YEAR;},getPreciseTimestamp:function(l){return c('formatDate')(new Date(l),k.getPreciseFormat(l));},getPreciseFormat:function(l){var m=k.getTimeBucket(l);switch(m){case c('MercuryTimePassed').TODAY:return 'g:ia';case c('MercuryTimePassed').WEEK_AGO:return 'l g:ia';case c('MercuryTimePassed').CURRENT_YEAR:return 'F jS, g:ia';case c('MercuryTimePassed').OTHER_YEAR:default:return 'F j, Y g:i a';}}};f.exports=k;},null);
__d('MercurySyncNewMessageTransformer',['IrisProtocolMessageLifetime','MercuryActionType','MercuryIDs','MercuryTimestamp','MessagingTag'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();function h(i,j){var k=parseInt(j.messageMetadata.timestamp,10),l=c('MercuryTimestamp').getFormatedTimestamp(k),m=[];if(j.attachments)m=j.attachments.map(function(o){return o.mercury;});var n=j.messageMetadata.tags?j.messageMetadata.tags[0]:undefined;return {message_id:j.messageMetadata.messageId,threading_id:null,offline_threading_id:j.messageMetadata.offlineThreadingId,author:c('MercuryIDs').getParticipantIDFromUserID(j.messageMetadata.actorFbId),author_email:j.messageMetadata.actorFbId+'@facebook.com',ephemeral_ttl_mode:j.ttl?c('IrisProtocolMessageLifetime')[j.ttl]:0,timestamp:k,timestamp_absolute:l.absolute,timestamp_relative:l.relative,timestamp_datetime:l.relative,timestamp_time_passed:c('MercuryTimestamp').getTimeBucket(k),is_unread:i!==j.messageMetadata.actorFbId,is_forward:false,is_filtered_content:false,is_filtered_content_bh:false,is_filtered_content_account:false,is_filtered_content_quasar:false,is_filtered_content_invalid_app:false,forward_count:0,forward_message_ids:[],source:n,tags:j.messageMetadata.tags,is_spoof_warning:false,folder:c('MessagingTag').INBOX,thread_fbid:j.messageMetadata.threadKey.threadFbId,other_user_fbid:j.messageMetadata.threadKey.otherUserFbId,body:j.body!==undefined?j.body:'',html_body:null,subject:null,has_attachment:m.length>0,attachments:m,ranges:undefined,thread_id:null,action_type:c('MercuryActionType').USER_GENERATED_MESSAGE,is_from_iris:true,is_sponsored:!!(j.data&&j.data.is_sponsored&&j.data.is_sponsored==='true')};}f.exports={transform:h};},null);
__d('MercurySyncAdminTextMessageTransformer',['MercuryActionType','MercuryLogMessageType','MercurySyncNewMessageTransformer'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();function h(i,j){var k=c('MercurySyncNewMessageTransformer').transform(i,j);k.action_type=c('MercuryActionType').LOG_MESSAGE;k.log_message_body=j.messageMetadata.adminText;k.log_message_data={message_type:j.type,untypedData:j.untypedData};k.log_message_type=c('MercuryLogMessageType').GENERIC_ADMIN_TEXT;return k;}f.exports={transform:h};},null);
__d('MercurySyncDeliveryReceiptTransformer',[],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();function h(i){return {delivery_receipts:[{other_user_fbid:i.threadKey.otherUserFbId?i.threadKey.otherUserFbId:'',thread_fbid:i.threadKey.threadFbId?i.threadKey.threadFbId:'',time:parseInt(i.deliveredWatermarkTimestampMs,10)}]};}f.exports={transform:h};},null);
__d('MercurySyncMarkReadTransformer',['MercuryActionType','MercuryGlobalActionType','MessagingTag'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();function h(i){if(i.folders&&i.folders.length>0)return i.folders.map(function(j){return {action_type:c('MercuryGlobalActionType').MARK_ALL_READ,action_id:null,folder:j,timestamp:parseInt(i.watermarkTimestamp,10)};});return i.threadKeys.map(function(j){return {action_type:c('MercuryActionType').CHANGE_READ_STATUS,other_user_fbid:j.otherUserFbId,thread_fbid:j.threadFbId,mark_as_read:true,timestamp:parseInt(i.watermarkTimestamp,10),folder:c('MessagingTag').INBOX};});}f.exports={transform:h};},null);
__d('MercurySyncMessageDeleteTransformer',['MercuryActionType'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();function h(i){return {action_type:c('MercuryActionType').DELETE_MESSAGES,message_ids:i.messageIds,other_user_fbid:i.threadKey.otherUserFbId,thread_fbid:i.threadKey.threadFbId};}f.exports={transform:h};},null);
__d('MercurySyncPagesManagerEventTransformer',['MercuryActionType','PagesMessagingEventType'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();function h(i){var j=JSON.parse(i.jsonBlob),k=j&&j.type;if(!k)return undefined;switch(k){case c('PagesMessagingEventType').FLAG:var l=!!(j&&j.flagData&&j.flagData.state),m={action_type:c('MercuryActionType').CHANGE_FLAG,mark_as_flag:l,other_user_fbid:i.threadKey.otherUserFbId,thread_fbid:i.threadKey.threadFbId};return m;default:return undefined;}}f.exports={transform:h};},null);
__d('MercurySyncParticipantLeftGroupThreadTransformer',['MercuryActionType','MercuryIDs','MercuryLogMessageType','MercurySyncNewMessageTransformer'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();'use strict';function h(i,j){var k=c('MercurySyncNewMessageTransformer').transform(i,j);k.action_type=c('MercuryActionType').LOG_MESSAGE;k.log_message_body=j.messageMetadata.adminText;k.log_message_data={removed_participants:[c('MercuryIDs').getParticipantIDFromUserID(j.leftParticipantFbId)]};k.log_message_type=c('MercuryLogMessageType').UNSUBSCRIBE;return k;}f.exports={transform:h};},null);
__d('MercurySyncParticipantsAddedToGroupThreadTransformer',['MercuryActionType','MercuryIDs','MercuryLogMessageType','MercurySyncNewMessageTransformer'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();'use strict';function h(i,j){var k=c('MercurySyncNewMessageTransformer').transform(i,j);k.action_type=c('MercuryActionType').LOG_MESSAGE;k.log_message_body=j.messageMetadata.adminText;k.log_message_data={added_participants:j.addedParticipants.map(function(l){return (c('MercuryIDs').getParticipantIDFromUserID(l.userFbId));})};k.log_message_type=c('MercuryLogMessageType').SUBSCRIBE;return k;}f.exports={transform:h};},null);
__d('MercurySyncRTCEventLogTransformer',['MercuryActionType','MercuryIDs','MercuryLogMessageType','MercurySyncNewMessageTransformer'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();'use strict';function h(i,j){var k=c('MercurySyncNewMessageTransformer').transform(i,j),l=j.messageMetadata.actorFbId,m=l===i?j.messageMetadata.threadKey.otherUserFbId:i;k.action_type=c('MercuryActionType').LOG_MESSAGE;k.log_message_body=j.messageMetadata.adminText;k.log_message_data={answered:j.duration>0,callee:c('MercuryIDs').getParticipantIDFromUserID(m),caller:c('MercuryIDs').getParticipantIDFromUserID(l)};k.log_message_type=c('MercuryLogMessageType').VIDEO_CALL;return k;}f.exports={transform:h};},null);
__d('MercurySyncReadReceiptTransformer',[],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();function h(i){var j=parseInt(i.actionTimestampMs,10),k=i.threadKey.otherUserFbId||i.actorFbId,l=i.threadKey.otherUserFbId||i.threadKey.threadFbId,m={roger:{}};m.roger[l]={};m.roger[l][k]=j;return m;}f.exports={transform:h};},null);
__d('MercurySyncReplaceMessageTransformer',['MercuryActionType','MercurySyncNewMessageTransformer'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();function h(i,j){j=Object.assign({},j.newMessage,j);return Object.assign(c('MercurySyncNewMessageTransformer').transform(i,j),{action_type:c('MercuryActionType').REPLACE_MESSAGE,replaced_message_id:j.replacedMessageId});}f.exports={transform:h};},null);
__d('MercurySyncThreadActionTransformer',['MercuryActionType','MessagingThreadAction'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();function h(i){var j={action_type:c('MercuryActionType').CHANGE_ARCHIVED_STATUS,thread_fbid:i.threadKey.threadFbId,other_user_fbid:i.threadKey.otherUserFbId,archived:i.action===c('MessagingThreadAction').ACTION_ARCHIVED};return j;}f.exports={transform:h};},null);
__d('MercurySyncThreadAdminsAddToGroupTransformer',['MercuryActionType','MercuryIDs'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();function h(i){return {action_type:c('MercuryActionType').ADD_GROUP_ADMINS,action_id:null,thread_fbid:i.messageMetadata.threadKey.threadFbId,added_admin_ids:i.addedAdmins.map(function(j){return c('MercuryIDs').getParticipantIDFromUserID(j.userFbId);})};}f.exports={transform:h};},null);
__d('MercurySyncThreadAdminsRemovedFromGroupTransformer',['MercuryActionType','MercuryIDs'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();function h(i){return {action_type:c('MercuryActionType').REMOVE_GROUP_ADMINS,action_id:null,thread_fbid:i.messageMetadata.threadKey.threadFbId,removed_admin_ids:i.removedAdminFbIds.map(function(j){return c('MercuryIDs').getParticipantIDFromUserID(j);})};}f.exports={transform:h};},null);
__d('MercurySyncThreadDeleteTransformer',['MercuryActionType'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();function h(i){return i.threadKeys.map(function(j){return {action_type:c('MercuryActionType').DELETE_THREAD,other_user_fbid:j.otherUserFbId,thread_fbid:j.threadFbId};});}f.exports={transform:h};},null);
__d('MercurySyncThreadMuteSettingsTransformer',['MercuryActionType'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();function h(i){var j={action_type:c('MercuryActionType').CHANGE_MUTE_SETTINGS,thread_fbid:i.threadKey.threadFbId,other_user_fbid:i.threadKey.otherUserFbId,mute_settings:parseInt(i.expireTime,10)};return j;}f.exports={transform:h};},null);
__d('MercurySyncThreadNameTransformer',['MercuryActionType','MercuryLogMessageType','MercurySyncNewMessageTransformer'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();'use strict';function h(i,j){var k=c('MercurySyncNewMessageTransformer').transform(i,j);k.action_type=c('MercuryActionType').LOG_MESSAGE;k.log_message_body=j.messageMetadata.adminText;k.log_message_data={name:j.name};k.log_message_type=c('MercuryLogMessageType').THREAD_NAME;return k;}f.exports={transform:h};},null);
__d('MercurySyncDispatcher',['MercuryConfig','MercuryDelayedDispatcher','MercuryGlobalActionType','MercuryPayloadSource','MercuryServerPayloadPreprocessor','MercurySyncThreadAdminsAddToGroupTransformer','MercurySyncThreadAdminsRemovedFromGroupTransformer','MercurySyncAdminTextMessageTransformer','MercurySyncDeliveryReceiptTransformer','MercurySyncMarkReadTransformer','MercurySyncMessageDeleteTransformer','MercurySyncNewMessageTransformer','MercurySyncReadReceiptTransformer','MercurySyncPagesManagerEventTransformer','MercurySyncParticipantLeftGroupThreadTransformer','MercurySyncParticipantsAddedToGroupThreadTransformer','MercurySyncRTCEventLogTransformer','MercurySyncThreadDeleteTransformer','MercurySyncThreadMuteSettingsTransformer','MercurySyncThreadNameTransformer','MercurySyncThreadActionTransformer','MercurySyncReplaceMessageTransformer','MercurySyncDeltaTypes','MercurySingletonProvider'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();h.getForFBID=function(j){return i.getForFBID(j);};h.get=function(){return i.get();};function h(j){this.$MercurySyncDispatcher1=j;this.$MercurySyncDispatcher2=c('MercuryDelayedDispatcher').getForFBID(this.$MercurySyncDispatcher1);this.$MercurySyncDispatcher3=c('MercuryServerPayloadPreprocessor').getForFBID(this.$MercurySyncDispatcher1);}h.prototype.process=function(j){var k;switch(j['class']){case c('MercurySyncDeltaTypes').NewMessage:if(!this.$MercurySyncDispatcher4(j))break;k=c('MercurySyncNewMessageTransformer').transform(this.$MercurySyncDispatcher1,j);this.$MercurySyncDispatcher5(k);break;case c('MercurySyncDeltaTypes').ReplaceMessage:if(!this.$MercurySyncDispatcher4(j))break;k=c('MercurySyncReplaceMessageTransformer').transform(this.$MercurySyncDispatcher1,j);this.$MercurySyncDispatcher5(k);break;case c('MercurySyncDeltaTypes').DeliveryReceipt:if(!c('MercuryConfig').WWWSyncDeliveryReceipt)break;k=c('MercurySyncDeliveryReceiptTransformer').transform(j);this.$MercurySyncDispatcher3.handleUpdate(k);break;case c('MercurySyncDeltaTypes').MarkRead:if(!c('MercuryConfig').WWWSyncMarkRead)break;k=c('MercurySyncMarkReadTransformer').transform(j);var l=false;for(var m=0;m<k.length;m++){var n=k[m];if(n.action_type===c('MercuryGlobalActionType').MARK_ALL_READ)l=true;}if(l)return;this.$MercurySyncDispatcher6(k);break;case c('MercurySyncDeltaTypes').ParticipantLeftGroupThread:if(!c('MercuryConfig').WWWSyncMsgLog)break;k=c('MercurySyncParticipantLeftGroupThreadTransformer').transform(this.$MercurySyncDispatcher1,j);this.$MercurySyncDispatcher5(k);break;case c('MercurySyncDeltaTypes').ParticipantsAddedToGroupThread:if(!c('MercuryConfig').WWWSyncMsgLog)break;k=c('MercurySyncParticipantsAddedToGroupThreadTransformer').transform(this.$MercurySyncDispatcher1,j);this.$MercurySyncDispatcher5(k);break;case c('MercurySyncDeltaTypes').RTCEventLog:if(!c('MercuryConfig').WWWSyncMsgLog)break;k=c('MercurySyncRTCEventLogTransformer').transform(this.$MercurySyncDispatcher1,j);this.$MercurySyncDispatcher5(k);break;case c('MercurySyncDeltaTypes').ThreadName:if(!c('MercuryConfig').WWWSyncMsgLog)break;k=c('MercurySyncThreadNameTransformer').transform(this.$MercurySyncDispatcher1,j);this.$MercurySyncDispatcher5(k);break;case c('MercurySyncDeltaTypes').ReadReceipt:if(!c('MercuryConfig').WWWSyncReadReceipt)break;k=c('MercurySyncReadReceiptTransformer').transform(j);this.$MercurySyncDispatcher3.handleUpdate(k);break;case c('MercurySyncDeltaTypes').AdminTextMessage:if(!c('MercuryConfig').WWWSyncMsgLog)break;k=c('MercurySyncAdminTextMessageTransformer').transform(this.$MercurySyncDispatcher1,j);this.$MercurySyncDispatcher5(k);break;case c('MercurySyncDeltaTypes').MessageDelete:if(!c('MercuryConfig').WWWSyncDeleteMessage)break;k=c('MercurySyncMessageDeleteTransformer').transform(j);this.$MercurySyncDispatcher5(k);break;case c('MercurySyncDeltaTypes').ThreadAction:if(!c('MercuryConfig').WWWSyncMsgLog)break;k=c('MercurySyncThreadActionTransformer').transform(j);this.$MercurySyncDispatcher5(k);break;case c('MercurySyncDeltaTypes').ThreadDelete:if(!c('MercuryConfig').WWWSyncThreadDelete)break;k=c('MercurySyncThreadDeleteTransformer').transform(j);this.$MercurySyncDispatcher6(k);break;case c('MercurySyncDeltaTypes').AdminAddedToGroupThread:k=c('MercurySyncThreadAdminsAddToGroupTransformer').transform(j);this.$MercurySyncDispatcher5(k);break;case c('MercurySyncDeltaTypes').AdminRemovedFromGroupThread:k=c('MercurySyncThreadAdminsRemovedFromGroupTransformer').transform(j);this.$MercurySyncDispatcher5(k);break;case c('MercurySyncDeltaTypes').ThreadMuteSettings:k=c('MercurySyncThreadMuteSettingsTransformer').transform(j);this.$MercurySyncDispatcher6([k]);break;case c('MercurySyncDeltaTypes').PagesManagerEvent:k=c('MercurySyncPagesManagerEventTransformer').transform(j);if(!k)return;this.$MercurySyncDispatcher6([k]);break;default:break;}};h.prototype.$MercurySyncDispatcher4=function(j){var k=!!j.stickerId||j.attachments&&!!j.attachments.length;if(!k&&!c('MercuryConfig').WWWSyncMsgText){return false;}else if(k&&!c('MercuryConfig').WWWSyncMsgAttach)return false;return true;};h.prototype.$MercurySyncDispatcher5=function(j){var k=j.other_user_fbid||j.thread_fbid;this.$MercurySyncDispatcher2.handleUpdateWaitForThread({actions:[j],payload_source:c('MercuryPayloadSource').CLIENT_CHANNEL_MESSAGE},k);};h.prototype.$MercurySyncDispatcher6=function(j){this.$MercurySyncDispatcher3.handleUpdate({actions:j,payload_source:c('MercuryPayloadSource').CLIENT_CHANNEL_MESSAGE});};var i=new (c('MercurySingletonProvider'))(h);f.exports=h;},null);
__d('MercurySyncDataFetcherImpl',['Promise','AsyncRequest','MessagingConfig','setTimeoutAcrossTransitions'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();var h=c('MessagingConfig').syncFetchRequestTimeoutMs;function i(k){return new (c('Promise'))(function(l,m){j(k,l,m,0);});}function j(k,l,m,n){if(n>c('MessagingConfig').syncFetchRetries){m();return;}var o=n===0?0:c('MessagingConfig').syncFetchInitialTimeoutMs*Math.pow(c('MessagingConfig').syncFetchTimeoutMultiplier,n);c('setTimeoutAcrossTransitions')(function(){var p=false,q=function(){if(p)return;p=true;j(k,l,m,n+1);};new (c('AsyncRequest'))().setURI(k).setHandler(function(r){p=true;l(r);}).setErrorHandler(q).setTimeoutHandler(h,q).setAllowCrossPageTransition(true).send();},o);}f.exports={fetch:i};},null);
__d('MercurySyncDataFetcher',['Promise','MessagingConfig','MercurySyncDataFetcherImpl','setTimeoutAcrossTransitions'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();var h=500;function i(){var l=0;for(var m=0;m<c('MessagingConfig').syncFetchRetries;m++){var n=m===0?0:c('MessagingConfig').syncFetchInitialTimeoutMs*Math.pow(c('MessagingConfig').syncFetchTimeoutMultiplier,m);l+=n+h;}return l;}var j=i();function k(l){return new (c('Promise'))(function(m,n){c('MercurySyncDataFetcherImpl').fetch(l).done(m,n);c('setTimeoutAcrossTransitions')(n,j);});}f.exports={fetch:k};},null);
__d("XMercuryFetchMessageController",["XController"],function a(b,c,d,e,f,g){c.__markCompiled&&c.__markCompiled();f.exports=c("XController").create("\/mercury\/fetch_message\/",{other_user_or_thread_fbid:{type:"Int",required:true},mid:{type:"String",required:true}});},null);
__d("XMercuryInvalidateGlobalStateController",["XController"],function a(b,c,d,e,f,g){c.__markCompiled&&c.__markCompiled();f.exports=c("XController").create("\/mercury\/invalidate_global_state\/",{});},null);
__d("XMercuryInvalidateThreadStateController",["XController"],function a(b,c,d,e,f,g){c.__markCompiled&&c.__markCompiled();f.exports=c("XController").create("\/mercury\/invalidate_thread_state\/",{other_user_or_thread_fbid:{type:"Int",required:true},num_messages:{type:"Int",required:true}});},null);
__d('MercurySyncDFFDataFetcher',['Promise','ActorURI','AsyncRequest','MercuryMessages','MercuryThreads','MercuryThreadIDMap','MercurySingletonProvider','MercurySyncDataFetcher','XMercuryFetchMessageController','XMercuryInvalidateGlobalStateController','XMercuryInvalidateThreadStateController'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();function h(j){this.$MercurySyncDFFDataFetcher1=j;this.__messages=c('MercuryMessages').getForFBID(this.$MercurySyncDFFDataFetcher1);this.__threads=c('MercuryThreads').getForFBID(this.$MercurySyncDFFDataFetcher1);this.__threadIDMap=c('MercuryThreadIDMap').getForFBID(this.$MercurySyncDFFDataFetcher1);}h.getForFBID=function(j){return i.getForFBID(j);};h.get=function(){return i.get();};h.prototype.fetchInvalidateGlobalState=function(){var j=c('XMercuryInvalidateGlobalStateController').getURIBuilder().getURI(),k=c('ActorURI').create(j,this.$MercurySyncDFFDataFetcher1);return c('MercurySyncDataFetcher').fetch(k);};h.prototype.fetchInvalidateThreadState=function(j,k){var l=11,m=3,n=j||k,o=this.__threadIDMap.getClientIDFromServerIDNow(n);if(!o)return c('Promise').resolve({getPayload:function(){return {};}});var p=m+this.__messages.getCurrentlyLoadedMessages(o).length,q=c('XMercuryInvalidateThreadStateController').getURIBuilder().setInt('other_user_or_thread_fbid',n).setInt('num_messages',Math.max(p,l)).getURI(),r=c('ActorURI').create(q,this.$MercurySyncDFFDataFetcher1);return c('MercurySyncDataFetcher').fetch(r);};h.prototype.fetchInvalidateMessage=function(j,k,l){var m=c('XMercuryFetchMessageController').getURIBuilder().setInt('other_user_or_thread_fbid',j||k).setString('mid',l).getURI(),n=c('ActorURI').create(m,this.$MercurySyncDFFDataFetcher1);return c('MercurySyncDataFetcher').fetch(n);};var i=new (c('MercurySingletonProvider'))(h);f.exports=h;},null);
__d('MercurySyncForcedFetchHandler',['Promise','MercurySingletonProvider','MercurySyncDFFDataFetcher','MercuryMessages','MercuryThreadIDMap'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();function h(k){return {getPayload:function(){return {sequence_id:k};}};}i.getForFBID=function(k){return j.getForFBID(k);};i.get=function(){return j.get();};function i(k){this.$MercurySyncForcedFetchHandler1=k;this.$MercurySyncForcedFetchHandler2=c('MercuryMessages').getForFBID(this.$MercurySyncForcedFetchHandler1);this.$MercurySyncForcedFetchHandler3=c('MercuryThreadIDMap').getForFBID(this.$MercurySyncForcedFetchHandler1);this.$MercurySyncForcedFetchHandler4=c('MercurySyncDFFDataFetcher').getForFBID(this.$MercurySyncForcedFetchHandler1);}i.prototype.processMessageDFF=function(k,l,m,n){if(n){var o=l.otherUserFbId!==undefined?l.otherUserFbId.toString():l.threadFbId.toString(),p=this.$MercurySyncForcedFetchHandler3.getClientIDFromServerIDNow(o);if(p===undefined)return c('Promise').resolve(h(k));var q=this.$MercurySyncForcedFetchHandler2.getMessagesFromIDs([m]);if(q.length===0)return c('Promise').resolve(h(k));}return this.$MercurySyncForcedFetchHandler4.fetchInvalidateMessage(l.otherUserFbId,l.threadFbId,m);};i.prototype.processThreadDFF=function(k,l,m){if(m){var n=l.otherUserFbId!==undefined?l.otherUserFbId.toString():l.threadFbId.toString(),o=this.$MercurySyncForcedFetchHandler3.getClientIDFromServerIDNow(n);if(o===undefined)return c('Promise').resolve(h(k));}return this.$MercurySyncForcedFetchHandler4.fetchInvalidateThreadState(l.otherUserFbId,l.threadFbId);};i.prototype.processGlobalDFF=function(){return this.$MercurySyncForcedFetchHandler4.fetchInvalidateGlobalState();};var j=new (c('MercurySingletonProvider'))(i);f.exports=i;},null);
__d('MercurySyncHolesTypedLogger',['Banzai','GeneratedLoggerUtils','nullthrows'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();function h(){this.clear();}h.prototype.log=function(){c('GeneratedLoggerUtils').log('logger:MercurySyncHolesLoggerConfig',this.$MercurySyncHolesTypedLogger1,c('Banzai').BASIC);};h.prototype.logVital=function(){c('GeneratedLoggerUtils').log('logger:MercurySyncHolesLoggerConfig',this.$MercurySyncHolesTypedLogger1,c('Banzai').VITAL);};h.prototype.clear=function(){this.$MercurySyncHolesTypedLogger1={};return this;};h.prototype.updateData=function(j){this.$MercurySyncHolesTypedLogger1=babelHelpers['extends']({},this.$MercurySyncHolesTypedLogger1,j);return this;};h.prototype.setDifference=function(j){this.$MercurySyncHolesTypedLogger1.difference=j;return this;};h.prototype.setSeqID=function(j){this.$MercurySyncHolesTypedLogger1.seq_id=j;return this;};h.prototype.setTopicType=function(j){this.$MercurySyncHolesTypedLogger1.topic_type=j;return this;};h.prototype.setVC=function(j){this.$MercurySyncHolesTypedLogger1.vc=j;return this;};var i={difference:true,seq_id:true,topic_type:true,vc:true};f.exports=h;},null);
__d('MercurySyncDeltaHandler',['invariant','Arbiter','ChannelConstants','LogHistory','MercuryConfig','MercuryDelayedDispatcher','MercuryPayloadSource','MercurySyncDeltaHolder','MercurySyncDeltaTypes','MercurySyncDispatcher','MercurySyncForcedFetchHandler','MercurySyncHolesTypedLogger','MercuryServerPayloadPreprocessor','MercurySyncTopicType','MercurySingletonProvider'],function a(b,c,d,e,f,g,h){'use strict';if(c.__markCompiled)c.__markCompiled();var i=c('LogHistory').getInstance('mercury_sync_delta_handler');j.getForFBID=function(l){return k.getForFBID(l);};j.get=function(){return k.get();};function j(l){this.$MercurySyncDeltaHandler1=l;this.$MercurySyncDeltaHandler2=c('MercurySyncDispatcher').getForFBID(this.$MercurySyncDeltaHandler1);this.$MercurySyncDeltaHandler4=c('MercurySyncForcedFetchHandler').getForFBID(this.$MercurySyncDeltaHandler1);this.__payloadPreprocessor=c('MercuryServerPayloadPreprocessor').getForFBID(this.$MercurySyncDeltaHandler1);this.__delayedDispatcher=c('MercuryDelayedDispatcher').getForFBID(this.$MercurySyncDeltaHandler1);this.$MercurySyncDeltaHandler5=new (c('MercurySyncDeltaHolder'))();this.$MercurySyncDeltaHandler6=false;this.$MercurySyncDeltaHandler7=[];this.$MercurySyncDeltaHandler3=0;i.debug('constructor',JSON.stringify({fbid:this.$MercurySyncDeltaHandler1}));c('Arbiter').subscribe('MercurySyncDeltaHandler/initSeqID',function(m,n){i.debug('initSeqID',JSON.stringify(n));var o=n&&n.seqID,p=n&&n.fbid;if(!p)return;if(p!==this.$MercurySyncDeltaHandler1)return;if(o){this.$MercurySyncDeltaHandler3=o;}else this.$MercurySyncDeltaHandler3=0;this.$MercurySyncDeltaHandler8();}.bind(this));}j.prototype.$MercurySyncDeltaHandler8=function(){i.debug('setUpSubscriptionsToRealTimeUpdates',JSON.stringify({fbid:this.$MercurySyncDeltaHandler1}));c('Arbiter').subscribe('channel/message:delta',function(l,m){var n=m&&m.obj&&m.obj.queue;if(n)if(n.toString()!==this.$MercurySyncDeltaHandler1)return;var o=m&&m.obj&&m.obj.delta,p=m&&m.obj&&m.obj.iseq;if(!o||!p)return;this.$MercurySyncDeltaHandler9(p,c('MercurySyncTopicType').DELTA);this.$MercurySyncDeltaHandler10(p,o);if(c('MercuryConfig').WWWSyncRaceConditionImprovements){this.$MercurySyncDeltaHandler5.push(p,o);this.$MercurySyncDeltaHandler11();}else this.$MercurySyncDeltaHandler12(p,o);}.bind(this));c('Arbiter').subscribe(c('ChannelConstants').getArbiterType(c('ChannelConstants').FAKE_DFF),function(l,m){var n=m&&m.obj&&m.obj.queue;if(n&&n.toString()!==this.$MercurySyncDeltaHandler1)return;var o=m&&m.obj&&m.obj.delta;if(!o)return;this.$MercurySyncDeltaHandler7.push(o);this.$MercurySyncDeltaHandler11();}.bind(this));};j.prototype.$MercurySyncDeltaHandler11=function(){if(this.$MercurySyncDeltaHandler6)return;if(this.$MercurySyncDeltaHandler7.length>0){var l=this.$MercurySyncDeltaHandler7.shift();this.$MercurySyncDeltaHandler12(this.$MercurySyncDeltaHandler3,l);this.$MercurySyncDeltaHandler11();}var m=this.$MercurySyncDeltaHandler5.peek();if(!m)return;var n=m-this.$MercurySyncDeltaHandler3;if(n===1){var o=this.$MercurySyncDeltaHandler5.pop();if(!o)return;var p=o.seqID,q=o.delta;this.$MercurySyncDeltaHandler12(p,q);this.$MercurySyncDeltaHandler11();}else if(n>1){this.$MercurySyncDeltaHandler13();}else{this.$MercurySyncDeltaHandler5.pop();this.$MercurySyncDeltaHandler11();}};j.prototype.$MercurySyncDeltaHandler12=function(l,m){this.$MercurySyncDeltaHandler3=l;if(m['class']===c('MercurySyncDeltaTypes').ForcedFetch){if(!c('MercuryConfig').WWWSyncForcedFetch)return;i.debug('DFF',JSON.stringify(m));if(m.threadKey!==undefined&&m.messageId===undefined){this.$MercurySyncDeltaHandler14(l,m);}else if(m.threadKey!==undefined&&m.messageId!==undefined){this.$MercurySyncDeltaHandler15(l,m);}else this.$MercurySyncDeltaHandler16(l);}else this.$MercurySyncDeltaHandler2.process(m);};j.prototype.$MercurySyncDeltaHandler13=function(){i.debug('hole',JSON.stringify({$MercurySyncDeltaHandler3:this.$MercurySyncDeltaHandler3,nextSeqID:this.$MercurySyncDeltaHandler5.peek()}));var l=this.$MercurySyncDeltaHandler5.peek();!!!l?h(0):void 0;var m=l-1;this.$MercurySyncDeltaHandler16(m);};j.prototype.$MercurySyncDeltaHandler17=function(l,m,n,o){if(c('MercuryConfig').WWWSyncRaceConditionImprovements)!!this.$MercurySyncDeltaHandler6?h(0):void 0;this.$MercurySyncDeltaHandler6=true;i.debug('_scheduleDataFetch:start',JSON.stringify({seqID:l}));m().done(function(p){i.debug('_scheduleDataFetch:success',JSON.stringify({seqID:l}));n(l,p);this.$MercurySyncDeltaHandler6=false;this.$MercurySyncDeltaHandler11();}.bind(this),function(){i.debug('_scheduleDataFetch:failure',JSON.stringify({seqID:l}));o(l);this.$MercurySyncDeltaHandler6=false;this.$MercurySyncDeltaHandler11();}.bind(this));};j.prototype.$MercurySyncDeltaHandler16=function(l){this.$MercurySyncDeltaHandler17(undefined,function(){return this.$MercurySyncDeltaHandler4.processGlobalDFF();}.bind(this),function(m,n){var o=n.getPayload();this.__payloadPreprocessor.handleUpdate(o);if(o.sequence_id)this.$MercurySyncDeltaHandler3=o.sequence_id;}.bind(this),function(){this.$MercurySyncDeltaHandler3=l;}.bind(this));};j.prototype.$MercurySyncDeltaHandler14=function(l,m){this.$MercurySyncDeltaHandler17(l,function(){return this.$MercurySyncDeltaHandler4.processThreadDFF(l,m.threadKey,m.isLazy);}.bind(this),function(n,o){this.__payloadPreprocessor.handleUpdate(o.getPayload());this.$MercurySyncDeltaHandler3=n;}.bind(this),function(){var n=babelHelpers['extends']({},m);delete n.threadKey;this.$MercurySyncDeltaHandler3=l-1;this.$MercurySyncDeltaHandler5.push(l,n);}.bind(this));};j.prototype.$MercurySyncDeltaHandler15=function(l,m){this.$MercurySyncDeltaHandler17(l,function(){return this.$MercurySyncDeltaHandler4.processMessageDFF(l,m.threadKey,m.messageId,m.isLazy);}.bind(this),function(n,o){var p=o.getPayload(),q=p.other_user_fbid?p.other_user_fbid:p.thread_fbid,r=[babelHelpers['extends']({},p)],s=c('MercuryPayloadSource').CLIENT_CHANNEL_MESSAGE;this.__delayedDispatcher.handleUpdateWaitForThread({actions:r,payload_source:s},q);this.$MercurySyncDeltaHandler3=n;}.bind(this),function(){var n=babelHelpers['extends']({},m);delete n.messageId;this.$MercurySyncDeltaHandler3=l-1;this.$MercurySyncDeltaHandler5.push(l,n);}.bind(this));};j.prototype.$MercurySyncDeltaHandler9=function(l,m){var n=l-this.$MercurySyncDeltaHandler3;if(n!==1&&n!==0){if(!c('MercuryConfig').WWWSyncHolesLogging)return;new (c('MercurySyncHolesTypedLogger'))().setSeqID(l).setDifference(n).setTopicType(m).log();}};j.prototype.$MercurySyncDeltaHandler10=function(l,m){if(m['class']===c('MercurySyncDeltaTypes').NewMessage){var n={seqID:l,threadKey:m.messageMetadata.threadKey,messageId:m.messageMetadata.messageId};i.debug('message_delta_received',JSON.stringify(n));}};var k=new (c('MercurySingletonProvider'))(j);f.exports=j;},null);
__d('MercurySyncEnvironment',['Arbiter','ChannelInitialData','CurrentUser','MercurySyncDeltaHandler'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();function h(){if(!c('ChannelInitialData').channelConfig)return;c('MercurySyncDeltaHandler').get();c('Arbiter').inform('MercurySyncDeltaHandler/initSeqID',{fbid:c('CurrentUser').getAccountID(),seqID:c('ChannelInitialData').channelConfig.sequenceId});}f.exports={setUp:h};},null);
__d('MercuryUnseenState',['MercuryFolders','KeyedCallbackManager','LogHistory','MercuryActionType','MercuryDispatcher','MercurySingletonMixin','MercuryThreadInfo','MercuryThreadlistConstants','MercuryThreadIDMap','MessagingTag','MercuryServerRequests','MercuryThreadInformer','MercuryThreads','createObjectFrom','isEmpty'],function a(b,c,d,e,f,g){if(c.__markCompiled)c.__markCompiled();var h=c('MercuryThreadlistConstants').MAX_UNSEEN_COUNT,i='unseen_thread_hash',j='unseen_thread_list',k=c('LogHistory').getInstance('mercury_unseen_state');function l(aa){this._fbid=aa;this._serverRequests=c('MercuryServerRequests').getForFBID(this._fbid);this._threadIDMap=c('MercuryThreadIDMap').getForFBID(this._fbid);this._threads=c('MercuryThreads').getForFBID(this._fbid);this._threadInformer=c('MercuryThreadInformer').getForFBID(this._fbid);this._dispatcher=c('MercuryDispatcher').getForFBID(this._fbid);this._initialUnseenCount=null;this._lastSeenTimestamp=0;this._maxCount=false;this._pendingServerUpdates=false;this._unseenResources=new (c('KeyedCallbackManager'))();this._dispatcher.subscribe('update-unseen',function(ba,ca){r(this,ca);}.bind(this));this._dispatcher.subscribe('update-thread-ids',function(ba,ca){x(this,ca);}.bind(this));}Object.assign(l.prototype,{getUnseenCount:function(){if(this.exceedsMaxCount()){k.error('unguarded_unseen_count_fetch','{}');return 0;}return q(this)||0;},exceedsMaxCount:function(){return this._maxCount||q(this)>h;},markAsSeen:function(){var aa=q(this);if(aa===null){this._pendingServerUpdates=true;}else if(aa>0||this._maxCount){this._serverRequests.markSeen();var ba=this._serverRequests.getLastActionTimestamp();s(this,ba,[]);}}});Object.assign(l,c('MercurySingletonMixin'));function m(aa,ba,ca){var da={};da[ba]=0;u(aa,da,ca);}function n(aa,ba){aa._unseenResources.setResource(i,ba);aa._unseenResources.setResource(j,Object.keys(ba));}function o(aa,ba){var ca=aa._unseenResources.executeOrEnqueue(i,ba),da=aa._unseenResources.getUnavailableResources(ca);if(da.length)aa._serverRequests.fetchUnseenThreadIDs();}function p(aa){return aa._unseenResources.getResource(i);}function q(aa){var ba=aa._unseenResources.getResource(j);if(ba){return ba.length;}else return aa._initialUnseenCount;}function r(aa,ba){var ca=z(ba);if(ba.unseen_thread_fbids){ba.unseen_thread_fbids.forEach(function(na){if(na.folder!=c('MessagingTag').INBOX)return;var oa=na.thread_fbids||[];oa=oa.concat(na.other_user_fbids||[]);var pa=w(aa,oa),qa=aa._lastSeenTimestamp;if(ca&&ca.seen_timestamp)qa=ca.seen_timestamp;s(aa,qa,pa);if(ca&&ca.unseen_count>h)aa._maxCount=true;});}else if(ca&&ca.seen_timestamp!==undefined){aa._lastSeenTimestamp=ca.seen_timestamp;if(ca.unseen_count>h){aa._maxCount=true;n(aa,{});}else{aa._initialUnseenCount=ca.unseen_count;if(aa._initialUnseenCount===0)n(aa,{});}}else{if(aa._maxCount)return;var da=ba.actions;if(!da||!da.length)return;var ea={},fa={};for(var ga=0;ga<da.length;ga++){var ha=da[ga];if(ha.is_forward)continue;var ia=ha.action_type,ja=ha.other_user_fbid?ha.other_user_fbid:ha.thread_fbid,ka=ha.thread_id?ha.thread_id:ja;if(ia==c('MercuryActionType').MARK_THREAD_SEEN){m(aa,ka,ha.persistent);continue;}if(!y(aa,ha))continue;if(ia==c('MercuryActionType').USER_GENERATED_MESSAGE||ia==c('MercuryActionType').LOG_MESSAGE){var la=ea[ka]?ha.timestamp>ea[ka]:false,ma=la||!ea[ka];if(ha.is_unread&&ma)aa._threads.getThreadMeta(ka,function(na){var oa=false;if(na&&na.last_read_timestamp)if(na.last_read_timestamp>=ha.timestamp)oa=true;if(!c('MercuryThreadInfo').isMuted(na)&&!oa)ea[ka]=ha.timestamp;});}else if(ia==c('MercuryActionType').CHANGE_READ_STATUS&&ha.mark_as_read)fa[ka]=ha.timestamp;}t(aa,ea);u(aa,fa);}if(aa._pendingServerUpdates){aa._pendingServerUpdates=false;aa.markAsSeen();}}function s(aa,ba,ca){var da=p(aa);if(da===undefined||ba>aa._lastSeenTimestamp||aa._maxCount){aa._lastSeenTimestamp=ba;ca=ca||[];if(ca.length<=h)aa._maxCount=false;var ea={},fa=p(aa)||{};for(var ga in fa)if(fa[ga]!==true){var ha=fa[ga];if(v(aa,ha))ea[ga]=ha;}var ia=Object.assign(c('createObjectFrom')(ca,true),ea);n(aa,ia);aa._threadInformer.updatedUnseenState();}}function t(aa,ba){if(aa._maxCount)return;var ca={},da=false;for(var ea in ba){var fa=ba[ea];if(v(aa,fa)){ca[ea]=fa;da=true;}}if(!da)return;o(aa,function(ga){for(var ha in ca){var ia=ca[ha];if(!ga[ha]&&v(aa,ia))ga[ha]=ca[ha];}n(aa,ga);aa._threadInformer.updatedUnseenState();});}function u(aa,ba,ca){var da=false;if(!c('isEmpty')(ba))da=true;if(da)o(aa,function(ea){var fa=false;for(var ga in ba){var ha=ba[ga],ia=ha>=ea[ga];if(ea[ga]&&(!ha||ia)){delete ea[ga];fa=true;}}if(fa){n(aa,ea);aa._threadInformer.updatedUnseenState();if(ca&&q(aa)===0)aa._serverRequests.markSeen();}});}function v(aa,ba){return ba>aa._lastSeenTimestamp;}function w(aa,ba){return ba.map(aa._threadIDMap.convertThreadIDIfAvailable,aa._threadIDMap);}function x(aa,ba){var ca=p(aa);if(!ca)return;for(var da in ba){var ea=ba[da];if(ca[da]){ca[ea]=ca[da];delete ca[da];}}n(aa,ca);}function y(aa,ba){var ca=ba.thread_id?aa._threads.getThreadMetaNow(ba.thread_id):null,da=ca?c('MercuryFolders').getFromMeta(ca):ba.folder;return da===c('MessagingTag').INBOX||da===undefined;}function z(aa){var ba=aa.message_counts||[];for(var ca=0;ca<ba.length;ca++)if(ba[ca].folder==c('MessagingTag').INBOX)return ba[ca];return null;}f.exports=l;},null);
__d('P2PActionConstants',[],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();var h={CREDIT_CARDS_UPDATED:'credit_cards_updated',CREDIT_CARDS_UPDATED_ERROR:'credit_cards_updated_error',CHANNEL_EVENTS_ALLOWED:'channel_events_allowed',CHANNEL_EVENTS_IGNORED:'channel_events_ignored',CREDIT_CARD_SAVING:'credit_card_saving',CREDIT_CARD_ADDED:'credit_card_added',CREDIT_CARD_ADDED_ERROR:'credit_card_added_error',CREDIT_CARD_ADDED_ERROR_CLEARED:'credit_card_added_error_cleared',CREDIT_CARD_DELETED:'credit_card_deleted',CREDIT_CARD_DELETED_ERROR:'credit_card_deleted_error',CREDIT_CARD_UPDATED:'credit_card_updated',CREDIT_CARD_UPDATED_ERROR:'credit_card_updated_error',PRESET_CREDIT_CARD_UPDATED:'preset_credit_card_updated',PRESET_CREDIT_CARD_UPDATED_ERROR:'preset_credit_card_updated_error',CREDIT_CARD_VERIFIED:'credit_card_verified',CREDIT_CARD_VERIFIED_ERROR:'credit_card_verified_error',TRANSFERS_UPDATED:'transfers_updated',TRANSFERS_UPDATED_ERROR:'transfers_updated_error',NUX_TRANSFERS_UPDATED:'nux_transfers_updated',TRANSFER_ADDED:'transfer_added',TRANSFER_ADDED_ERROR:'transfer_added_error',TRANSFER_UPDATED:'transfer_updated',TRANSFER_UPDATED_ERROR:'transfer_updated_error',TRANSFER_ACCEPTED:'transfer_accepted',TRANSFER_DECLINED:'transfer_declined',CHAT_SEND_VIEW_OPENED:'chat_send_view_opened',CHAT_SEND_VIEW_CLOSED:'chat_send_view_closed',BIN_NUMBER_VALIDATED:'bin_number_validated',BIN_NUMBER_VALIDATED_ERROR:'bin_number_validated_error',USER_ELIGIBILITY_UDPATED:'user_eligibility_updated',FRIENDS_LIST_UPDATED:'friends_list_updated',DIALOG_SHOWN:'dialog_shown',DIALOG_CLOSED:'dialog_closed',BANNER_STATES_UPDATED:'banner_states_updated',BANNER_DISMISSED:'banner_dismissed',BANNER_VIEWED:'banner_viewed',BANNER_COMPLETED:'banner_completed',MONEYPENNY_TRANSFER_CREATED:'moneypenny_transfer_created',MONEYPENNY_TRANSFER_CREATED_ERROR:'moneypenny_transfer_created_error',PLATFORM_CONTEXT_ADDED:'platform_context_added',PLATFORM_CONTEXT_ADDED_ERROR:'platform_context_added_error',PLATFORM_CONTEXT_SAVE_ERRORS_CLEARED:'platform_context_save_errors_cleared',PLATFORM_CONTEXT_BANNER_DISMISSED:'platform_context_banner_dismissed',PLATFORM_CONTEXT_PRODUCT_ITEM_SOLD:'platform_context_product_item_sold',PLATFORM_CONTEXT_CHANGED:'platform_context_changed',EXTENSIVE_TRANSFER_DETAILS_UPDATED:'extensive_transfer_details_updated',ADDRESS_SAVING:'address_saving',ADDRESSES_UPDATED:'addresses_updated',ADDRESS_ADDED:'address_added',ADDRESS_ADDED_ERROR:'address_added_error',ADDRESS_ADDED_ERROR_CLEARED:'address_added_error_cleared',CHECKOUT_CART_INITIATED:'checkout_cart_initiated',CHECKOUT_CART_CREATED:'checkout_cart_created',CHECKOUT_SHIPPING_OPTION_SELECTED:'checkout_shipping_option_selected',CHECKOUT_ADDRESS_SELECTED:'checkout_address_selected',CHECKOUT_CREDIT_CARD_SELECTED:'checkout_credit_card_selected',CHECKOUT_ADDRESS_FORM_TOGGLED:'checkout_address_form_toggled',CHECKOUT_CREDIT_CARD_FORM_TOGGLED:'checkout_credit_card_form_toggled',CHECKOUT_ADDRESS_EDIT_OPTIONS_TOGGLED:'checkout_address_options_toggled',CHECKOUT_CREDIT_CARD_EDIT_OPTIONS_TOGGLED:'checkout_credit_card_edit_options_toggled',CHECKOUT_ADDRESS_FORM_VALIDATED:'checkout_address_form_validated',CHECKOUT_CREDIT_CARD_FORM_VALIDATED:'checkout_credit_card_form_validated',CHECKOUT_EDIT_COMPLETED:'checkout_completed',CHECKOUT_PROCESSING:'checkout_processing',CHECKOUT_BUYER_PROFILE_UPDATED:'checkout_buyer_profile_updated',PAYMENT_REQUEST_INITIATED:'payment_request_initiated',PAYMENT_REQUEST_INITIATED_COMPLETE:'payment_request_initiated_completed',PAYMENT_REQUEST_CREATED:'payment_request_created',PAYMENT_REQUEST_CREATED_ERROR:'payment_request_created_error',PAYMENT_REQUEST_UPDATED:'payment_request_updated',PAYMENT_REQUEST_DECLINE_INITIATED:'payment_request_decline_initiated',PAYMENT_REQUEST_DECLINED:'payment_request_declined',PAYMENT_REQUEST_DECLINE_ERROR:'payment_request_decline_error',PAYMENT_REQUESTS_FETCHED:'payment_requests_fetched',PAYMENT_REQUEST_CANCEL_INITIATED:'payment_request_cancel_initiated',PAYMENT_REQUEST_CANCELED:'payment_request_canceled',PAYMENT_REQUEST_CANCEL_ERROR:'payment_request_cancel_error'};f.exports=h;},null);
__d('P2PDispatcher',['Dispatcher_DEPRECATED'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();f.exports=new (c('Dispatcher_DEPRECATED'))();},null);
__d('P2PDialogStore',['EventEmitter','P2PActionConstants','P2PDispatcher'],function a(b,c,d,e,f,g){'use strict';var h,i;if(c.__markCompiled)c.__markCompiled();var j,k={};h=babelHelpers.inherits(l,c('EventEmitter'));i=h&&h.prototype;function l(){i.constructor.call(this);j=c('P2PDispatcher').register(this.onEventDispatched.bind(this));k={dialogClass:null,dialogProps:null};}l.prototype.getState=function(){return k;};l.prototype.onEventDispatched=function(m){var n=m.type,o=m.data;switch(n){case c('P2PActionConstants').DIALOG_SHOWN:k.dialogClass=o.dialogClass;k.dialogProps=o.dialogProps;this.emit('change');break;case c('P2PActionConstants').DIALOG_CLOSED:k.dialogClass=null;k.dialogProps=null;this.emit('change');break;}};f.exports=new l();},null);
__d('P2PDialogContainer.react',['P2PDialogStore','React','ReactLayeredComponentMixin'],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();var h=c('React').createClass({displayName:'P2PDialogContainer',mixins:[c('ReactLayeredComponentMixin')],getInitialState:function(){return c('P2PDialogStore').getState();},componentDidMount:function(){this.dialogStoreSub=c('P2PDialogStore').addListener('change',this.onDialogStoreChange);},componentWillUnmount:function(){if(this.dialogStoreSub){this.dialogStoreSub.remove();this.dialogStoreSub=null;}},onDialogStoreChange:function(){this.setState(c('P2PDialogStore').getState());},renderLayers:function(){if(!this.state.dialogClass)return {};var i=this.state.dialogClass;return {dialog:c('React').createElement(i,this.state.dialogProps)};},render:function(){return null;}});f.exports=h;},null);
__d('P2PSendMoneyDialogStore',['P2PActionConstants','EventEmitter','P2PDispatcher'],function a(b,c,d,e,f,g){'use strict';var h,i;if(c.__markCompiled)c.__markCompiled();var j,k;h=babelHelpers.inherits(l,c('EventEmitter'));i=h&&h.prototype;function l(){i.constructor.call(this);k={};j=c('P2PDispatcher').register(this.onEventDispatched.bind(this));}l.prototype.onEventDispatched=function(m){var n=m.data,o=m.type;switch(o){case c('P2PActionConstants').CHAT_SEND_VIEW_OPENED:this.handleChatSendViewOpened(n);this.emit('change');break;case c('P2PActionConstants').CHAT_SEND_VIEW_CLOSED:this.handleChatSendViewClosed(n);this.emit('change');break;}};l.prototype.getStateByThreadID=function(m){return k[m];};l.prototype.handleChatSendViewOpened=function(m){k[m.threadID]={amount:m.amount,groupSendRecipientUserID:m.groupSendRecipientUserID,groupSendReceiptDetails:m.groupSendReceiptDetails,groupThreadFBID:m.groupThreadFBID,openRequestTab:m.openRequestTab,memoText:m.memoText,platformData:m.platformData,referrer:m.referrer,paymentRequestID:m.paymentRequestID,sendMoneyDialogShown:true,sendMoneyNUXDismissed:m.sendMoneyNUXDismissed,useModal:m.useModal};};l.prototype.handleChatSendViewClosed=function(m){k[m.threadID]={amount:'',groupSendRecipientUserID:null,groupSendReceiptDetails:null,groupThreadFBID:'',openRequestTab:false,memoText:null,platformData:null,referrer:null,paymentRequestID:null,sendMoneyDialogShown:false,sendMoneyNUXDismissed:false,useModal:false};};f.exports=new l();},null);
__d('TabsViewport',['csx','Arbiter','ArbiterMixin','ChatTabModel','Dock','DOM','Event','Parent','Vector','ViewportBounds','areJSONRepresentationsEqual','getViewportDimensions'],function a(b,c,d,e,f,g,h){if(c.__markCompiled)c.__markCompiled();var i=175,j=269,k=0;function l(){return i;}function m(){return j;}function n(o){this._root=o;var p=this._recalculateWidth.bind(this);c('Event').listen(window,'resize',p);c('Dock').subscribe('resize',p);c('Arbiter').subscribeOnce('sidebar/initialized',p,c('Arbiter').SUBSCRIBE_NEW);c('ChatTabModel').addListener(function(){return this._recalculateTabs(true);}.bind(this));this._recalculateWidth();this._initialized=true;}Object.assign(n.prototype,c('ArbiterMixin'),{_root:null,_initialized:false,_availableWidth:0,_maxShown:1,_viewState:null,_recalculateWidth:function(){var o=n._getAvailableDockWidth(this._root),p=Math.max(1,Math.floor(o/m())),q=p!=this._maxShown;if(!this._viewState||q||o<=this._viewState.usedWidth||o>this._viewState.widthToShowNext){this._availableWidth=o;this._maxShown=p;this._viewState=null;this._recalculateTabs(q);}},_onTabsChanged:function(){if(this._initialized){this.inform('tabs-changed');this.inform('max-to-show-changed',this._maxShown);this.inform('max-to-show-change-completed');}},_recalculateTabs:function(o){var p=n._getTabsToShow(c('ChatTabModel').get(),this._availableWidth);if(o||!c('areJSONRepresentationsEqual')(this._viewState,p)){this._viewState=p;this._onTabsChanged();}},getMaxTabsToShow:function(){return this._maxShown;},checkWidth:function(){this._recalculateWidth();},hasRoomForRaisedTab:function(){return this._availableWidth-this._viewState.usedWidth>m();},getTabsToShow:function(){return JSON.parse(JSON.stringify(this._viewState.tabsToShow));},getShowingTabsOrder:function(){var o=c('ChatTabModel').get(),p=this._viewState.tabsToShow;return o.tabs.filter(function(q){return p[q.id];});},getRightmostHiddenTab:function(){var o=c('ChatTabModel').get(),p=this._viewState.tabsToShow,q=o.tabs.filter(function(s){return !p[s.id];}),r=q.shift();return r?r.id:null;},getLeftmostVisibleTab:function(){var o=this.getShowingTabsOrder(),p=o.pop();return p?p.id:null;},getRaisedVisibleTabs:function(){var o=[],p=this.getShowingTabsOrder(),q=p.length;for(var r=0;r<q;r++)if(c('ChatTabModel').getTab(p[r].id).raised)o.push(p[r].id);return o;},shouldPromoteOnRaise:function(o){if(!this._viewState.tabsToShow[o])return true;if(this._viewState.nextToHide!=o)return false;var p=c('ChatTabModel').getTab(o),q=p&&p.raised;return !q&&this._availableWidth-this._viewState.usedWidth<m()-l();}});Object.assign(n,{_getAvailableDockWidth:function(o){var p=c('getViewportDimensions').withoutScrollbars().width;p-=c('ViewportBounds').getLeft()+c('ViewportBounds').getRight();p-=50;var q=c('Parent').byClass(o,'fbDock'),r=c('DOM').find(q,"._56ox"),s=r?c('Vector').getElementDimensions(r).x:0;p-=s;var t=c('DOM').scry(q,"._56oy");s+=c('Vector').getElementDimensions(t.pop()).x;var u=c('Vector').getElementDimensions(q),v=u.x-s;if(v>k)k=v;p-=k;p-=15;return Math.max(p,0);},_getTabsToShow:function(o,p){p=Math.max(p,m()+1);function q(ga,ha){return ga.raised||!ha?m():l();}var r=JSON.parse(JSON.stringify(o.tabs)),s=-1,t=null;if(o.promoted)r.forEach(function(ga,ha){if(ga.id===o.promoted){s=ha;t=ga;}});var u=0,v=false,w=0,x=!t;r.forEach(function(ga,ha){var ia=q(ga,v);v=v||!ga.raised;ga.leftmostOffset=u+ia;u+=ia;if(ga.leftmostOffset<p)w++;x|=ha==s;ga.alreadyPlacedPromoted=x;});function y(ga,ha,ia){var ja={};for(var ka=0;ka<ha;ka++){var la=ga[ka];if(!la.alreadyPlacedPromoted&&ka==ha-1){ja[ia]=true;}else ja[la.id]=true;}return ja;}var z=y(r,w,o.promoted),aa=y(r,w-1,o.promoted),ba=null;for(var ca in z)if(!aa[ca])ba=ca;var da=r[w-1],ea=da?da.leftmostOffset:0,fa=Infinity;if(w<r.length)fa=r[w].leftmostOffset;return {nextToHide:ba,tabsToShow:z,usedWidth:ea,widthToShowNext:fa};}});f.exports=n;},null);
__d('ChatApp',['csx','Promise','CSS','ChatPerfInstrumentation','DOM','JSLogger','React','ReactDOM','TimeSlice'],function a(b,c,d,e,f,g,h){'use strict';if(c.__markCompiled)c.__markCompiled();var i={chatOpenTabImpl:undefined,tabsViewport:undefined,tabViewCoordinator:undefined,tabController:undefined,init:function(n,o,p){if(this._isInitialized){c('JSLogger').create('chat_app').error('repeated_init');return;}this._rootElem=n;c('Promise').resolve().then(function(){return c('ChatPerfInstrumentation').init();}).then(c('TimeSlice').guard(function(){return j();},'ChatApp stores')).then(c('TimeSlice').guard(function(){return k(p);},'ChatApp data')).then(c('TimeSlice').guard(function(){return l(o,n);},'ChatApp UI')).then(c('TimeSlice').guard(function(){return m();},'ChatApp Hotlike sound')).done(function(){this._isInitialized=this._isLoaded=true;c('ChatPerfInstrumentation').logTTI();}.bind(this));},isInitialized:function(){return !!this._isInitialized;},isHidden:function(){return !!(!this._isInitialized||this._isHidden);},hide:function(){if(this.isHidden())return;c('CSS').hide(this._rootElem);this._isHidden=true;},unhide:function(){if(this._isInitialized){if(this._isHidden){c('CSS').show(this._rootElem);this.tabsViewport.checkWidth();e(['Dock'],function(n){n.resizeAllFlyouts();});this._isHidden=false;}}else if(!this._isLoaded){e(['UIPagelet'],function(n){n.loadFromEndpoint('ChatTabsPagelet','ChatTabsPagelet');n.loadFromEndpoint('BuddylistPagelet','BuddylistPagelet');});this._isLoaded=true;}}};function j(){return new (c('Promise'))(function(n){e(['MercuryBlockedParticipants','MercuryChannelHandler','MercuryDelayedRoger','MercuryDeliveryReceipts','MercuryDeliveryState','MercuryParticipants','MercuryStateCheck','MercuryThreads','MercuryUnreadState','MercuryUnseenState','MercurySyncEnvironment','P2PSendMoneyDialogStore'],function(o,p,q,r,s,t,u,v,w,x,y,z){o.get();p.get().turnOn();q;r.get();s.get();t;v.get();x.get();w.get();u.get();y.setUp();c('ChatPerfInstrumentation').logInitStores();n();});});}function k(n){return new (c('Promise'))(function(o){e(['MercuryServerPayloadPreprocessor'],function(p){p.get().handleUpdate(n);c('ChatPerfInstrumentation').logInitData();o();});});}function l(n,o){return new (c('Promise'))(function(p){e(['ChatDispatcher','ChatTabController','ChatTabModel','ChatTabViewCoordinator','TabsViewport','MNCommerceDialogContainer.react','P2PDialogContainer.react','FBRTCMessageHandler','ChatOpenTabImpl'],function(q,r,s,t,u,v,w,x,y){q.explicitlyRegisterStore(s);i.tabsViewport=new u(n);i.tabViewCoordinator=new t(n,i.tabsViewport);i.tabController=new r(i.tabsViewport);x.init();var z=c('DOM').find(o,"._26-x");c('ReactDOM').render(c('React').createElement(v,null),z);var aa=c('DOM').find(o,"._26-y");c('ReactDOM').render(c('React').createElement(w,null),aa);i.chatOpenTabImpl=y;c('ChatPerfInstrumentation').logInitUI();p();});});}function m(){return new (c('Promise'))(function(n){e(['HotLikeSound','ChatOptions'],function(o,p){o.setCheckSoundEnabledFunc(function(){return p.getSetting('sound');});c('ChatPerfInstrumentation').logInitSound();n();});});}f.exports=i;},null);
__d('MercuryShareAttachmentRenderLocations',[],function a(b,c,d,e,f,g){'use strict';if(c.__markCompiled)c.__markCompiled();var h={CHAT:'chat',CHAT_PREVIEW:'chat_preview',MESSENGER:'messenger',WEB_INBOX:'web_inbox',getValues:function(){return [h.CHAT,h.CHAT_PREVIEW,h.MESSENGER,h.WEB_INBOX];},isPreview:function(i){return i===h.CHAT_PREVIEW;}};f.exports=h;},null);
__d("XMessagingSetPreferencesController",["XController"],function a(b,c,d,e,f,g){c.__markCompiled&&c.__markCompiled();f.exports=c("XController").create("\/messaging\/preferences\/",{send_on_enter:{type:"Bool",defaultValue:false}});},null);