if (self.CavalryLogger) { CavalryLogger.start_js(["+HUBGf6"]); } __d("CometTwoButtonDialogImpl.react",["fbt","CometCardedDialog.react","CometTrackingNodeProvider.react","TetraButtonGroup.react","TetraText.react","react"],(function(a,b,c,d,e,f,g,h){"use strict";var i=d("react"),j={dialog:"comet-two-button-dialog",primary:"comet-two-button-dialog-primary",secondary:"comet-two-button-dialog-secondary"};function a(a){var b=a.body,d=a.disabled;d=d===void 0?!1:d;var e=a.onClose,f=a.primary,g=a.secondary,k=a.testids;k=k===void 0?j:k;var l=a.title;a=a.titleHorizontalAlignment;a=a===void 0?"start":a;return i.jsx(c("CometTrackingNodeProvider.react"),{trackingNode:163,children:i.jsxs(c("CometCardedDialog.react"),{onClose:function(){return e("EXIT")},testid:void 0,title:l,titleHorizontalAlignment:a,withCloseButton:!0,children:[i.jsx("div",{className:"l9j0dhe7 dati1w0a f10w8fjw hv4rvrfc pybr56ya",children:i.jsx(c("TetraText.react"),{type:"body3",children:b})}),i.jsx("div",{className:"a8nywdso ihqw7lf3 rz4wbd8a jb3vyjys bkfpd7mw btwxx1t3 j83agx80",children:i.jsx(c("TetraButtonGroup.react"),{direction:"backward",paddingHorizontal:16,primary:{disabled:d,label:(l=f)!=null?l:h._(/*FBT_CALL*/"Confirmar"/*FBT_CALL*/),onPress:function(){return e("PRIMARY")},testid:k.primary},secondary:{disabled:d,label:(a=g)!=null?a:h._(/*FBT_CALL*/"Cancelar"/*FBT_CALL*/),onPress:function(){return e("SECONDARY")},reduceEmphasis:!0,testid:k.secondary}})})]})})}a.displayName=a.name+" [from "+f.id+"]";g["default"]=a}),98); __d("CometConfirmationDialogImpl.react",["CometTwoButtonDialogImpl.react","react"],(function(a,b,c,d,e,f,g){"use strict";var h=d("react");function a(a){var b=a.body,d=a.cancel,e=a.confirm,f=a.disabled;f=f===void 0?!1:f;var g=a.onClose;a=a.title;return h.jsx(c("CometTwoButtonDialogImpl.react"),{body:b,disabled:f,onClose:function(a){return g(a==="PRIMARY")},primary:e,secondary:d,testids:{dialog:"CometConfirmationDialogImpl",primary:"CometConfirmationDialogConfirmButton",secondary:"CometConfirmationDialogCancelButton"},title:a})}a.displayName=a.name+" [from "+f.id+"]";g["default"]=a}),98); __d("isFastRefreshEnabledForCurrentDomain",[],(function(a,b,c,d,e,f){"use strict";function a(){return!1}f["default"]=a}),66); __d("MqttUnifiedClientConnectFalcoEvent",["FalcoLoggerInternal","getFalcoLogPolicy_DO_NOT_USE"],(function(a,b,c,d,e,f){"use strict";a=b("getFalcoLogPolicy_DO_NOT_USE")("1744057");c=b("FalcoLoggerInternal").create("mqtt_unified_client_connect",a);e.exports=c}),null); __d("MqttUnifiedClientDisconnectFalcoEvent",["FalcoLoggerInternal","getFalcoLogPolicy_DO_NOT_USE"],(function(a,b,c,d,e,f){"use strict";a=b("getFalcoLogPolicy_DO_NOT_USE")("1744058");c=b("FalcoLoggerInternal").create("mqtt_unified_client_disconnect",a);e.exports=c}),null); __d("MqttUnifiedClientIncomingPublishFalcoEvent",["FalcoLoggerInternal","getFalcoLogPolicy_DO_NOT_USE"],(function(a,b,c,d,e,f){"use strict";a=b("getFalcoLogPolicy_DO_NOT_USE")("1744059");c=b("FalcoLoggerInternal").create("mqtt_unified_client_incoming_publish",a);e.exports=c}),null); __d("MqttUnifiedClientOutgoingPublishFalcoEvent",["FalcoLoggerInternal","getFalcoLogPolicy_DO_NOT_USE"],(function(a,b,c,d,e,f){"use strict";a=b("getFalcoLogPolicy_DO_NOT_USE")("1744060");c=b("FalcoLoggerInternal").create("mqtt_unified_client_outgoing_publish",a);e.exports=c}),null); __d("CometFeedStoriesStrategyErrorsTypedLoggerLite",["generateLiteTypedLogger"],(function(a,b,c,d,e,f){"use strict";e.exports=b("generateLiteTypedLogger")("logger:CometFeedStoriesStrategyErrorsLoggerConfig")}),null); __d("MqttWsClientTypedLoggerLite",["generateLiteTypedLogger"],(function(a,b,c,d,e,f){"use strict";e.exports=b("generateLiteTypedLogger")("logger:MqttWsClientLoggerConfig")}),null); __d("MqttEnv",["killswitch"],(function(a,b,c,d,e,f,g){"use strict";b=Object.freeze({mqtt_waterfall_log_client_sampling:1,mqtt_ws_polling_enabled:3,mqtt_lp_use_fetch:9,mqtt_fast_lp:11,mqtt_lp_no_delay:12,mqtt_enable_publish_over_polling:13});d=function(){var a=b.prototype;a.random=function(){return this.$1!=null?this.$1():Math.random()};a.isUserLoggedInNow=function(){return this.$2!=null?this.$2():!0};a.setIsUserLoggedInNow=function(a){this.$2=a};a.clearTimeout=function(a){function b(b){return a.apply(this,arguments)}b.toString=function(){return a.toString()};return b}(function(a){if(this.$3!=null){this.$3(a);return}clearTimeout(a)});a.setTimeout=function(a){function b(b,c){return a.apply(this,arguments)}b.toString=function(){return a.toString()};return b}(function(a,b){for(var c=arguments.length,d=new Array(c>2?c-2:0),e=2;e>=7;if(a>0)b[c]=d|128;else{b[c]=d;break}}return b}function h(a,b,c){c=c;b[c++]=a>>8;b[c++]=a%256;return c}function e(a,b){return 256*a[b]+a[b+1]}function g(a){var b=0;for(var c=0,d=a.length;c=55296&&e<=56319?(b+=4,c++):b+=3}return b}function i(a,b,c,d){d=h(b,c,d);j(a,c,d);return d+b}function j(a,b,c){c=c;for(var d=0,e=a.length;d>6,b[c++]=128|f&63):f<55296||f>=57344?(b[c++]=224|f>>12,b[c++]=128|f>>6&63,b[c++]=128|f&63):(f=65536+((f&1023)<<10|a.charCodeAt(++d)&1023),b[c++]=240|f>>18,b[c++]=128|f>>12&63,b[c++]=128|f>>6&63,b[c++]=128|f&63)}}function k(a,b,c){var d=[],e=b,f=0;while(e191&&g<224){var h=a[e++];d[f++]=String.fromCharCode((g&31)<<6|h&63)}else if(g>239&&g<365){h=a[e++];var i=a[e++],j=a[e++];h=((g&7)<<18|(h&63)<<12|(i&63)<<6|j&63)-65536;d[f++]=String.fromCharCode(55296+(h>>10));d[f++]=String.fromCharCode(56320+(h&1023))}else{i=a[e++];j=a[e++];d[f++]=String.fromCharCode((g&15)<<12|(i&63)<<6|j&63)}}return d.join("")}var l=function(){function a(a,b,c,d){this.$1=a,this.$2=b,this.$5=c,this.$6=d,this.$4=!1}var b=a.prototype;b.$7=function(){var a=this;this.$4?(this.$4=!1,this.$5(),this.$3=d("MqttEnv").Env.setTimeout(function(){a.$7()},this.$2()*1e3)):this.$6()};b.reset=function(){var a=this;this.$4=!0;this.$3&&(d("MqttEnv").Env.clearTimeout(this.$3),this.$3=null);var b=this.$1()*1e3;b>0&&(this.$3=d("MqttEnv").Env.setTimeout(function(){a.$7()},b))};b.cancel=function(){this.$3&&(d("MqttEnv").Env.clearTimeout(this.$3),this.$3=null)};return a}();f.exports={UTF8Length:g,convertStringToUTF8:j,concatBuffers:a,decodeMultiByteInt:b,convertUTF8ToString:k,encodeMultiByteInt:c,writeUInt16BE:h,readUInt16BE:e,writeString:i,Pinger:l}}),34); __d("MqttUtils",["MqttEnv"],(function(a,b,c,d,e,f){"use strict";var g=b("MqttEnv").Env,h={endpointWithSessionId:function(a,b){return h.endpointWithExtraParameter(a,"sid",b.toString())},endpointWithExtraParameters:function(a,b){var c=a;b.forEach(function(a,b,d){c=h.endpointWithExtraParameter(c,b,a)});return c},endpointWithExtraParameter:function(a,b,c){if(a.indexOf("?")>0)return a+"&"+b+"="+c;else return a+"?"+b+"="+c},generateSessionId:function(){return Math.floor(g.random()*Number.MAX_SAFE_INTEGER)},promiseDone:function(a,b,c){var d=arguments.length>1?a.then(b,c):a;d.then(null,function(a){g.setTimeout(function(){if(a instanceof Error)throw a;else throw new Error("promiseDone")},0)})},promiseDoneWithTimeout:function(a,b,c,d){var e=!1;g.setTimeout(function(){e||(e=!0,c(new Error("promise timeout")))},d);h.promiseDone(a,function(a){e||(e=!0,b(a))},function(a){e||(e=!0,c(a))})},sprintf:function(a){for(var b=arguments.length,c=new Array(b>1?b-1:0),d=1;d>4;b+=1;var f=j(a,b);if(f==null)return{wireMessage:null,position:c};b=f.offset;f=b+f.value;if(f>a.length)return{wireMessage:null,position:c};var g;switch(e){case p.CONNACK:c=a[b++];c=!!(c&1);var h=a[b++];g=new u(c,h);break;case p.PUBLISH:c=d&15;h=c>>1&3;d=l(a,b);b+=2;var k=i(a,b,d);b+=d;d=null;h===1&&(d=l(a,b),b+=2);var m=w.createWithBytes(a.subarray(b,f)),n=(c&1)===1;c=(c&8)===8;g=new x(k,m,h,d,n,c);break;case p.PINGREQ:g=new s("PINGREQ");break;case p.PINGRESP:g=new s("PINGRESP");break;case p.PUBACK:case p.UNSUBACK:k=l(a,b);g=new v(e===p.PUBACK?"PUBACK":"UNSUBACK",k);break;case p.SUBACK:m=l(a,b);b+=2;h=a.subarray(b,f);g=new t(m,h);break;default:throw new Error(o("Invalid MQTT message type %s.",e))}return{wireMessage:g,position:f}}function a(a){var b=[],c=0;while(c1||d===1&&e==null)throw new TypeError(o("Argument Invalid. qos: %s messageType: %s.",d,b));f.qos=d;f.messageIdentifier=e;return f}var c=b.prototype;c.encode=function(){var a=(this.messageType&15)<<4;a|=2;var b=g(this.topic),c=2+b+2;this.messageType===p.SUBSCRIBE&&(c+=1);var d=k(c);c=new ArrayBuffer(1+d.length+c);var e=new Uint8Array(c);e[0]=a;a=1;e.set(d,1);a+=d.length;this.messageIdentifier!=null&&(a=n(this.messageIdentifier,e,a));a=m(this.topic,b,e,a);this.messageType===p.SUBSCRIBE&&this.qos!=null&&(e[a++]=this.qos);return c};return b}(d);var w=function(){"use strict";function a(a,b){this.payloadString=a,this.payloadBytes=b}a.createWithString=function(b){var c=new Uint8Array(new ArrayBuffer(g(b)));h(b,c,0);return new a(b,c)};a.createWithBytes=function(b){var c=i(b,0,b.length);return new a(c,b)};var b=a.prototype;b.string=function(){return this.payloadString};b.bytes=function(){return this.payloadBytes};return a}(),x=function(b){"use strict";babelHelpers.inheritsLoose(a,b);function a(a,c,d,e,f,g){var h;h=b.call(this,"PUBLISH")||this;h.topic=a;h.payloadMessage=c;h.qos=d;h.messageIdentifier=e;h.retained=f!=null?f:!1;h.duplicate=g!=null?g:!1;if(h.qos===1&&h.messageIdentifier==null)throw new TypeError("Argument Invalid. messageIdentifier: null and qos: 1");return h}var c=a.prototype;c.encode=function(){var a=(this.messageType&15)<<4;this.duplicate&&(a|=8);a=a|=this.qos<<1;this.retained&&a!=1;var b=g(this.topic),c=b+2,d=this.qos===0?0:2;c+=d;d=this.payloadMessage.bytes();c+=d.byteLength;var e=k(c);c=new ArrayBuffer(1+e.length+c);var f=new Uint8Array(c);f[0]=a;f.set(e,1);a=1+e.length;a=m(this.topic,b,f,a);this.qos!==0&&this.messageIdentifier!=null&&(a=n(this.messageIdentifier,f,a));f.set(d,a);return c};return a}(d);e.exports={MESSAGE_TYPE:p,WireMessage:{Base:d,PubAckUnsubAck:v,Ping:s,ConnAck:u,Connect:c,Disconnect:f,Subscription:b,Publish:x},createMessageWithString:w.createWithString,decodeMessage:r,decodeByteMessages:a,Message:w}}),null); __d("MqttTypes",[],(function(a,b,c,d,e,f,g){"use strict";a=function(a,b,c){this.errorCode=a,this.errorName=b,this.errorMessage=c};b=function(a,b){this.mqttError=a,this.connAck=b};c=function(a){babelHelpers.inheritsLoose(b,a);function b(b,c,d){d===void 0&&(d=null);c=a.call(this,c)||this;c.isRecoverable=b;c.originalError=d;return c}return b}(babelHelpers.wrapNativeSuper(Error));g.MqttError=a;g.ConnectFailure=b;g.MqttChannelError=c}),98); __d("MqttProtocolClient",["MqttEnv","MqttProtocolCodec","MqttProtocolUtils","MqttTypes","qex"],(function(a,b,c,d,e,f,g){"use strict";var h=30,i=6e4,j={SOCKET_ERROR:new(d("MqttTypes").MqttError)(1,"SOCKET_ERROR","Socket error"),SOCKET_MESSAGE:new(d("MqttTypes").MqttError)(2,"SOCKET_MESSAGE","Unable to parse invalid socket message"),INVALID_DATA_TYPE:new(d("MqttTypes").MqttError)(3,"INVALID_DATA_TYPE","Received non-arraybuffer from socket."),CONNECT_TIMEOUT:new(d("MqttTypes").MqttError)(4,"CONNECT_TIMEOUT","Connect timed out"),CONNACK_FAILURE:new(d("MqttTypes").MqttError)(5,"CONNACK_FAILURE","Connection failure due to connack"),PING_TIMEOUT:new(d("MqttTypes").MqttError)(6,"PING_TIMEOUT","Ping timeout"),APP_DISCONNECT:new(d("MqttTypes").MqttError)(7,"APP_DISCONNECT","Disconnect initiated by app"),SERVER_DISCONNECT:new(d("MqttTypes").MqttError)(8,"SERVER_DISCONNECT","Disconnect message sent my server"),SOCKET_CLOSE:new(d("MqttTypes").MqttError)(9,"SOCKET_CLOSE","Socket connection closed")};a=function(){function a(a){this.$3=a,this.$2={userName:"",mqttVersion:3,getKeepAliveIntervalSeconds:function(){return 10},getKeepAliveTimeoutSeconds:function(){return 10},ignoreSubProtocol:!1,onConnectSuccess:function(){},onConnectFailure:function(a,b){},onConnection:function(){},onConnectionLost:function(a,b){},onMessageArrived:function(a,b,c){},onMessageDelivered:function(a,b){}},this.$1="mqttwsclient",this.$4=0,this.$5=!1,this.$9=d("MqttEnv").Env.getLoggerInstance()}var b=a.prototype;b.connect=function(a){var b,e=this;if(this.$5)throw new Error("Invalid state: connect - already connected");this.$2=a;this.setConnected(!1);this.$7!=null&&(d("MqttEnv").Env.clearTimeout(this.$7),this.$7=null);b=(b=c("qex")._("525"))!=null?b:h;this.$7=d("MqttEnv").Env.setTimeout(function(){e.$9.bumpCounter("protocol.error.connect.timeout"),e.$11(j.CONNECT_TIMEOUT)},b*1e3);this.$6=d("MqttEnv").Env.createSocket(this.$3);this.$6.binaryType="arraybuffer";this.$6.onopen=function(){e.setConnected(!0),e.$12(new(d("MqttProtocolCodec").WireMessage.Connect)(e.$1,a)),a.onConnection()};this.$6.onmessage=function(a){a=a.data;if(!(a instanceof ArrayBuffer)){e.$9.bumpCounter("protocol.error.onmessage.type");e.$11(j.INVALID_DATA_TYPE);return}try{a=new Uint8Array(a);e.$10!=null&&(a=d("MqttProtocolUtils").concatBuffers(e.$10,a),e.$9.bumpCounter("protocol.debug.usingMessagesBuffer"),delete e.$10,e.$10=null);a=d("MqttProtocolCodec").decodeByteMessages(a);var b=a.messages;e.$10=a.remaining;for(var a=0;ao,c=this.$12>p;(b||c)&&(this.$12=0);this.$16!==0&&a<=o&&this.$10.bumpCounter("short_lived_session");c&&this.$10.bumpCounter("connection_attempt_limit")};e.$46=function(a,b,c,d,e,f,g){a?this.$14++:this.$15++,this.$10.eventLogConnect({sessionID:this.$9,connectionStatus:a,connectionState:this.mqttStateFromConnectionState(this.$11),ackReceived:b,duration:Date.now()-c,hostname:this.$5,attemptNumber:this.$13,successTotal:this.$14,failTotal:this.$15,subscribedTopics:d,publishes:e,errorCode:f,errorMessage:g}),a&&(this.$13=0)};e.$40=function(a,b,c,d,e){var f=a.mqttError;e=e!=null?f.errorMessage+" - "+e:f.errorMessage;this.$10.debugTrace("connect","Connect failed "+e);this.$10.bumpCounter("protocol.onconnectfailure");this.$26.onConnectFailure();this.$6.getIsGuestAuthStringPresent()&&this.$10.bumpCounter("guestAuthentication.onconnectfailure");this.$46(!1,a.connAck!=-1,b,c,d,f.errorCode,e);if(a.connAck!=null){this.$10.bumpCounter("protocol.connect_failure."+a.connAck);if(a.connAck===q){this.$48(n);return}}this.$48()};e.$42=function(a,b){var c=this;this.$10.bumpCounter("protocol.onconnection");this.$10.debugTrace("Connect","Socket established");this.$26.onConnected();this.$6.getIsGuestAuthStringPresent()&&this.$10.bumpCounter("guestAuthentication.onconnection");b.forEach(function(a){c.$26.onSubscribe(a)});a.forEach(function(a){c.$26.onPublish(a.topic)});this.$35("TransportConnected")};e.$41=function(a,b,c){this.$10.bumpCounter("protocol.onconnectsuccess"),this.$10.debugTrace("connect","Connect success"),this.$6.getIsGuestAuthStringPresent()&&this.$10.bumpCounter("guestAuthentication.onconnectsucess"),this.$26.onConnectSuccess(),this.$25=!0,this.$35("Connected"),this.$46(!0,!0,a,b,c),this.$50(b),this.$16=Date.now()};e.$43=function(a,b){this.$10.bumpCounter("protocol.onconnectionlost");if(a.errorCode){b=b!=null?a.errorMessage+" - "+b:a.errorMessage;this.$10.eventLogDisconnect({sessionID:this.$9,errorCode:a.errorCode,errorMessage:b,duration:Date.now()-this.$16})}this.$10.debugTrace("connect","connection lost");this.$26.onConnectionLost();this.$6.getIsGuestAuthStringPresent()&&this.$10.bumpCounter("guestAuthentication.onconnectionlost");this.$48()};e.$44=function(a,b,c){this.$10.bumpCounter("protocol.onmessagearrived");this.$6.getIsGuestAuthStringPresent()&&this.$10.bumpCounter("guestAuthentication.onmessagearrived");this.$10.debugTrace("onMessageArrived","Message received on "+a);this.$26.onMessage(a);try{this.$3(a,b,c)}catch(b){this.$10.logError(b,"Listener threw error"),this.$10.bumpCounter("listener_error."+a)}};e.$45=function(a,b){this.$10.bumpCounter("protocol.onmessagedelivered");a=b!=null?b:"null";this.$10.debugTrace("onMessageDelivered","Delivered Message {ID: "+a+"}");if(b==null)return;a=this.$23.get(b);if(a==null){this.$10.bumpCounter("protocol.message_with_unknown_id");return}this.$23["delete"](b);(b=a.listener)==null?void 0:b.onEvent(d("MqttPublishListener").MqttPublishEvent.ACKED);a.resolve();this.$10.bumpCounter("publish.ack_received")};e.$30=function(a){this.$10.bumpCounter("protocol.fail_all_unacked_publishes."+a),this.$23.forEach(function(b,c,e){(c=b.listener)==null?void 0:c.onEvent(d("MqttPublishListener").MqttPublishEvent.NOT_ACKED);b.reject(new Error(a))}),this.$23.clear()};e.$50=function(a){var b=this,c=new Set(a);c.forEach(function(a){b.$17.has(a)||b.unsubscribe(a)});a=new Set(this.$17);a.forEach(function(a){c.has(a)||b.subscribe(a)})};e.$47=function(a,b){try{this.$10.bumpCounter("js_error_in_init");this.$10.bumpCounter(b+".error");this.$24=!0;var c=a?a.message:"error";this.$10.debugTrace("onError",b+": "+c);this.$2(a)}catch(a){this.$10.bumpCounter("js_error_in_error_logging"),this.$10.logError(a,"JS error while trying to log previous error")}};return a}();f.exports=a}),34); __d("MqttChannel",["ChannelClientID","IrisSubscribeChecker","MqttAnalyticsHook","MqttConnection","MqttEnv","MqttPublishListener","MqttPublishTimeoutConfig","MqttUserName","MqttUtils","Promise","isFastRefreshEnabledForCurrentDomain","promiseDone","requireDeferred"],(function(a,b,c,d,e,f,g){"use strict";var h=c("MqttPublishTimeoutConfig").mqttPublishTimeoutMs||60*1e3;a=function(){function a(a){var b=this,e=a.endpoint,f=a.pollingEndpoint,g=a.userFbid,h=a.appId,i=a.initialSubscribedTopics,j=a.capabilities,k=a.clientCapabilities,l=a.chatVisibility;l=l===void 0?!0:l;var m=a.guestAuthString;m=m===void 0?null:m;var n=a.phpOverride;n=n===void 0?"":n;var o=a.clientType;o=o===void 0?"websocket":o;a=a.deviceId;a=a===void 0?c("ChannelClientID").getID():a;this.$11=d("MqttEnv").Env.getLoggerInstance();this.$11.setAppId(h);this.$12=new(c("MqttUserName"))(g,j,k,a,h,l,m,n,o);this.$1=e;this.$2=f;this.$5="Disconnected";this.$7="LPInactive";this.$6="Disconnected";this.$3=[];this.$4=new Set();this.$8=new Map();this.$9=new Map();this.$10=new(c("MqttConnection"))();this.$13=null;this.$16=new(c("MqttAnalyticsHook"))();this.$15=new Map();this.$14=[];if(!d("MqttEnv").Env.isUserLoggedInNow()&&!c("isFastRefreshEnabledForCurrentDomain")()&&(m==null||m=="")){this.$11.bumpCounter("logged_out_init");return}this.$10.addHook(this.$16);this.$10.addHook(new(c("IrisSubscribeChecker"))(function(){return b.$4.size>0}));this.$17(i);this.$18()}var e=a.prototype;e.$17=function(a){var b=this;if(this.$10.isRunning()){this.$19("run","Connection started calling run again");return}if(d("MqttEnv").Env.genGk(d("MqttEnv").MqttGkNames.mqtt_ws_polling_enabled)){var e=d("MqttEnv").Env.killswitch("MQTT_WS_FORCE_LONG_POLLING");if(e){this.$19("MqttChannel","Websocket disabled, will do long polling only");return}else if(!c("MqttUtils").hasWSSupport()){this.$19("MqttChannel","Websocket Unavailable, will do long polling only");this.$11.bumpCounter("ws_unavailable_polling");return}}this.$10.run({onStateChange:function(a){b.$20(a)},onJSError:function(a){b.$21(a)},onMessageReceived:function(a,c,d){b.$22(a,c,d)},endpoint:this.$1,mqttUserName:this.$12,subscribedTopics:a,extraConnectMessageProvider:function(){return b.$23()}})};e.shutdown=function(){this.$10&&this.$10.shutdown()};e.publish=function(a,b,e){e===void 0&&(e={qos:1,skipBuffer:!1});var f;e.qos===0?f=this.$24(a,b,e.listener):f=this.$25(a,b,e);c("MqttUtils").promiseDone(f,function(){},function(a){(a=e.listener)==null?void 0:a.onEvent(d("MqttPublishListener").MqttPublishEvent.PUBLISH_ERROR)});return f};e.$24=function(a,b,c){return this.$26(a,b,0,c)};e.$25=function(a,c,e){var f={resolve:function(){},reject:function(a){}},g=new(b("Promise"))(function(a,b){f.resolve=a,f.reject=b}),h=d("MqttEnv").Env.random();a={topic:a,payload:c,options:e,ack:f,publishToken:h,timeoutId:null};if(e.skipBuffer)if(this.$10.connectionState()==="Connecting"){this.$14.push(a);(c=e.listener)==null?void 0:c.onEvent(d("MqttPublishListener").MqttPublishEvent.QUEUED)}else this.$27(a);else{a.timeoutId=this.$28(h);this.$15.set(h,a);(c=e.listener)==null?void 0:c.onEvent(d("MqttPublishListener").MqttPublishEvent.QUEUED);this.$29(a)}return g};e.$27=function(a){c("MqttUtils").promiseDone(this.$26(a.topic,a.payload,a.options.qos,a.options.listener),function(){a.ack.resolve()},function(b){a.ack.reject(b)})};e.$29=function(a){var b=this;c("MqttUtils").promiseDone(this.$26(a.topic,a.payload,a.options.qos,a.options.listener),function(){return b.$30(a)},function(a){})};e.$26=function(a,b,e,f){var g=this,h,i,j=this.getConnectionState(),k=Date.now();!this.$10.canPublish()&&this.$13&&this.$13.canPublish()?(h=this.$13.publish(a,b,e),i="lp",f!=null&&(h=h.then(function(){return f.onEvent(d("MqttPublishListener").MqttPublishEvent.SENT)})),this.$11.bumpCounter("try_publish_lp")):(h=this.$10.publish(a,b,e,f),i="ws",this.$11.bumpCounter("try_publish_ws"));c("promiseDone")(h,function(){g.$11.eventLogOutgoingPublish({sessionID:g.$10.getSessionId(),topic:a,qos:e,payloadSizeBytes:b.length*2,success:!0,protocol:i,errorMessage:null,connectionState:j,startTime:k})},function(c){g.$11.eventLogOutgoingPublish({sessionID:g.$10.getSessionId(),topic:a,qos:e,payloadSizeBytes:b.length*2,success:!1,protocol:i,errorMessage:c.toString(),connectionState:j,startTime:k})});return h};e.subscribe=function(a,b){var c=this;this.$10.subscribe(a);var d=this.$8.get(a);!d?(d=[b],this.$8.set(a,d)):d.push(b);return function(){var d=c.$8.get(a)||[];d=d.filter(function(a){return a!==b});c.$8.set(a,d);d.length===0&&c.unsubscribeAll(a)}};e.subscribeBinary=function(a,b){var c=this;this.$10.subscribe(a);var d=this.$9.get(a);!d?(d=[b],this.$9.set(a,d)):d.push(b);return function(){var d=c.$9.get(a)||[];d=d.filter(function(a){return a!==b});c.$9.set(a,d);d.length===0&&c.unsubscribeAll(a)}};e.subscribeChannelEvents=function(a){this.$3.push(a)};e.unsubscribeChannelEvents=function(a){a=this.$3.indexOf(a);a>-1&&this.$3.splice(a,1)};e.registerExtraConnectPayloadProvider=function(a){var b=this;this.$19("MqttChannel","registerExtraConnectPayloadProvider called");this.$4.add(a);if(this.$10.isRunning()){a=a.getPublishMessages();a.forEach(function(a){b.publish(a.topic,a.payload,{qos:a.qos,skipBuffer:!0})})}};e.unregisterExtraConnectPayloadProvider=function(a){this.$4["delete"](a)};e.unsubscribeAll=function(a){this.$10.unsubscribe(a),this.$8["delete"](a),this.$9["delete"](a)};e.getConnectionState=function(){return this.$5};e.getLongPollingStatus=function(){return this.$7};e.getEndpoint=function(){return this.$1};e.addHook=function(a){this.$10.addHook(a)};e.removeHook=function(a){this.$10.removeHook(a)};e.testOnlyMessageReceived=function(a,b){this.$22(a,b,-1)};e.$31=function(a){var b=this.$15.get(a);b!=null&&b.timeoutId!=null&&d("MqttEnv").Env.clearTimeout(b.timeoutId);this.$15["delete"](a)};e.$28=function(a){var b=this;a=d("MqttEnv").Env.setTimeout(function(a){var c=b.$15.get(a);if(!c)return;var d=c.topic;b.$11.bumpCounter("publish_timeout."+d);b.$11.debugTrace("publish_timeout","Timeout publishing topic: "+d+" publishToken: "+a);b.$31(a);c.ack.reject(new Error("Publish Timed Out"))},h,a);return a};e.$30=function(a){var b=a.publishToken,c=this.$15.get(b);if(!c)return;this.$31(b);a.ack.resolve();this.$11.debugTrace("publish_success","Topic: "+a.topic+" publishToken: "+a.publishToken);this.$11.bumpCounter("publish_success."+a.topic)};e.$22=function(a,b,c){var d=this.$8.get(a);this.$11.eventLogIncomingPublish({sessionID:this.$10.getSessionId(),topic:a,connectionState:this.getConnectionState(),qos:c,payloadSizeBytes:b.payloadString.length*2});if(!d)this.$11.debugTrace("_onMessageReceived",a+" being dropped, no listeners");else for(var d=d,e=Array.isArray(d),f=0,d=e?d:d[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var g;if(e){if(f>=d.length)break;g=d[f++]}else{f=d.next();if(f.done)break;g=f.value}g=g;try{g(b.payloadString)}catch(a){this.$11.logError(a,"Listener exception"),this.$11.bumpCounter("listener_error")}}g=this.$9.get(a);this.$11.eventLogIncomingPublish({sessionID:this.$10.getSessionId(),topic:a,connectionState:this.getConnectionState(),qos:c,payloadSizeBytes:b.payloadBytes.length});if(!g)this.$11.debugTrace("_onMessageReceived",a+" being dropped, no binary listeners");else for(var f=g,e=Array.isArray(f),d=0,f=e?f:f[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){if(e){if(d>=f.length)break;c=f[d++]}else{d=f.next();if(d.done)break;c=d.value}a=c;try{a(b.payloadBytes)}catch(a){this.$11.logError(a,"Binary Listener exception"),this.$11.bumpCounter("listener_error")}}};e.$21=function(a){if(d("MqttEnv").Env.genGk(d("MqttEnv").MqttGkNames.mqtt_ws_polling_enabled)){a.isRecoverable?this.$11.bumpCounter("recoverable_error_skipped"):this.$11.bumpCounter("unrecoverable_error_skipped");return}a.isRecoverable?this.$11.bumpCounter("recoverable_error_not_skipped"):this.$11.bumpCounter("unrecoverable_error_not_skipped");this.$32(a)};e.$33=function(a){this.$32(a)};e.$32=function(a){for(var b=this.$3,c=Array.isArray(b),d=0,b=c?b:b[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var e;if(c){if(d>=b.length)break;e=b[d++]}else{d=b.next();if(d.done)break;e=d.value}e=e;e.onJSError&&e.onJSError(a)}};e.$34=function(){var a=this;this.$14.forEach(function(b){a.$27(b)});this.$14=[];this.$15.forEach(function(b,c,d){a.$29(b)})};e.$20=function(a){a==="Connecting"?(this.$14.forEach(function(a){a.ack.reject(new Error("Client Reconnecting"))}),this.$14=[]):a==="TransportConnected"&&this.$34(),this.$19("_changeState","Connection state = "+a),this.$35(a,this.$7)};e.$36=function(a,b){this.$13&&this.$13.canPublish()&&this.$34(),this.$19("_changeLPStatus","LP status = "+a+", LP Request status = "+b),this.$35(this.$6,a)};e.$35=function(a,b){var c=this.$10.mqttStateFromConnectionState(a);this.$13&&this.$13.canPublish()&&(c="Connected");this.$6=a;(c!==this.$5||b!=this.$7)&&(this.$5=c,this.$7=b,this.$37(c))};e.$37=function(a){for(var b=this.$3,c=Array.isArray(b),d=0,b=c?b:b[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var e;if(c){if(d>=b.length)break;e=b[d++]}else{d=b.next();if(d.done)break;e=d.value}e=e;e.onMQTTStateChanged(a)}};e.$23=function(){var a=this,b=[];this.$4.forEach(function(c){try{c=c.getPublishMessages();Array.prototype.push.apply(b,c)}catch(b){a.$11.logError(b,"ConnectPayload provider exception"),a.$11.bumpCounter("connectPayloadProvider_error")}});return b};e.$18=function(){var a=this;d("MqttEnv").Env.genGk(d("MqttEnv").MqttGkNames.mqtt_ws_polling_enabled)&&this.$2&&this.$2!=""&&c("requireDeferred")("MqttLongPollingRunner").__setRef("MqttChannel").onReady(function(b){b=new b(a.$2,a.$12,a.$10.hasFatal(),a.$10.hasConnectSuccess(),function(b,c,d){return a.$22(b,c,d)},function(){var b=Array.from(a.$8.keys()),c=Array.from(a.$9.keys());return Array.from(new Set(b.concat(c)))},function(){return a.$23()},function(b){a.$33(b)},function(b,c){a.$36(b,c)});b.start();a.$10.addHook(b);b.addHook(a.$16);a.$13=b;a.$11.debugTrace("MqttChannel","longPollingRunner loaded")})};e.$19=function(a,b){this.$11.debugTrace(a,"Mqtt channel: "+b)};e.setForegroundState=function(a){this.$12&&this.$12.setForegroundState(a)};e.setChatVisibility=function(a){this.$12&&this.$12.setChatVisibility(a)};e.getEndpointCapabilities=function(){return this.$12.getEndpointCapabilities()};e.setEndpointCapabilities=function(a){this.$12.setEndpointCapabilities(a)};return a}();f.exports=a}),34); __d("MqttLogger",["ChannelClientID","FBLogger","Log","LogHistory","MqttEnv","MqttUnifiedClientConnectFalcoEvent","MqttUnifiedClientDisconnectFalcoEvent","MqttUnifiedClientIncomingPublishFalcoEvent","MqttUnifiedClientOutgoingPublishFalcoEvent","MqttWsClientTypedLoggerLite","NetworkStatus","ODS","Random","gkx"],(function(a,b,c,d,e,f,g){"use strict";var h="mqtt_client",i=100,j="WEBSOCKET",k=null,l={CONNECT:"mqtt_client_connect",DISCONNECT:"mqtt_client_disconnect",PUBLISH:"mqtt_client_publish",CLIENT_ERROR:"mqtt_client_error",PUBLISH_TIMEOUT:"mqtt_qos1_publish_timeout",SOCKET_DISCONNECT:"mqtt_protocol_error"},m={CONNECT:"connect",DISCONNECT:"disconnect",OUTGOING_PUBLISH:"outgoing_publish",INCOMING_PUBLISH:"incoming_publish"};a=function(){a.getInstance=function(){k||(k=new a());return k};function a(){this.$1=d("LogHistory").getInstance(h),this.$2=0,this.$3=c("gkx")("778292"),this.$4=Date.now(),this.$5=c("ChannelClientID").getID(),this.$6()}var b=a.prototype;b.setAppId=function(a){this.$2===0&&(this.$2=a)};b.eventLogConnect=function(a){var b=a.sessionID,d=a.connectionStatus,e=a.connectionState,f=a.ackReceived,g=a.duration,h=a.hostname,i=a.attemptNumber,k=a.successTotal,n=a.failTotal;a.subscribedTopics;a.publishes;a.errorCode;a=a.errorMessage;d=d?"success":"failed";this.bumpCounter(l.CONNECT+"."+d);d=k/(k+n);var o={event_type:m.CONNECT,acked:f,attempt_number:i.toString(),connection_state:e,client_type:j,duration:g.toString(),error:a,session_id:b.toString(),os_connectivity:this.$7(),extra_data:{device_id:this.$5,connect_success_rate:d.toString(),hostname:h}};this.$8(function(){c("MqttUnifiedClientConnectFalcoEvent").log(function(){return o})})};b.eventLogPull=function(a){var b=a.pullEventName,c=a.sessionID,e=a.status,f=a.duration,g=a.hostname;a=a.errorMessage;c={device_id:this.$5,session_id:c,logged_in:d("MqttEnv").Env.isUserLoggedInNow(),href:window.location.hostname,connection_status:e,duration:f,hostname:g,error_message:a};this.$9(b,c)};b.eventLogPullFinish=function(a){var b=a.pullEventName,c=a.sessionID,e=a.duration,f=a.errorMessage,g=a.publishReceived;a=a.publishSent;c={device_id:this.$5,session_id:c,logged_in:d("MqttEnv").Env.isUserLoggedInNow(),href:window.location.hostname,duration:e,error_message:f,publish_received:g,publish_sent:a};this.$9(b,c)};b.eventLogDisconnect=function(a){var b=a.sessionID;a.errorCode;var d=a.errorMessage;a=a.duration;this.bumpCounter(l.DISCONNECT);var e={event_type:m.DISCONNECT,connection_state:"Disconnected",client_type:j,duration:a.toString(),error:d,session_id:b.toString(),os_connectivity:this.$7(),extra_data:{device_id:this.$5}};this.$8(function(){c("MqttUnifiedClientDisconnectFalcoEvent").log(function(){return e})})};b.eventLogOutgoingPublish=function(a){var b=a.sessionID,d=a.topic,e=a.qos,f=a.payloadSizeBytes,g=a.success,h=a.protocol,i=a.errorMessage,k=a.connectionState;a=a.startTime;this.bumpCounter(l.PUBLISH+"."+d);var n={event_type:m.OUTGOING_PUBLISH,session_id:b.toString(),topic:d,client_type:j,connection_state:k,qos:e.toString(),acked:e==1?g:null,duration:(Date.now()-a).toString(),error:i,payload_size:f.toString(),os_connectivity:this.$7(),extra_data:{device_id:this.$5,protocol:h}};this.$8(function(){c("MqttUnifiedClientOutgoingPublishFalcoEvent").log(function(){return n})})};b.eventLogIncomingPublish=function(a){var b=a.sessionID,d=a.topic,e=a.connectionState,f=a.qos;a=a.payloadSizeBytes;var g={event_type:m.INCOMING_PUBLISH,session_id:b.toString(),topic:d,client_type:j,connection_state:e,qos:f.toString(),payload_size:a.toString(),os_connectivity:this.$7(),extra_data:{device_id:this.$5}};b=d=="/webrtc"||d=="/rtc_multi";this.$10(function(){c("MqttUnifiedClientIncomingPublishFalcoEvent").log(function(){return g})},50,b)};b.logError=function(a,b){var e=this;d("MqttEnv").Env.scheduleLoggingCallback(function(){try{c("FBLogger")(h).catching(a).mustfix(b)}catch(a){}})};b.logErrorWarn=function(a,b){var e=this;d("MqttEnv").Env.scheduleLoggingCallback(function(){try{c("FBLogger")(h).catching(a).warn(b)}catch(a){}})};b.logWarn=function(a,b){var c=this;d("MqttEnv").Env.scheduleLoggingCallback(function(){try{c.$1.warn(a,b)}catch(a){}})};b.debugTrace=function(a,b){var c=this;d("MqttEnv").Env.scheduleLoggingCallback(function(){try{c.$1.debug(a,b)}catch(a){}})};b.bumpCounter=function(a){var b=this;if(!d("Random").coinflip(i))return;d("MqttEnv").Env.scheduleLoggingCallback(function(){b.$2!==0&&d("ODS").bumpEntityKey(2966,"mqtt_ws_client",b.$2+"."+a,i),d("ODS").bumpEntityKey(2966,"mqtt_ws_client",a,i)})};b.$9=function(a,b,e){var f=this;d("MqttEnv").Env.scheduleLoggingCallback(function(){b.event_type=a;b.app_id=f.$2;b.online=f.$11();var d=JSON.stringify(b);f.$1.log(a,d,{weight:e});a!==l.DISCONNECT&&c("MqttWsClientTypedLoggerLite").log(b)})};b.$10=function(a,b,e){c("gkx")("1272991")&&c("gkx")("762")?b!==0?e=e==!0||d("Random").coinflip(b):e=!0:e=c("gkx")("1272991");e&&d("MqttEnv").Env.scheduleCallback(a)};b.$8=function(a){this.$10(a,0,!1)};b.$11=function(){return window.navigator&&window.navigator.onLine!==void 0?window.navigator.onLine:!1};b.$7=function(){return c("NetworkStatus").isOnline()};b.$6=function(){var a=this;if(window.navigator&&window.navigator.onLine!==void 0){var b=function(b){b=b.online;b||a.bumpCounter("browser_disconnect")};c("NetworkStatus").onChange(b)}};return a}();g["default"]=a}),98); __d("MqttEnvInitializer",["CurrentUser","MqttEnv","MqttLogger","Random","WebStorage","clearTimeout","gkx","setTimeoutAcrossTransitions"],(function(a,b,c,d,e,f,g){"use strict";var h="mqtt:",i={genGk:function(a){switch(a){case d("MqttEnv").MqttGkNames.mqtt_waterfall_log_client_sampling:return c("gkx")("832242");case d("MqttEnv").MqttGkNames.mqtt_ws_polling_enabled:return!0;case d("MqttEnv").MqttGkNames.mqtt_lp_use_fetch:return c("gkx")("945829");case d("MqttEnv").MqttGkNames.mqtt_fast_lp:return c("gkx")("1001007");case d("MqttEnv").MqttGkNames.mqtt_lp_no_delay:return c("gkx")("1066746");case d("MqttEnv").MqttGkNames.mqtt_enable_publish_over_polling:return c("gkx")("968609");default:c("MqttLogger").getInstance().logError(new Error("unknown gk"),"Unknown GK value "+a);return!1}},initialize:function(){d("MqttEnv").Env.initialize(c("Random").random,c("CurrentUser").isLoggedInNow,c("clearTimeout"),c("setTimeoutAcrossTransitions"),function(){return c("MqttLogger").getInstance()},i.genGk,null,null,null,function(a,b){var d=c("WebStorage").getLocalStorage();if(d){d=d.getItem(h+a);if(d!=null)return d}return b},function(a,b){var d=c("WebStorage").getLocalStorage();d&&(b==null?d.removeItem(h+a):c("WebStorage").setItemGuarded(d,h+a,b))})}};f.exports=i}),34); __d("FBMqttChannel",["MqttChannel","MqttEnvInitializer","MqttWebConfig"],(function(a,b,c,d,e,f){"use strict";b("MqttEnvInitializer").initialize();e.exports=new(b("MqttChannel"))({endpoint:(a=b("MqttWebConfig")).endpoint,pollingEndpoint:a.pollingEndpoint,userFbid:a.fbid,appId:a.appID,initialSubscribedTopics:a.subscribedTopics,capabilities:a.capabilities,clientCapabilities:a.clientCapabilities,chatVisibility:a.chatVisibility})}),null);