;/*FB_PKG_DELIM*/ __d("BladeRunnerConfig",["RTISubscriptionManagerConfig","WebDriverConfig","cr:3024","gkx","isEmpty"],(function(t,n,r,o,a,i,l){var e,s="javascript-sandbox",u="OverrideServer",c="www_sandbox",d="www_tier",m=(function(){function t(){}var o=t.prototype;return o.patchRequestHeaders=function(o){var t={},a=r("RTISubscriptionManagerConfig").bladerunner_www_sandbox,i=r("RTISubscriptionManagerConfig").is_intern;if((e||(e=r("isEmpty")))(r("WebDriverConfig").auxiliaryServiceInfo))a!=null&&(t[s]=a);else{var l,m=(l=r("WebDriverConfig").auxiliaryServiceInfo.BladeRunner)!=null?l:r("WebDriverConfig").auxiliaryServiceInfo["BladeRunner-sandcastle"];m!=null?(typeof m.ip_address=="string"?t[u]=m.ip_address+":18295":typeof m.hostname=="string"&&(t[u]=m.hostname+":18295"),typeof r("WebDriverConfig").originHost=="string"&&(t[c]="www."+r("WebDriverConfig").originHost)):a!=null&&(t[s]=a)}if(i===!0&&(t[d]="intern"),r("WebDriverConfig").isTestRunning&&r("gkx")("20919")){var p=n("cr:3024")==null?void 0:n("cr:3024").get();p!=null&&(t.is_test="true",t.original_request_id=p)}r("gkx")("20929")&&(t["Accept-Ack"]="RSAck");for(var _ in o)t[_]=o[_];return t.http_referer=window.location.href,t},t})(),p=new m,_=p;l.default=_}),98); __d("BladeRunnerLogger",["FBLogger","ODS"],(function(t,n,r,o,a,i,l){var e,s="bladerunner_js_client",u={info:"info",warning:"warning",exception:"exception"},c=(function(){function t(){this.setFBLoggerLevel(1)}var n=t.prototype;return n.info=function(t){this.$2>=2&&r("FBLogger")(s).info("BladeRunner info: %s",t),this.$3(u.info,t)},n.warn=function(t){this.$2>=1&&r("FBLogger")(s).warn("BladeRunner warn: %s",t),this.$3(u.warning,t)},n.exception=function(t,n){n===void 0&&(n="");var e=n+" "+t.toString();this.$2>=0&&r("FBLogger")(s).warn("BladeRunner exception: %s, %s",n,t.toString()),this.$3(u.exception,e)},n.trimForLogging=function(t){var e=1024;return typeof t=="string"&&t.length>e?"[trimmed]:"+t.substring(0,e)+"...":t},n.bumpCounter=function(n,r){r===void 0&&(r=1),(e||(e=o("ODS"))).bumpEntityKey(2966,"BladeRunnerClient",n,r)},n.setClientSessionId=function(t){this.$1=t},n.setFBLoggerLevel=function(t){this.$2=t},n.$3=function(t,n){},t})(),d=new c,m=d;l.default=m}),98); __d("BladeRunnerTypes",[],(function(t,n,r,o,a,i,l){var e={REQUEST:1,DATA:2,DATA_ACK:3,STATUS_UPDATE:4,REWRITE_REQUEST:5,LOG:6},s={BLADE_RUNNER:1,GATEWAY:2};l.StreamFrameType=e,l.StreamRequestType=s}),98); __d("BladeRunnerTypesInternal",["Base64","BladeRunnerLogger","BladeRunnerTypes"],(function(t,n,r,o,a,i,l){var e=(function(){function e(){}var t=e.prototype;return t.getHeaders=function(){if(this.headers!=null)return this.headers;throw new Error("Expected headers")},t.getInstrumentationData=function(){if(this.instrumentationData!=null&&this.instrumentationData.length>0)try{return JSON.parse(this.instrumentationData)}catch(e){return null}else return null},t.updateRetryRequestPayload=function(t){t!=null?this.payload=r("Base64").encode(t):this.payload=null},e.readObject=function(n){var t=new e;return t.streamId=f(n.streamId),t.requestType=f(n.requestType),t.payload=y(n.payload),t.headers=v(n.headers),t.extraHeader=y(n.extraHeader),t.requestTarget=y(n.requestTarget),t.instrumentationData=y(n.instrumentationData),t},e})(),s=(function(){function e(){}e.readObject=function(n){var t=new e;return t.streamId=f(n.streamId),t.dataId=g(n.dataId),t.data=y(n.data),t.shouldAck=R(n.shouldAck),t};var t=e.prototype;return t.rawData=function(){if(this.data==null)throw new Error("Expected data");return this.data},t.rawDataSize=function(){return this.data==null?0:this.data.length},t.decodeData=function(){if(this.data==null)throw new Error("Expected data");return r("Base64").decode(this.data)},t.setData=function(t){this.data=r("Base64").encode(t)},t.getInstrumentationData=function(){return this.instrumentationData!=null?JSON.parse(this.instrumentationData):null},e})(),u=(function(){function e(){}return e.readObject=function(n){var t=new e;return t.streamId=f(n.streamId),t.dataId=f(n.dataId),t.success=S(n.success),t.message=y(n.message),t.code=g(n.code),t},e})();u.ACK_CODE_LANDED_AND_ACCEPTED=20,u.ACK_CODE_LANDED_BUT_NOT_ACCEPTED=21,u.ACK_CODE_FAILED_TO_LAND=50;var c=(function(){function e(){}return e.readObject=function(n){var t=new e;return t.streamId=g(n.streamId),t.message=y(n.message),t},e})(),d=(function(){function e(){}return e.readObject=function(n){var t=new e;return t.streamId=f(n.streamId),t.status=f(n.status),t.message=y(n.message),t.code=g(n.code),t.shouldRetry=R(n.shouldRetry),t.retryDelayMs=g(n.retryDelayMs),t},e})(),m=(function(){function e(){}return e.readObject=function(n){var t=new e;return t.streamId=f(n.streamId),t.newBody=y(n.newBody),t.newExtraHeader=y(n.newExtraHeader),t.patchExtraHeader=y(n.patchExtraHeader),t.killBody=R(n.killBody),t.temporary=R(n.temporary),t},e})(),p=(function(){function t(){}var n=t.prototype;return n.getRequest=function(){if(this.type==o("BladeRunnerTypes").StreamFrameType.REQUEST&&this.request!=null)return this.request;throw new Error("Expected request")},n.getData=function(){if(this.type==o("BladeRunnerTypes").StreamFrameType.DATA&&this.data!=null)return this.data;throw new Error("Expected data")},n.getDataAck=function(){if(this.type==o("BladeRunnerTypes").StreamFrameType.DATA_ACK&&this.dataAck!=null)return this.dataAck;throw new Error("Expected dataAck")},n.getStatusUpdate=function(){if(this.type==o("BladeRunnerTypes").StreamFrameType.STATUS_UPDATE&&this.statusUpdate!=null)return this.statusUpdate;throw new Error("Expected status update")},n.getLog=function(){if(this.type==o("BladeRunnerTypes").StreamFrameType.LOG&&this.log!=null)return this.log;throw new Error("Expected log")},n.getRewriteRequest=function(){if(this.type==o("BladeRunnerTypes").StreamFrameType.REWRITE_REQUEST&&this.rewriteRequest!=null)return this.rewriteRequest;throw new Error("Expected rewrite request")},n.getStreamId=function(){if(this.type==o("BladeRunnerTypes").StreamFrameType.REQUEST&&this.request!=null)return this.request.streamId;if(this.type==o("BladeRunnerTypes").StreamFrameType.DATA&&this.data!=null)return this.data.streamId;if(this.type==o("BladeRunnerTypes").StreamFrameType.STATUS_UPDATE&&this.statusUpdate!=null)return this.statusUpdate.streamId;if(this.type==o("BladeRunnerTypes").StreamFrameType.LOG&&this.log!=null)return this.log.streamId;if(this.type==o("BladeRunnerTypes").StreamFrameType.REWRITE_REQUEST&&this.rewriteRequest!=null)return this.rewriteRequest.streamId;if(this.type==o("BladeRunnerTypes").StreamFrameType.DATA_ACK&&this.dataAck!=null)return this.dataAck.streamId;throw new Error("Frame with unexpected type")},n.isInstrumented=function(){return this.type===o("BladeRunnerTypes").StreamFrameType.REQUEST?this.getRequest().instrumentationData!=null:this.type===o("BladeRunnerTypes").StreamFrameType.DATA?this.getData().instrumentationData!=null:!1},t.readObject=function(a){var n=new t;switch(n.type=f(a.type),n.type){case o("BladeRunnerTypes").StreamFrameType.REQUEST:n.request=e.readObject(C(a.request));break;case o("BladeRunnerTypes").StreamFrameType.DATA:n.data=s.readObject(C(a.data));break;case o("BladeRunnerTypes").StreamFrameType.DATA_ACK:n.dataAck=u.readObject(C(a.dataAck));break;case o("BladeRunnerTypes").StreamFrameType.STATUS_UPDATE:n.statusUpdate=d.readObject(C(a.statusUpdate));break;case o("BladeRunnerTypes").StreamFrameType.LOG:n.log=c.readObject(C(a.log));break;case o("BladeRunnerTypes").StreamFrameType.REWRITE_REQUEST:n.rewriteRequest=m.readObject(C(a.rewriteRequest));break;default:return r("BladeRunnerLogger").warn("Frame with unexpected type: "+n.type),null}return n},t.newRequestFrame=function(n){var e=new t;return e.type=o("BladeRunnerTypes").StreamFrameType.REQUEST,e.request=n,e},t.newDataFrame=function(n){var e=new t;return e.type=o("BladeRunnerTypes").StreamFrameType.DATA,e.data=n,e},t.newDataAckFrame=function(n){var e=new t;return e.type=o("BladeRunnerTypes").StreamFrameType.DATA_ACK,e.dataAck=n,e},t.newStatusUpdateFrame=function(n){var e=new t;return e.type=o("BladeRunnerTypes").StreamFrameType.STATUS_UPDATE,e.statusUpdate=n,e},t.newLogFrame=function(n){var e=new t;return e.type=o("BladeRunnerTypes").StreamFrameType.LOG,e.log=n,e},t.newRewriteRequestFrame=function(n){var e=new t;return e.type=o("BladeRunnerTypes").StreamFrameType.REWRITE_REQUEST,e.rewriteRequest=n,e},t})(),_=(function(){function e(e,t,n){this.batchId=e,this.frames=t,this.instrumentationData=n}var t=e.prototype;return t.getFrames=function(){if(this.frames!=null)return this.frames;throw new Error("Expected frames")},t.getInstrumentationData=function(){if(this.instrumentationData!=null)try{return JSON.parse(this.instrumentationData)}catch(e){return null}else return null},t.getInstrumentationDataDfTraceId=function(){if(this.instrumentationData!=null)try{var e,t=JSON.parse(this.instrumentationData);return(e=t.dataFlowTracingData)==null?void 0:e.traceId}catch(e){return null}else return null},t.write=function(){return JSON.stringify(this)},t.isInstrumented=function(){return this.getFrames().some(function(e){return e.isInstrumented()})},e.read=function(n){var t=JSON.parse(n),r=t.batchId||0,o=[];for(var a of t.frames){var i=p.readObject(a);i!=null&&o.push(i)}var l=t.instrumentationData||null;return new e(r,o,l)},e})();function f(e){if(typeof e=="number")return e;throw new Error("Expected number")}function g(e){return e==null?null:f(e)}function h(e){if(typeof e=="string")return e;throw new Error("Expected string")}function y(e){return e==null?null:h(e)}function C(e){if(typeof e=="object"&&e!=null)return e;throw new Error("Expected object")}function b(e){if(typeof e=="object"&&e!=null){var t=e,n={};return Object.keys(t).forEach(function(e){var r=t[e];typeof r=="string"&&r!=null&&(n[e]=r)}),n}throw new Error("Expected string map")}function v(e){return e==null?null:b(e)}function S(e){if(typeof e=="boolean"&&e!=null)return e;throw new Error("Expected boolean")}function R(e){return e==null?null:S(e)}l.GatewayStreamRequest=e,l.GatewayStreamData=s,l.GatewayStreamDataAck=u,l.GatewayStreamLog=c,l.GatewayStreamStatusUpdate=d,l.GatewayStreamRewriteRequest=m,l.GatewayStreamFrame=p,l.GatewayStreamBatch=_}),98); __d("RequestStreamE2EClientLoggerEvent",[],(function(t,n,r,o,a,i){var e=Object.freeze({RECEIVED:"received",SENT:"sent",FAILURE:"failure",PUBACK:"puback"});i.default=e}),66); __d("RequestStreamE2EClientLoggerMessageType",[],(function(t,n,r,o,a,i){var e=Object.freeze({REQUEST_STREAM:"request_stream",AMENDMENT:"amendment",AMENDMENT_ACK:"amendment_ack",CANCEL:"cancel",RESPONSE:"response",RESPONSE_ACK:"response_ack",TIMED_REQUEST:"timed_request",INTERRUPT:"interrupt"});i.default=e}),66); __d("BladeRunnerEventHandler",["BladeRunnerLogger","BladeRunnerStreamStatus","BladeRunnerTypes","BladeRunnerTypesInternal","RequestStreamE2EClientLoggerEvent","RequestStreamE2EClientLoggerMessageType","getErrorSafe","setTimeoutAcrossTransitions"],(function(t,n,r,o,a,i,l){var e=1e3,s=(function(){function t(e,t,n){this.$2=e,this.$1=t,this.$3=n}var n=t.prototype;return n.onProxyResponse=function(t){var e,n;this.$4(t);var a=[];for(var i of t.getFrames())this.$2.witnessFrame(i)&&a.push(i);var l=this.$2.getRequest();(e=l.e2eLogger)==null||e.logE2EEvent(r("RequestStreamE2EClientLoggerMessageType").RESPONSE,r("RequestStreamE2EClientLoggerEvent").SENT,{},(n=t.getInstrumentationData())==null?void 0:n.auxId,null,t.getInstrumentationDataDfTraceId()),a.length>0&&this.$5(new(o("BladeRunnerTypesInternal")).GatewayStreamBatch(t.batchId,a,t.instrumentationData))},n.onDisconnect=function(){this.$2.resetErrors();var e=new(o("BladeRunnerTypesInternal")).GatewayStreamStatusUpdate;e.streamId=this.$2.getRequest().streamId,e.status=o("BladeRunnerStreamStatus").StreamStatus.CLOSED,e.shouldRetry=!0,e.retryDelayMs=0;var t=new(o("BladeRunnerTypesInternal")).GatewayStreamBatch(null,[o("BladeRunnerTypesInternal").GatewayStreamFrame.newStatusUpdateFrame(e)]);this.onProxyResponse(t)},n.$4=function(n){var t=this,a=n.getFrames().filter(function(e){return e.type==o("BladeRunnerTypes").StreamFrameType.STATUS_UPDATE});for(var i of a){var l=i.getStatusUpdate();if(l.status==o("BladeRunnerStreamStatus").StreamStatus.CLOSED||l.status==o("BladeRunnerStreamStatus").StreamStatus.REJECTED){this.$2.onError();var s=l.shouldRetry!=null&&l.shouldRetry,u=l.message!=null?l.message:"null";if(s&&this.$2.getErrorCount()<=this.$2.getRetriesAllowed()){l.status=o("BladeRunnerStreamStatus").StreamStatus.STOPPED;var c=e;l.retryDelayMs!=null&&(c=l.retryDelayMs),r("BladeRunnerLogger").info("Can retry: stream "+l.streamId+" closed with status "+l.status+", message "+u+". Error count: "+this.$2.getErrorCount()+", retryDelay "+c+"ms. Already retrying: "+this.$2.getRetryRequestScheduled().toString()),this.$2.getRetryRequestScheduled()?r("BladeRunnerLogger").bumpCounter("stream_closed_already_retrying"):(r("BladeRunnerLogger").bumpCounter("stream_closed_will_retry"),this.$2.setRetryRequestScheduled(!0),c>0?r("setTimeoutAcrossTransitions")(function(){return t.$6()},c):this.$6())}else r("BladeRunnerLogger").info("Will not retry: stream "+l.streamId+" closed with status "+l.status+", message "+u+". Error count: "+this.$2.getErrorCount()+", shouldRetry "+s.toString()+". Already retrying: "+this.$2.getRetryRequestScheduled().toString()),s?r("BladeRunnerLogger").bumpCounter("stream_closed_retry_exceeded"):r("BladeRunnerLogger").bumpCounter("stream_closed_no_retry"),this.$3.removeStream(l.streamId)}}},n.$6=function(){if(this.$2.setRetryRequestScheduled(!1),this.$2.isAlive()){var e=this.$1.getUpdatedRequestBody();e!=null&&this.$2.updateRetryRequestPayload(e),this.$3.sendRetryStreamRequest(this.$2)}},n.$5=function(t){r("BladeRunnerLogger").bumpCounter("send_to_handler");var e=[];this.$1.onBatch(t);for(var n of t.getFrames())try{switch(n.type){case o("BladeRunnerTypes").StreamFrameType.DATA:this.$1.onData(n.getData()),e.push(n.getData());break;case o("BladeRunnerTypes").StreamFrameType.STATUS_UPDATE:this.$1.onStatusUpdate(n.getStatusUpdate().status);break;case o("BladeRunnerTypes").StreamFrameType.LOG:var a=n.getLog().message;a!=null&&this.$1.onLog(a);break;case o("BladeRunnerTypes").StreamFrameType.DATA_ACK:break;default:throw new Error("Frame with unexpected type")}}catch(e){var i=r("getErrorSafe")(e);r("BladeRunnerLogger").bumpCounter("send_to_handler_error"),r("BladeRunnerLogger").exception(i,"Failed sending frame to stream handler")}this.$7(e)},n.$7=function(t){var e=[];for(var n of t)if(n.shouldAck===!0&&n.dataId!=null){var r=new(o("BladeRunnerTypesInternal")).GatewayStreamDataAck;r.streamId=n.streamId,r.dataId=n.dataId,r.success=!0,e.push(r)}this.$3.sendDataAcks(e)},t})();l.default=s}),98); __d("ChannelClientID",["MqttWebDeviceID","gkx","uuidv4"],(function(t,n,r,o,a,i,l){"use strict";var e,s=r("gkx")("21118")?r("uuidv4")():(e=r("MqttWebDeviceID")==null?void 0:r("MqttWebDeviceID").clientID)!=null?e:r("uuidv4")(),u={getID:function(){return s}};i.exports=u}),34); __d("IrisSubscribeCheckerUtils",[],(function(t,n,r,o,a,i){"use strict";function e(){if(typeof window!="undefined"){var e,t=(e=window.location)==null?void 0:e.hostname;if(t==="m.facebook.com"||t==="mobile.facebook.com"||t==="mtouch.facebook.com")return!1}return!0}i.getIrisSubscribeCheckerInitialRunningState=e}),66); __d("MqttEnvWebSocket",[],(function(t,n,r,o,a,i){"use strict";function e(e){return new WebSocket(e)}i.createWebSocket=e}),66); __d("MqttEnv",["MqttEnvWebSocket","clearTimeout","setTimeout"],(function(t,n,r,o,a,i,l){"use strict";var e=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,mqttweb_global_connection_counter:15}),s=(function(){function e(){this.$1=null,this.$2=null,this.$3=null,this.$4=null,this.$5=null,this.$6=null,this.$7=null,this.$8=null,this.$9=null,this.$10=null,this.$11=null}var t=e.prototype;return t.random=function(){return this.$1!=null?this.$1():Math.random()},t.isUserLoggedInNow=function(){return this.$2!=null?this.$2():!0},t.setIsUserLoggedInNow=function(t){this.$2=t},t.clearTimeout=function(t){if(this.$3!=null){this.$3(t);return}r("clearTimeout")(t)},t.setTimeout=function(t,n){for(var e=arguments.length,o=new Array(e>2?e-2:0),a=2;a1?r-1:0),a=1;a1?e-1:0),r=1;r0&&(this.thisTab.totalConnectionStreams--,this.$1())},t.tabClosed=function(){if(!this.isTabClosed){this.isTabClosed=!0;var e={key:this.tabID,event:"DELETE"};this.broadcastChannel.emitRemote("count-updated",JSON.stringify(e))}},t.getGlobalState=function(){var e={totalConnectionStreams:this.thisTab.totalConnectionStreams};return this.otherTabs.forEach(function(t){e.totalConnectionStreams+=t.totalConnectionStreams}),e},t.$1=function(){var e={key:this.tabID,event:"UPDATE",value:this.thisTab};this.broadcastChannel.emitRemote("count-updated",JSON.stringify(e))},t.isEnabled=function(){return!0},e})(),s=o("MqttEnv").Env.genGk(o("MqttEnv").MqttGkNames.mqttweb_global_connection_counter)?new e:{streamRequested:function(){},streamClosed:function(){},tabClosed:function(){},getGlobalState:function(){return{totalConnectionStreams:-1}},isEnabled:function(){return!1}},u=function(){return s};l.getInstance=u}),98); __d("MqttAnalyticsHook",["MqttEnv","MqttGlobalStreamCounter"],(function(t,n,r,o,a,i,l){"use strict";var e=(function(){function e(){this.$1=o("MqttEnv").Env.getLoggerInstance(),this.$2=o("MqttGlobalStreamCounter").getInstance(),this.$3=0,this.$4=0,this.$5=0,this.$6=0,this.$1.bumpCounter("session_start"),o("MqttEnv").Env.isUserLoggedInNow()||this.$1.bumpCounter("session_start.logout")}var t=e.prototype;return t.onConnectAttempt=function(){this.$1.bumpCounter("ws_connect_attempt"),this.$2.streamRequested()},t.onConnectFailure=function(){this.$4++,this.$1.bumpCounter("ws_connect_failure"),this.$1.debugTrace("connect","Connect failed existing streams count "+this.$2.getGlobalState().totalConnectionStreams),this.$2.streamClosed()},t.onConnected=function(){this.$1.bumpCounter("ws_connect_connected")},t.onConnectSuccess=function(){this.$3===0&&this.$1.bumpCounter("ws_connect_first_success"),this.$3++,this.$1.bumpCounter("ws_connect_success")},t.onConnectionLost=function(){this.$1.bumpCounter("ws_disconnect")},t.onConnectionDisconnect=function(){this.$2.streamClosed()},t.onSubscribe=function(t){},t.onUnsubscribe=function(t){},t.onPublish=function(t){this.$1.bumpCounter("ws_publish."+t)},t.onMessage=function(t){this.$1.bumpCounter("message_arrived."+t)},t.onWSFatal=function(){this.$1.bumpCounter("ws_fatal")},t.onPollRequestSent=function(){this.$1.bumpCounter("polling_request_send"),this.$2.streamRequested()},t.onPollRequestSuccess=function(){this.$1.bumpCounter("polling_request_succeed"),this.$5===0&&this.$1.bumpCounter("polling_first_success"),this.$5++},t.onPollResponse=function(t){this.$1.bumpCounter("lp.message_arrived."+t)},t.onPollFinish=function(){this.$1.bumpCounter("polling_request_finish"),this.$2.streamRequested()},t.onPollRequestFailed=function(t){this.$1.bumpCounter("polling_request_failed"),this.$1.bumpCounter("polling_request_failed_"+t),this.$6++,this.$1.debugTrace("PollRequest","Request failed existing streams count "+this.$2.getGlobalState().totalConnectionStreams),this.$2.streamClosed()},t.onPollShutdownAbort=function(){this.$2.streamClosed()},t.onTabClose=function(){this.$2.tabClosed()},e})();l.default=e}),98); __d("MqttConnectionHookCollection",[],(function(t,n,r,o,a,i){"use strict";var e=(function(){function e(){this.$1=new Set}var t=e.prototype;return t.addHook=function(t){this.$1.add(t)},t.removeHook=function(t){this.$1.delete(t)},t.onConnectAttempt=function(){this.$1.forEach(function(e){e.onConnectAttempt==null||e.onConnectAttempt()})},t.onConnectFailure=function(){this.$1.forEach(function(e){e.onConnectFailure==null||e.onConnectFailure()})},t.onConnected=function(){this.$1.forEach(function(e){e.onConnected==null||e.onConnected()})},t.onConnectSuccess=function(){this.$1.forEach(function(e){e.onConnectSuccess==null||e.onConnectSuccess()})},t.onConnectionLost=function(){this.$1.forEach(function(e){e.onConnectionLost==null||e.onConnectionLost()})},t.onConnectionDisconnect=function(){this.$1.forEach(function(e){e.onConnectionDisconnect==null||e.onConnectionDisconnect()})},t.onSubscribe=function(t){this.$1.forEach(function(e){e.onSubscribe==null||e.onSubscribe(t)})},t.onUnsubscribe=function(t){this.$1.forEach(function(e){e.onUnsubscribe==null||e.onUnsubscribe(t)})},t.onPublish=function(t){this.$1.forEach(function(e){e.onPublish==null||e.onPublish(t)})},t.onMessage=function(t){this.$1.forEach(function(e){e.onMessage==null||e.onMessage(t)})},t.onWSFatal=function(){this.$1.forEach(function(e){e.onWSFatal==null||e.onWSFatal()})},e})();i.default=e}),66); __d("MqttProtocolUtils",["MqttEnv"],(function(t,n,r,o,a,i,l){"use strict";function e(e,t){if(e==null)return t;var n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}function s(e,t){var n=t,r=0,o=1,a;do{if(n===e.length)return null;a=e[n++],r+=(a&127)*o,o*=128}while((a&128)!==0);return{offset:n,value:r}}function u(e){for(var t=e,n=new Array(1),r=0;r<4;r++){var o=t%128;if(t>>=7,t>0)n[r]=o|128;else{n[r]=o;break}}return n}function c(e,t,n){var r=n;return t[r++]=e>>8,t[r++]=e%256,r}function d(e,t){return 256*e[t]+e[t+1]}function m(e){for(var t=0,n=0,r=e.length;n=55296&&o<=56319?(t+=4,n++):t+=3}return t}function p(e,t,n,r){var o=c(t,n,r);return _(e,n,o),o+t}function _(e,t,n){for(var r=n,o=0,a=e.length;o>6,t[r++]=128|i&63):i<55296||i>=57344?(t[r++]=224|i>>12,t[r++]=128|i>>6&63,t[r++]=128|i&63):(i=65536+((i&1023)<<10|e.charCodeAt(++o)&1023),t[r++]=240|i>>18,t[r++]=128|i>>12&63,t[r++]=128|i>>6&63,t[r++]=128|i&63)}}function f(e,t,n){for(var r=[],o=t,a=0;o191&&i<224){var l=e[o++];r[a++]=String.fromCharCode((i&31)<<6|l&63)}else if(i>239&&i<365){var s=e[o++],u=e[o++],c=e[o++],d=((i&7)<<18|(s&63)<<12|(u&63)<<6|c&63)-65536;r[a++]=String.fromCharCode(55296+(d>>10)),r[a++]=String.fromCharCode(56320+(d&1023))}else{var m=e[o++],p=e[o++];r[a++]=String.fromCharCode((i&15)<<12|(m&63)<<6|p&63)}}return r.join("")}var g=(function(){function e(e,t,n,r){this.$1=e,this.$2=t,this.$5=n,this.$6=r,this.$4=!1}var t=e.prototype;return t.$7=function(){var e=this;this.$4?(this.$4=!1,this.$5(),this.$3=o("MqttEnv").Env.setTimeout(function(){e.$7()},this.$2()*1e3)):this.$6()},t.reset=function(){var e=this;this.$4=!0,this.$3&&(o("MqttEnv").Env.clearTimeout(this.$3),this.$3=null);var t=this.$1()*1e3;t>0&&(this.$3=o("MqttEnv").Env.setTimeout(function(){e.$7()},t))},t.cancel=function(){this.$3&&(o("MqttEnv").Env.clearTimeout(this.$3),this.$3=null)},e})();l.UTF8Length=m,l.convertStringToUTF8=_,l.concatBuffers=e,l.decodeMultiByteInt=s,l.convertUTF8ToString=f,l.encodeMultiByteInt=u,l.writeUInt16BE=c,l.readUInt16BE=d,l.writeString=p,l.Pinger=g}),98); __d("MqttUtils",["MqttEnv"],(function(t,n,r,o,a,i,l){"use strict";function e(e,t){return u(e,"sid",t.toString())}function s(e,t){var n=e;return t.forEach(function(e,t){n=u(n,t,e)}),n}function u(e,t,n){return e.indexOf("?")>0?e+"&"+t+"="+n:e+"?"+t+"="+n}function c(){return Math.floor(o("MqttEnv").Env.random()*Number.MAX_SAFE_INTEGER)}function d(e,t,n){var r=arguments.length>1?e.then(t,n):e;r.then(null,function(e){o("MqttEnv").Env.setTimeout(function(){throw e instanceof Error?e:new Error("promiseDone")},0)})}function m(e,t,n,r){var a=!1;o("MqttEnv").Env.setTimeout(function(){a||(a=!0,n(new Error("promise timeout")))},r),d(e,function(e){a||(a=!0,t(e))},function(e){a||(a=!0,n(e))})}function p(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r>4;a+=1;var u=o("MqttProtocolUtils").decodeMultiByteInt(t,a);if(u==null)return{position:i,wireMessage:null};a=u.offset;var c=a+u.value;if(c>t.length)return{position:i,wireMessage:null};var d;switch(s){case e.CONNACK:{var p=t[a++],h=!!(p&1),y=t[a++];d=new f(h,y);break}case e.PUBLISH:{var v=l&15,S=v>>1&3,R=o("MqttProtocolUtils").readUInt16BE(t,a);a+=2;var L=o("MqttProtocolUtils").convertUTF8ToString(t,a,R);a+=R;var E=null;S===1&&(E=o("MqttProtocolUtils").readUInt16BE(t,a),a+=2);var k=C.createWithBytes(t.subarray(a,c)),I=(v&1)===1,T=(v&8)===8;d=new b(L,k,S,E,I,T);break}case e.PINGREQ:d=new m("PINGREQ");break;case e.PINGRESP:d=new m("PINGRESP");break;case e.PUBACK:case e.UNSUBACK:{var D=o("MqttProtocolUtils").readUInt16BE(t,a);d=new g(s===e.PUBACK?"PUBACK":"UNSUBACK",D);break}case e.SUBACK:{var x=o("MqttProtocolUtils").readUInt16BE(t,a);a+=2;var $=t.subarray(a,c);d=new _(x,$);break}default:throw r("err")(o("MqttUtils").sprintf("Invalid MQTT message type %s.",s))}return{position:c,wireMessage:d}}function c(e){for(var t=[],n=0;n1||r===1&&a==null)throw new TypeError(o("MqttUtils").sprintf("Argument Invalid. qos: %s messageType: %s.",r,e));return i.qos=r,i.messageIdentifier=a,i}babelHelpers.inheritsLoose(n,t);var r=n.prototype;return r.encode=function(){var t=(this.messageType&15)<<4;t|=2;var n=o("MqttProtocolUtils").UTF8Length(this.topic),r=2+n+2;this.messageType===e.SUBSCRIBE&&(r+=1);var a=o("MqttProtocolUtils").encodeMultiByteInt(r),i=new ArrayBuffer(1+a.length+r),l=new Uint8Array(i);l[0]=t;var s=1;return l.set(a,1),s+=a.length,this.messageIdentifier!=null&&(s=o("MqttProtocolUtils").writeUInt16BE(this.messageIdentifier,l,s)),s=o("MqttProtocolUtils").writeString(this.topic,n,l,s),this.messageType===e.SUBSCRIBE&&this.qos!=null&&(l[s++]=this.qos),i},n})(d),C=(function(){function e(e,t){this.payloadString=e,this.payloadBytes=t}e.createWithString=function(n){var t=new Uint8Array(new ArrayBuffer(o("MqttProtocolUtils").UTF8Length(n)));return o("MqttProtocolUtils").convertStringToUTF8(n,t,0),new e(n,t)},e.createWithBytes=function(n){var t=o("MqttProtocolUtils").convertUTF8ToString(n,0,n.length);return new e(t,n)};var t=e.prototype;return t.string=function(){return this.payloadString},t.bytes=function(){return this.payloadBytes},e})(),b=(function(e){function t(t,n,r,o,a,i){var l;if(l=e.call(this,"PUBLISH")||this,l.topic=t,l.payloadMessage=n,l.qos=r,l.messageIdentifier=o,l.retained=a!=null?a:!1,l.duplicate=i!=null?i:!1,l.qos===1&&l.messageIdentifier==null)throw new TypeError("Argument Invalid. messageIdentifier: null and qos: 1");return l}babelHelpers.inheritsLoose(t,e);var n=t.prototype;return n.encode=function(){var e=(this.messageType&15)<<4;this.duplicate&&(e|=8),e=e|=this.qos<<1,this.retained&&e!=1;var t=o("MqttProtocolUtils").UTF8Length(this.topic),n=t+2,r=this.qos===0?0:2;n+=r;var a=this.payloadMessage.bytes();n+=a.byteLength;var i=o("MqttProtocolUtils").encodeMultiByteInt(n),l=new ArrayBuffer(1+i.length+n),s=new Uint8Array(l);s[0]=e,s.set(i,1);var u=1+i.length;return u=o("MqttProtocolUtils").writeString(this.topic,t,s,u),this.qos!==0&&this.messageIdentifier!=null&&(u=o("MqttProtocolUtils").writeUInt16BE(this.messageIdentifier,s,u)),s.set(a,u),l},t})(d),v=C.createWithString,S=C.createWithBytes,R={Base:d,ConnAck:f,Connect:h,Disconnect:p,Ping:m,PubAckUnsubAck:g,Publish:b,Subscription:y};l.MESSAGE_TYPE=e,l.decodeMessage=u,l.decodeByteMessages=c,l.Message=C,l.createMessageWithString=v,l.createMessageWithBytes=S,l.WireMessage=R}),98); __d("MqttTypes",[],(function(t,n,r,o,a,i){"use strict";var e=function(t,n,r){this.errorCode=t,this.errorName=n,this.errorMessage=r},l=Object.freeze({APP_DISCONNECT:new e(7,"APP_DISCONNECT","Disconnect initiated by app"),BROWSER_CLOSE:new e(11,"BROWSER_CLOSE","Browser closed"),CONNACK_FAILURE:new e(5,"CONNACK_FAILURE","Connection failure due to connack"),CONNECT_TIMEOUT:new e(4,"CONNECT_TIMEOUT","Connect timed out"),INVALID_DATA_TYPE:new e(3,"INVALID_DATA_TYPE","Received non-arraybuffer from socket."),PING_TIMEOUT:new e(6,"PING_TIMEOUT","Ping timeout"),RECONNECT:new e(10,"RECONNECT","Reconnecting"),SERVER_DISCONNECT:new e(8,"SERVER_DISCONNECT","Disconnect message sent my server"),SOCKET_CLOSE:new e(9,"SOCKET_CLOSE","Socket connection closed"),SOCKET_ERROR:new e(1,"SOCKET_ERROR","Socket error"),SOCKET_MESSAGE:new e(2,"SOCKET_MESSAGE","Unable to parse invalid socket message")}),s=function(t,n){this.mqttError=t,this.connAck=n},u=(function(e){function t(t,n,r){var o;return r===void 0&&(r=null),o=e.call(this,n)||this,o.isRecoverable=t,o.originalError=r,o}return babelHelpers.inheritsLoose(t,e),t})(babelHelpers.wrapNativeSuper(Error));i.MqttError=e,i.MqttErrors=l,i.ConnectFailure=s,i.MqttChannelError=u}),66); __d("MqttProtocolClient",["ErrorSerializer","MqttEnv","MqttProtocolCodec","MqttProtocolUtils","MqttTypes","err","getErrorSafe"],(function(t,n,r,o,a,i,l){"use strict";var e=20,s=6e4,u=(function(){function t(e){var t=this;this.$12=function(e,n,r){n===void 0&&(n=null),t.$9.bumpCounter("protocol.debug.disconnect.internal."+e.errorName),t.$9.bumpCounter("protocol.debug.disconnect.internal");var a=t.$5,i=t.$2,l=i.onConnectFailure,s=i.onConnectionLost;t.setConnected(!1),t.$14(),a?o("MqttEnv").Env.scheduleCallback(function(){s(e,n)}):o("MqttEnv").Env.scheduleCallback(function(){l(t.$11,new(o("MqttTypes")).ConnectFailure(e,r!=null?r:-1),n)})},this.$13=function(e){var n=t.$6;if(n==null)return t.$9.bumpCounter("protocol.socket_send.failed.socket_null."),0;if(n.readyState!==n.OPEN)return t.$9.bumpCounter("protocol.socket_send.failed.socket_not_open."),0;var r=e.encode(),o=r.byteLength;return n.send(r),o},this.$3=e,this.$2={getKeepAliveIntervalSeconds:function(){return 10},getKeepAliveTimeoutSeconds:function(){return 10},ignoreSubProtocol:!1,mqttVersion:3,onConnectFailure:function(t,n,r){},onConnection:function(){},onConnectionLost:function(t,n){},onConnectSuccess:function(t){},onMessageArrived:function(t,n,r){},onMessageDelivered:function(t){},userName:""},this.$1="mqttwsclient",this.$4=0,this.$5=!1,this.$9=o("MqttEnv").Env.getLoggerInstance(),this.$11=0}var n=t.prototype;return n.connect=function(n){var t=this;if(this.$5)throw r("err")("Invalid state: connect - already connected");this.$2=n,this.setConnected(!1),this.$7!=null&&(o("MqttEnv").Env.clearTimeout(this.$7),this.$7=null),this.$7=o("MqttEnv").Env.setTimeout(function(){t.$9.bumpCounter("protocol.error.connect.timeout"),t.$12(o("MqttTypes").MqttErrors.CONNECT_TIMEOUT)},e*1e3),this.$6=o("MqttEnv").Env.createSocket(this.$3),this.$6.binaryType="arraybuffer",this.$6.onopen=function(){t.setConnected(!0),t.$9.debugTrace("Socket-Open","MQTTProtocolClient Socket Open"),t.$11=t.$13(new(o("MqttProtocolCodec")).WireMessage.Connect(t.$1,n)),n.onConnection()},this.$6.onmessage=function(e){var n=e.data;if(!(n instanceof ArrayBuffer)){t.$9.bumpCounter("protocol.error.onmessage.type"),t.$12(o("MqttTypes").MqttErrors.INVALID_DATA_TYPE);return}try{var a=new Uint8Array(n);t.$10!=null&&(a=o("MqttProtocolUtils").concatBuffers(t.$10,a),t.$9.bumpCounter("protocol.debug.usingMessagesBuffer"),delete t.$10,t.$10=null);var i=o("MqttProtocolCodec").decodeByteMessages(a),l=i.messages;t.$10=i.remaining;for(var s=0;sy,n=this.$12>C;(t||n)&&(this.$12=0),this.$16!==0&&e<=y&&this.$10.bumpCounter("short_lived_session"),n&&this.$10.bumpCounter("connection_attempt_limit")},a.$46=function(t,n,r,o,a,i,l,s,u,c){t?this.$14++:this.$15++;var e=Date.now();this.$10.eventLogConnect({ackReceived:n,attemptNumber:this.$13,connectionState:this.mqttStateFromConnectionState(this.$11),connectionStatus:t,disconnectCount:this.$23,duration:e-r,errorCode:u,errorMessage:c,failTotal:this.$15,hostname:this.$5,messageSizeBytes:s,osConnectivity:l,publishes:i,sessionID:this.$9,subscribedTopics:a,successTotal:this.$14,total_duration:e-o}),t&&(this.$13=0)},a.$40=function(t,n,r,o,a,i,l,s){var e=t.mqttError,u=s!=null?e.errorMessage+" - "+s:e.errorMessage;if(this.$10.debugTrace("connect","Connect failed "+u),this.$10.bumpCounter("protocol.onconnectfailure"),this.$6.getIsGuestAuthStringPresent()&&this.$10.bumpCounter("guestAuthentication.onconnectfailure"),this.$27.onConnectFailure(),this.$46(!1,t.connAck!==-1,n,r,o,a,i,l,e.errorCode,u),t.connAck!=null&&(this.$10.bumpCounter("protocol.connect_failure."+t.connAck),t.connAck===b)){this.$48(h);return}this.$48()},a.$41=function(t,n){var e=this;this.$10.bumpCounter("protocol.onconnection"),this.$10.debugTrace("Connect","Socket established"),this.$27.onConnected(),this.$6.getIsGuestAuthStringPresent()&&this.$10.bumpCounter("guestAuthentication.onconnection"),n.forEach(function(t){e.$27.onSubscribe(t)}),t.forEach(function(t){e.$27.onPublish(t.topic)}),this.$35("TransportConnected")},a.$43=function(t,n,r,o,a,i){this.$10.bumpCounter("protocol.onconnectsuccess"),this.$10.debugTrace("connect","Connect success"),this.$6.getIsGuestAuthStringPresent()&&this.$10.bumpCounter("guestAuthentication.onconnectsucess"),this.$27.onConnectSuccess(),this.$26=!0,this.$35("Connected"),this.$46(!0,!0,t,n,r,o,a,i),this.$50(r),this.$16=Date.now()},a.$42=function(t,n){if(this.$10.bumpCounter("protocol.onconnectionlost"),this.$23++,t.errorCode){var e=n!=null?t.errorMessage+" - "+n:t.errorMessage;this.$10.eventLogDisconnect({disconnectCount:this.$23,duration:Date.now()-this.$16,errorCode:t.errorCode,errorMessage:e,sessionID:this.$9})}this.$10.debugTrace("connect","connection lost"),this.$27.onConnectionLost(),this.$6.getIsGuestAuthStringPresent()&&this.$10.bumpCounter("guestAuthentication.onconnectionlost"),this.$48()},a.$44=function(t,n,o){this.$10.bumpCounter("protocol.onmessagearrived"),this.$6.getIsGuestAuthStringPresent()&&this.$10.bumpCounter("guestAuthentication.onmessagearrived"),this.$10.debugTrace("onMessageArrived","Message received on "+t),this.$27.onMessage(t);try{this.$3(t,n,o)}catch(n){var e=r("getErrorSafe")(n);this.$10.logError(e,"Listener threw error"),this.$10.bumpCounter("listener_error."+t)}},a.$45=function(t){var e;this.$10.bumpCounter("protocol.onmessagedelivered");var n=t!=null?t:"null";if(this.$10.debugTrace("onMessageDelivered","Delivered Message {ID: "+n+"}"),t!=null){var r=this.$24.get(t);if(r==null){this.$10.bumpCounter("protocol.message_with_unknown_id");return}this.$24.delete(t),(e=r.listener)==null||e.onEvent(o("MqttPublishListener").MqttPublishEvent.ACKED),r.resolve(),this.$10.bumpCounter("publish.ack_received")}},a.$30=function(t){this.$10.bumpCounter("protocol.fail_all_unacked_publishes."+t),this.$24.forEach(function(e,n,a){var i;(i=e.listener)==null||i.onEvent(o("MqttPublishListener").MqttPublishEvent.NOT_ACKED),e.reject(r("err")(t))}),this.$24.clear()},a.$50=function(t){var e=this,n=new Set(t);n.forEach(function(t){e.$17.has(t)||e.unsubscribe(t)});var r=new Set(this.$17);r.forEach(function(t){n.has(t)||e.subscribe(t)})},a.$47=function(t,n){try{this.$10.bumpCounter("js_error_in_init"),this.$10.bumpCounter(n+".error"),this.$25=!0;var e=t?t.message:"error";this.$10.debugTrace("onError",n+": "+e),this.$2(t)}catch(e){var o=r("getErrorSafe")(e);this.$10.bumpCounter("js_error_in_error_logging"),this.$10.logError(o,"JS error while trying to log previous error")}},a.setRunning_OnlyForTests=function(t){this.$8=t},t})();l.default=v}),98); __d("MqttWebSocketUtils",[],(function(t,n,r,o,a,i){"use strict";function e(){return"WebSocket"in t&&t.WebSocket!=null&&"CLOSING"in t.WebSocket.prototype}i.hasWSSupport=e}),66); __d("isFastRefreshEnabledForCurrentDomain",[],(function(t,n,r,o,a,i){"use strict";function e(){return!1}i.default=e}),66); __d("MqttChannel",["ChannelClientID","IrisSubscribeChecker","MetaConfig","MqttAnalyticsHook","MqttConnection","MqttEnv","MqttPublishListener","MqttTypes","MqttUserName","MqttUtils","MqttWebSocketUtils","Promise","Run","err","getErrorSafe","isFastRefreshEnabledForCurrentDomain","promiseDone","requireDeferred"],(function(t,n,r,o,a,i,l){"use strict";var e,s=29125,u=(function(){function t(e){var t=this,n=e.endpoint,a=e.pollingEndpoint,i=e.userFbid,l=e.appId,s=e.initialSubscribedTopics,u=e.capabilities,c=e.clientCapabilities,d=e.chatVisibility,m=d===void 0?!0:d,p=e.guestAuthString,_=p===void 0?null:p,f=e.phpOverride,g=f===void 0?"":f,h=e.clientType,y=h===void 0?"websocket":h,C=e.deviceId,b=C===void 0?r("ChannelClientID").getID():C,v=e.pageId,S=v===void 0?null:v,R=e.assetIds,L=R===void 0?null:R,E=e.appSpecificInfo,k=E===void 0?null:E;if(this.$11=o("MqttEnv").Env.getLoggerInstance(),this.$11.setAppId(l),this.$12=new(r("MqttUserName"))(i,u,c,b,l,m,_,g,y,S,L,k),this.$1=n,this.$2=a,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(r("MqttConnection")),this.$13=null,this.$16=new(r("MqttAnalyticsHook")),this.$15=new Map,this.$14=[],!o("MqttEnv").Env.isUserLoggedInNow()&&!r("isFastRefreshEnabledForCurrentDomain")()&&(_==null||_=="")){this.$11.bumpCounter("logged_out_init");return}this.$10.addHook(this.$16),this.$10.addHook(new(r("IrisSubscribeChecker"))(function(){return t.$4.size>0})),this.$17(s),this.$18()}var a=t.prototype;return a.$17=function(t){var e=this;if(this.$10.isRunning()){this.$19("run","Connection started calling run again");return}if(o("MqttEnv").Env.genGk(o("MqttEnv").MqttGkNames.mqtt_ws_polling_enabled)){if(r("MetaConfig")._("15")){this.$19("MqttChannel","Websocket disabled, will do long polling only");return}else if(!o("MqttWebSocketUtils").hasWSSupport()){this.$19("MqttChannel","Websocket Unavailable, will do long polling only"),this.$11.bumpCounter("ws_unavailable_polling");return}}this.$10.run({endpoint:this.$1,extraConnectMessageProvider:function(){return e.$20()},mqttUserName:this.$12,onJSError:function(n){e.$21(n)},onMessageReceived:function(n,r,o){e.$22(n,r,o)},onStateChange:function(n){e.$23(n)},subscribedTopics:t}),this.$24()},a.$24=function(){var e=this,t=o("Run").onUnload(function(){e.$25(o("MqttTypes").MqttErrors.BROWSER_CLOSE)})},a.shutdown=function(){this.$25(o("MqttTypes").MqttErrors.APP_DISCONNECT)},a.$25=function(t){this.$10&&this.$10.shutdown(t),this.$13&&this.$13.shutdown(),this.$16.onTabClose()},a.publish=function(t,n,r){return this.$26(t,n,r!=null?r:{qos:1,skipBuffer:!1})},a.publishBinary=function(t,n,r){return r===void 0&&(r={qos:1,skipBuffer:!1}),this.$26(t,n,r)},a.$26=function(t,n,r){r===void 0&&(r={qos:1,skipBuffer:!1});var e;return r.qos===0?e=this.$27(t,n,r.listener):e=this.$28(t,n,r),o("MqttUtils").promiseDone(e,function(){},function(e){var t;(t=r.listener)==null||t.onEvent(o("MqttPublishListener").MqttPublishEvent.PUBLISH_ERROR)}),e},a.$27=function(t,n,r){return this.$29(t,n,0,r,1,null)},a.$28=function(r,a,i){var t={reject:function(t){},resolve:function(){}},l=new(e||(e=n("Promise")))(function(e,n){t.resolve=e,t.reject=n}),s=o("MqttEnv").Env.random(),u={ack:t,attempt:0,options:i,payload:a,publishToken:s,startTime:Date.now(),timeoutId:null,topic:r};if(i.skipBuffer)if(this.$10.connectionState()==="Connecting"){var c;this.$14.push(u),(c=i.listener)==null||c.onEvent(o("MqttPublishListener").MqttPublishEvent.QUEUED)}else this.$30(u);else{var d;u.timeoutId=this.$31(s),this.$15.set(s,u),(d=i.listener)==null||d.onEvent(o("MqttPublishListener").MqttPublishEvent.QUEUED),this.$32(u)}return l},a.$30=function(t){t.attempt+=1,o("MqttUtils").promiseDone(this.$29(t.topic,t.payload,t.options.qos,t.options.listener,t.attempt,t.startTime),function(){t.ack.resolve()},function(e){t.ack.reject(e)})},a.$32=function(t){var e=this;t.attempt+=1,o("MqttUtils").promiseDone(this.$29(t.topic,t.payload,t.options.qos,t.options.listener,t.attempt,t.startTime),function(){return e.$33(t)},function(e){})},a.$29=function(t,n,a,i,l,s){var e=this,u,c,d=this.getConnectionState(),m=Date.now();return!this.$10.canPublish()&&this.$13&&this.$13.canPublish()?(typeof n=="string"?u=this.$13.publish(t,n,a):u=this.$13.publishBinary(t,n,a),c="lp",i!=null&&(u=u.then(function(){return i.onEvent(o("MqttPublishListener").MqttPublishEvent.SENT)})),this.$11.bumpCounter("try_publish_lp")):(typeof n=="string"?u=this.$10.publish(t,n,a,i):u=this.$10.publishBinary(t,n,a,i),c="ws",this.$11.bumpCounter("try_publish_ws")),r("promiseDone")(u,function(){e.$11.eventLogOutgoingPublish({attempt:l,connectionState:d,disconnectCount:e.$10.getDisconnectCount(),errorMessage:null,firstAttemptStartTime:s,payloadSizeBytes:n.length*2,protocol:c,qos:a,sessionID:e.$10.getSessionId(),success:!0,thisAttemptStartTime:m,topic:t})},function(r){e.$11.eventLogOutgoingPublish({attempt:l,connectionState:d,disconnectCount:e.$10.getDisconnectCount(),errorMessage:r!=null?r.toString():null,firstAttemptStartTime:s,payloadSizeBytes:n.length*2,protocol:c,qos:a,sessionID:e.$10.getSessionId(),success:!1,thisAttemptStartTime:m,topic:t})}),u},a.subscribe=function(t,n){var e=this;this.$10.subscribe(t);var r=this.$8.get(t);return r?r.push(n):(r=[n],this.$8.set(t,r)),function(){var r=e.$8.get(t)||[],o=r.filter(function(e){return e!==n});e.$8.set(t,o),o.length===0&&e.unsubscribeAll(t)}},a.subscribeBinary=function(t,n){var e=this;this.$10.subscribe(t);var r=this.$9.get(t);return r?r.push(n):(r=[n],this.$9.set(t,r)),function(){var r=e.$9.get(t)||[],o=r.filter(function(e){return e!==n});e.$9.set(t,o),o.length===0&&e.unsubscribeAll(t)}},a.subscribeChannelEvents=function(t){var e=this;return this.$3.push(t),function(){e.unsubscribeChannelEvents(t)}},a.unsubscribeChannelEvents=function(t){var e=this.$3.indexOf(t);e>-1&&this.$3.splice(e,1)},a.registerExtraConnectPayloadProvider=function(t){var e=this;if(this.$19("MqttChannel","registerExtraConnectPayloadProvider called"),this.$4.add(t),this.$10.isRunning()){var n=t.getPublishMessages();n.forEach(function(t){typeof t.payload=="string"?e.publish(t.topic,t.payload,{qos:t.qos,skipBuffer:!0}):e.publishBinary(t.topic,t.payload,{qos:t.qos,skipBuffer:!0})})}},a.unregisterExtraConnectPayloadProvider=function(t){this.$4.delete(t)},a.unsubscribeAll=function(t){this.$10.unsubscribe(t),this.$8.delete(t),this.$9.delete(t)},a.getConnectionState=function(){return this.$5},a.getLongPollingStatus=function(){return this.$7},a.getEndpoint=function(){return this.$1},a.addHook=function(t){this.$10.addHook(t)},a.removeHook=function(t){this.$10.removeHook(t)},a.testOnlyMessageReceived=function(t,n){this.$22(t,n,-1)},a.$34=function(t){var e=this.$15.get(t);e!=null&&e.timeoutId!=null&&o("MqttEnv").Env.clearTimeout(e.timeoutId),this.$15.delete(t)},a.$31=function(t){var e=this;return o("MqttEnv").Env.setTimeout(function(t){var n=e.$15.get(t);if(n){var o=n.topic;e.$11.bumpCounter("publish_timeout."+o),e.$11.debugTrace("publish_timeout","Timeout publishing topic: "+o+" publishToken: "+t),e.$34(t),n.ack.reject(r("err")("Publish Timed Out"))}},s,t)},a.$33=function(t){var e=t.publishToken,n=this.$15.get(e);n&&(this.$34(e),t.ack.resolve(),this.$11.debugTrace("publish_success","Topic: "+t.topic+" publishToken: "+t.publishToken),this.$11.bumpCounter("publish_success."+t.topic))},a.$22=function(t,n,o){var e=this.$8.get(t);if(this.$11.eventLogIncomingPublish({connectionState:this.getConnectionState(),disconnectCount:this.$10.getDisconnectCount(),payloadSizeBytes:n.payloadString.length*2,qos:o,sessionID:this.$10.getSessionId(),topic:t}),!e)this.$11.debugTrace("_onMessageReceived",t+" being dropped, no listeners");else for(var a of e)try{a(n.payloadString)}catch(e){this.$11.logError(r("getErrorSafe")(e),"Listener exception"),this.$11.bumpCounter("listener_error")}var i=this.$9.get(t);if(this.$11.eventLogIncomingPublish({connectionState:this.getConnectionState(),disconnectCount:this.$10.getDisconnectCount(),payloadSizeBytes:n.payloadBytes.length,qos:o,sessionID:this.$10.getSessionId(),topic:t}),!i)this.$11.debugTrace("_onMessageReceived",t+" being dropped, no binary listeners");else for(var l of i)try{l(n.payloadBytes)}catch(e){this.$11.logError(r("getErrorSafe")(e),"Binary Listener exception"),this.$11.bumpCounter("listener_error")}},a.$21=function(t){if(o("MqttEnv").Env.genGk(o("MqttEnv").MqttGkNames.mqtt_ws_polling_enabled)){t.isRecoverable?this.$11.bumpCounter("recoverable_error_skipped"):this.$11.bumpCounter("unrecoverable_error_skipped");return}t.isRecoverable?this.$11.bumpCounter("recoverable_error_not_skipped"):this.$11.bumpCounter("unrecoverable_error_not_skipped"),this.$35(t)},a.$36=function(t){this.$35(t)},a.$35=function(t){for(var e of this.$3)e.onJSError&&e.onJSError(t)},a.$37=function(){var e=this;this.$14.forEach(function(t){e.$30(t),e.$11.bumpCounter("publish_from_temp_buffer."+t.topic)}),this.$14=[],this.$15.forEach(function(t,n,r){e.$32(t),e.$11.bumpCounter("publish_from_buffer."+t.topic)})},a.$23=function(t){t==="Connecting"?(this.$14.forEach(function(e){e.ack.reject(r("err")("Client Reconnecting - "+e.topic))}),this.$14=[]):t==="TransportConnected"&&this.$37(),this.$19("_changeState","Connection state = "+t),this.$38(t,this.$7)},a.$39=function(t,n){this.$13&&this.$13.canPublish()&&this.$37(),this.$19("_changeLPStatus","LP status = "+t+", LP Request status = "+n),this.$38(this.$6,t)},a.$38=function(t,n){var e=this.$10.mqttStateFromConnectionState(t);this.$13&&this.$13.canPublish()&&(e="Connected"),this.$6=t,(e!==this.$5||n!=this.$7)&&(this.$5=e,this.$7=n,this.$40(e))},a.$40=function(t){for(var e of this.$3)e.onMQTTStateChanged(t)},a.$20=function(){var e=this,t=[];return this.$4.forEach(function(n){try{var o=n.getPublishMessages();t.push.apply(t,o)}catch(t){e.$11.logError(r("getErrorSafe")(t),"ConnectPayload provider exception"),e.$11.bumpCounter("connectPayloadProvider_error")}}),t},a.$18=function(){var e=this;o("MqttEnv").Env.genGk(o("MqttEnv").MqttGkNames.mqtt_ws_polling_enabled)&&!r("MetaConfig")._("262")&&this.$2&&this.$2!=""&&r("requireDeferred")("MqttLongPollingRunner").__setRef("MqttChannel").onReady(function(t){var n=new t(e.$2,e.$12,e.$10.hasFatal(),e.$10.hasConnectSuccess(),function(t,n,r){return e.$22(t,n,r)},function(){var t=Array.from(e.$8.keys()),n=Array.from(e.$9.keys());return Array.from(new Set(t.concat(n)))},function(){return e.$20()},function(t){e.$36(t)},function(t,n){e.$39(t,n)});n.start(),e.$10.addHook(n),n.addHook(e.$16),e.$13=n,e.$11.debugTrace("MqttChannel","longPollingRunner loaded")})},a.$19=function(t,n){this.$11.debugTrace(t,"Mqtt channel: "+n)},a.setForegroundState=function(t){this.$12&&this.$12.setForegroundState(t)},a.setChatVisibility=function(t){this.$12&&this.$12.setChatVisibility(t)},a.getEndpointCapabilities=function(){return this.$12.getEndpointCapabilities()},a.setEndpointCapabilities=function(t){this.$12.setEndpointCapabilities(t)},a.getConnection_OnlyForTests=function(){return this.$10},t})();l.default=u}),98); __d("MqttConfig",["MqttWebConfig"],(function(t,n,r,o,a,i,l){"use strict";l.default=r("MqttWebConfig")}),98); __d("CurrentMessengerUser",["CurrentEnvironment","CurrentUser"],(function(t,n,r,o,a,i,l){"use strict";function e(){return r("CurrentUser").getID()}function s(){return r("CurrentEnvironment").instagramdotcom?r("CurrentUser").getEIMU():r("CurrentUser").getID()}function u(){return r("CurrentUser").getPageMessagingMailboxId()}function c(){return r("CurrentUser").isWorkUser()}function d(){return r("CurrentUser").isTestUser()}function m(){return r("CurrentUser").isEmployee()}function p(){return r("CurrentUser").getAppID()}function _(){return r("CurrentUser").getAccountID()}function f(){return r("CurrentUser").isLoggedInNow()}l.getID=e,l.getIDorEIMU=s,l.getPageMessagingMailboxId=u,l.isWorkUser=c,l.isTestUser=d,l.isEmployee=m,l.getAppID=p,l.getAccountID=_,l.isLoggedInNow=f}),98); __d("MqttEnvConfigStorage",["WebStorage"],(function(t,n,r,o,a,i,l){"use strict";var e,s="mqtt:";function u(t,n){var o=(e||(e=r("WebStorage"))).getLocalStorage();if(o){var a=o.getItem(s+t);if(a!=null)return a}return n}function c(t,n){var o=(e||(e=r("WebStorage"))).getLocalStorage();if(o)if(n==null)o.removeItem(s+t);else var a=(e||(e=r("WebStorage"))).setItemGuarded(o,s+t,n)}l.configRead=u,l.configWrite=c}),98); __d("MqttUnifiedClientConnectFalcoEvent",["FalcoLoggerInternal","getFalcoLogPolicy_DO_NOT_USE"],(function(t,n,r,o,a,i,l){"use strict";var e=r("getFalcoLogPolicy_DO_NOT_USE")("1744057"),s=o("FalcoLoggerInternal").create("mqtt_unified_client_connect",e),u=s;l.default=u}),98); __d("MqttUnifiedClientDisconnectFalcoEvent",["FalcoLoggerInternal","getFalcoLogPolicy_DO_NOT_USE"],(function(t,n,r,o,a,i,l){"use strict";var e=r("getFalcoLogPolicy_DO_NOT_USE")("1744058"),s=o("FalcoLoggerInternal").create("mqtt_unified_client_disconnect",e),u=s;l.default=u}),98); __d("MqttUnifiedClientIncomingPublishFalcoEvent",["FalcoLoggerInternal","getFalcoLogPolicy_DO_NOT_USE"],(function(t,n,r,o,a,i,l){"use strict";var e=r("getFalcoLogPolicy_DO_NOT_USE")("1744059"),s=o("FalcoLoggerInternal").create("mqtt_unified_client_incoming_publish",e),u=s;l.default=u}),98); __d("MqttUnifiedClientOutgoingPublishFalcoEvent",["FalcoLoggerInternal","getFalcoLogPolicy_DO_NOT_USE"],(function(t,n,r,o,a,i,l){"use strict";var e=r("getFalcoLogPolicy_DO_NOT_USE")("1744060"),s=o("FalcoLoggerInternal").create("mqtt_unified_client_outgoing_publish",e),u=s;l.default=u}),98); __d("MqttWsClientTypedLoggerLite",["generateLiteTypedLogger"],(function(t,n,r,o,a,i){"use strict";a.exports=n("generateLiteTypedLogger")("logger:MqttWsClientLoggerConfig")}),null); __d("MqttLogger",["ChannelClientID","FBLogger","LogHistory","MetaConfig","MqttEnv","MqttGlobalStreamCounter","MqttUnifiedClientConnectFalcoEvent","MqttUnifiedClientDisconnectFalcoEvent","MqttUnifiedClientIncomingPublishFalcoEvent","MqttUnifiedClientOutgoingPublishFalcoEvent","MqttWsClientTypedLoggerLite","NetworkStatus","ODS","Random"],(function(t,n,r,o,a,i,l){"use strict";var e,s=r("MetaConfig")._("99"),u="mqtt_client",c=100,d="WEBSOCKET",m=typeof window!="undefined"?window:self,p=null,_={CLIENT_ERROR:"mqtt_client_error",CONNECT:"mqtt_client_connect",DISCONNECT:"mqtt_client_disconnect",PUBLISH:"mqtt_client_publish",PUBLISH_TIMEOUT:"mqtt_qos1_publish_timeout",SOCKET_DISCONNECT:"mqtt_protocol_error"},f={CONNECT:"connect",DISCONNECT:"disconnect",INCOMING_PUBLISH:"incoming_publish",OUTGOING_PUBLISH:"outgoing_publish"},g=(function(){function t(e){this.$1=o("LogHistory").getInstance(u),this.$2=0,this.$3=Date.now(),this.$4=r("ChannelClientID").getID(),this.$7(),this.$5=o("MqttGlobalStreamCounter").getInstance(),this.$5.isEnabled()||(this.$5=null),this.$6=e}t.getInstance=function(n){return p||(p=new t(n)),p};var n=t.prototype;return n.setAppId=function(t){this.$2===0&&(this.$2=t)},n.eventLogConnect=function(t){var e,n,o=t.ackReceived,a=t.attemptNumber,i=t.connectionState,l=t.connectionStatus,s=t.disconnectCount,u=t.duration,c=t.errorMessage,m=t.failTotal,p=t.hostname,g=t.messageSizeBytes,h=t.osConnectivity,y=t.sessionID,C=t.successTotal,b=t.total_duration,v=l?"success":"failed";this.bumpCounter(_.CONNECT+"."+v);var S=C/(C+m),R=h&&this.getBrowserConnectivity(),L={acked:o,attempt_number:a.toString(),client_type:d,connection_state:i,disconnect_count:s.toString(),duration:u.toString(),error:c,event_type:f.CONNECT,extra_data:{connect_success_rate:S.toString(),device_id:this.$4,hostname:p,connectionStatus:l.toString(),exposure:(e=this.$6)!=null?e:""},os_connectivity:R,payload_size:g==null?void 0:g.toString(),session_id:y.toString(),total_duration:b.toString(),ws_count:(n=this.$5)==null?void 0:n.getGlobalState().totalConnectionStreams.toString()};this.$8(function(){r("MqttUnifiedClientConnectFalcoEvent").log(function(){return L})})},n.eventLogPull=function(t){var e=t.duration,n=t.errorMessage,r=t.hostname,a=t.pullEventName,i=t.sessionID,l=t.status,s={connection_status:l,device_id:this.$4,duration:e,error_message:n,hostname:r,href:m.location.hostname,logged_in:o("MqttEnv").Env.isUserLoggedInNow(),session_id:i};this.$9(a,s)},n.eventLogPullFinish=function(t){var e=t.duration,n=t.errorMessage,r=t.publishReceived,a=t.publishSent,i=t.pullEventName,l=t.sessionID,s={device_id:this.$4,duration:e,error_message:n,href:m.location.hostname,logged_in:o("MqttEnv").Env.isUserLoggedInNow(),publish_received:r,publish_sent:a,session_id:l};this.$9(i,s)},n.eventLogDisconnect=function(t){var e,n,o=t.disconnectCount,a=t.duration,i=t.errorMessage,l=t.sessionID;this.bumpCounter(_.DISCONNECT);var s={client_type:d,connection_state:"Disconnected",disconnect_count:o.toString(),duration:a.toString(),error:i,event_type:f.DISCONNECT,extra_data:{device_id:this.$4,exposure:(e=this.$6)!=null?e:""},os_connectivity:this.getBrowserConnectivity(),session_id:l.toString(),ws_count:(n=this.$5)==null?void 0:n.getGlobalState().totalConnectionStreams.toString()};this.$8(function(){r("MqttUnifiedClientDisconnectFalcoEvent").log(function(){return s})})},n.eventLogOutgoingPublish=function(t){var e=t.attempt,n=t.connectionState,o=t.disconnectCount,a=t.errorMessage,i=t.firstAttemptStartTime,l=t.payloadSizeBytes,s=t.protocol,u=t.qos,c=t.sessionID,m=t.success,p=t.thisAttemptStartTime,g=t.topic;this.bumpCounter(_.PUBLISH+"."+g);var h=Date.now(),y={acked:u===1?m:null,attempt_number:e.toString(),client_type:d,connection_state:n,disconnect_count:o.toString(),duration:(h-p).toString(),error:a,event_type:f.OUTGOING_PUBLISH,extra_data:{device_id:this.$4,protocol:s},os_connectivity:this.getBrowserConnectivity(),payload_size:l.toString(),qos:u.toString(),session_id:c.toString(),topic:g,total_duration:i!=null?(h-i).toString():null};this.$8(function(){r("MqttUnifiedClientIncomingPublishFalcoEvent").log(function(){return y})})},n.eventLogIncomingPublish=function(t){var e=t.connectionState,n=t.disconnectCount,o=t.payloadSizeBytes,a=t.qos,i=t.sessionID,l=t.topic,s={client_type:d,connection_state:e,disconnect_count:n.toString(),event_type:f.INCOMING_PUBLISH,extra_data:{device_id:this.$4},os_connectivity:this.getBrowserConnectivity(),payload_size:o.toString(),qos:a.toString(),session_id:i.toString(),topic:l},u=l=="/webrtc"||l=="/rtc_multi";this.$10(function(){r("MqttUnifiedClientOutgoingPublishFalcoEvent").log(function(){return s})},50,u)},n.logError=function(t,n){o("MqttEnv").Env.scheduleLoggingCallback(function(){try{r("FBLogger")(u).catching(t).mustfix(n)}catch(e){}})},n.logErrorWarn=function(t,n){o("MqttEnv").Env.scheduleLoggingCallback(function(){try{r("FBLogger")(u).catching(t).warn(n)}catch(e){}})},n.logWarn=function(t,n){var e=this;o("MqttEnv").Env.scheduleLoggingCallback(function(){try{e.$1.warn(t,n)}catch(e){}})},n.debugTrace=function(t,n){var e=this;o("MqttEnv").Env.scheduleLoggingCallback(function(){try{e.$1.debug(t,n)}catch(e){}})},n.bumpCounter=function(n){var t=this;o("Random").coinflip(c)&&o("MqttEnv").Env.scheduleLoggingCallback(function(){t.$2!==0&&(e||(e=o("ODS"))).bumpEntityKey(2966,"mqtt_ws_client",t.$2+"."+n,c),(e||(e=o("ODS"))).bumpEntityKey(2966,"mqtt_ws_client",n,c)})},n.$9=function(t,n,a){var e=this;o("MqttEnv").Env.scheduleLoggingCallback(function(){n.event_type=t,n.app_id=e.$2,n.online=e.$11();var o=JSON.stringify(n);e.$1.log(t,o,{weight:a}),t!==_.DISCONNECT&&r("MqttWsClientTypedLoggerLite").log(n)})},n.$10=function(t,n,r){var e;s&&n!==0?e=r||o("Random").coinflip(n):e=!0,e&&o("MqttEnv").Env.scheduleCallback(t)},n.$8=function(t){this.$10(t,0,!1)},n.$11=function(){return m.navigator&&m.navigator.onLine!==void 0?m.navigator.onLine:!1},n.getBrowserConnectivity=function(){return r("NetworkStatus").isOnline()},n.$7=function(){var e=this;if(m.navigator&&m.navigator.onLine!==void 0){var t=function(n){var t=n.online;t||e.bumpCounter("browser_disconnect")};r("NetworkStatus").onChange(t)}},t})();l.default=g}),98); __d("MqttEnvGk",["MqttEnv","MqttLogger","gkx"],(function(t,n,r,o,a,i,l){"use strict";function e(e){switch(e){case o("MqttEnv").MqttGkNames.mqtt_waterfall_log_client_sampling:return r("gkx")("21119");case o("MqttEnv").MqttGkNames.mqtt_ws_polling_enabled:return!0;case o("MqttEnv").MqttGkNames.mqtt_lp_use_fetch:return r("gkx")("21120");case o("MqttEnv").MqttGkNames.mqtt_fast_lp:return!1;case o("MqttEnv").MqttGkNames.mqtt_lp_no_delay:return r("gkx")("21122");case o("MqttEnv").MqttGkNames.mqtt_enable_publish_over_polling:return r("gkx")("21123");case o("MqttEnv").MqttGkNames.mqttweb_global_connection_counter:return r("gkx")("21124");default:return r("MqttLogger").getInstance().logError(new Error("unknown gk"),"Unknown GK value "+e),!1}}l.default=e}),98); __d("MqttEnvInitializer",["CurrentMessengerUser","MqttEnv","MqttEnvConfigStorage","MqttEnvGk","MqttLogger","Random","clearTimeout","setTimeoutAcrossTransitions"],(function(t,n,r,o,a,i,l){"use strict";function e(e){o("MqttEnv").Env.initialize(r("Random").random,o("CurrentMessengerUser").isLoggedInNow,r("clearTimeout"),r("setTimeoutAcrossTransitions"),function(){return r("MqttLogger").getInstance()},r("MqttEnvGk"),e!=null?e:null,null,null,o("MqttEnvConfigStorage").configRead,o("MqttEnvConfigStorage").configWrite)}var s={genGk:r("MqttEnvGk"),initialize:e};l.default=s}),98); __d("FBMqttChannel",["MqttChannel","MqttConfig","MqttEnvInitializer"],(function(t,n,r,o,a,i,l){"use strict";var e;r("MqttEnvInitializer").initialize();var s=new(r("MqttChannel"))({appId:(e=r("MqttConfig")).appID,capabilities:e.capabilities,chatVisibility:!1,clientCapabilities:e.clientCapabilities,endpoint:e.endpoint,initialSubscribedTopics:e.subscribedTopics,phpOverride:e.hostNameOverride,pollingEndpoint:e.pollingEndpoint,userFbid:e.fbid});l.default=s}),98); __d("RtiRequestStreamE2eClientBatchFalcoEvent",["FalcoLoggerInternal","getFalcoLogPolicy_DO_NOT_USE"],(function(t,n,r,o,a,i,l){"use strict";var e=r("getFalcoLogPolicy_DO_NOT_USE")("819"),s=o("FalcoLoggerInternal").create("rti_request_stream_e2e_client_batch",e),u=s;l.default=u}),98); __d("RtiRequestStreamE2eClientFalcoEvent",["FalcoLoggerInternal","getFalcoLogPolicy_DO_NOT_USE"],(function(t,n,r,o,a,i,l){"use strict";var e=r("getFalcoLogPolicy_DO_NOT_USE")("1857112"),s=o("FalcoLoggerInternal").create("rti_request_stream_e2e_client",e),u=s;l.default=u}),98); __d("RequestStreamE2ELogger",["ConstUriUtils","RequestStreamE2EClientLoggerEvent","RequestStreamE2EClientLoggerMessageType","RtiRequestStreamE2eClientBatchFalcoEvent","RtiRequestStreamE2eClientFalcoEvent","WebStorage"],(function(t,n,r,o,a,i,l){"use strict";var e,s="rs_debug_logging",u=["FBGQLS:COMMENT_CREATE_SUBSCRIBE","FBGQLS:COMMENT_LIKE_SUBSCRIBE","FBGQLS:FEEDBACK_COMMENT_PERMISSION_TOGGLE_SUBSCRIBE","FBGQLS:FEEDBACK_TYPING_SUBSCRIBE","GRAPHQL:CometNotificationsReceiveLiveQuery"],c=0;function d(){var e=Date.now();return c>=e?c+=1:c=e,c.toString()}var m=(function(){function e(e,t,n,r,a,i,l,s,u,c){this.$10=[],this.$11=!1,this.$1=e,this.$2=t,this.$3=n,this.$4=r,this.$5=a,this.$6=i,this.$7=l,this.$8=s,this.$9=u,this.$12=c!=null?c:!1;var d=o("ConstUriUtils").getUri(window.location.href);d&&(this.$13=d.getDomain())}var t=e.prototype;return t.logE2EEvent=function(t,n,r,o,a,i,l){if(r===void 0&&(r=null),o===void 0&&(o=null),a===void 0&&(a=null),i===void 0&&(i=null),l===void 0&&(l=null),this.$3!=="Falco"){var e={request_id:this.$1,resume_id:"0",retry_id:a,transport:this.$2,method:this.$3,use_case:this.$4,request_log_context:this.$5,force_log_context:this.$6,e2e_sample_rate:this.$7,message_type:t,event:n,timestamp_ms:d(),aux_id:o,additional_data:r,dgw_stream_group_logging_id:this.$8,dgw_count_prior_streams_in_group:this.$9,domain:this.$13,df_trace_id:i};this.$14(e,l)}},t.$14=function(t,n){if(!this.$12){r("RtiRequestStreamE2eClientFalcoEvent").log(function(){return t});return}if(this.$10.push(t),this.$11||t.event==r("RequestStreamE2EClientLoggerEvent").FAILURE||t.message_type==r("RequestStreamE2EClientLoggerMessageType").RESPONSE){var e={events:this.$10};r("RtiRequestStreamE2eClientBatchFalcoEvent").log(function(){return e}),this.$10=[],this.$11=!0}},t.getRequestId=function(){return this.$1},e})();function p(e,t,n){if(e==null||e.method==null)return null;var r=!1;if(u.includes(e.method)&&(r=!0),t==null||t.length===0)return null;var o=JSON.parse(t);return o.requestId==null?null:new m(o.requestId,n,e.method,_(e.method,e),o.requestLogContext,o.forceLogContext,o.sampleRate,o.dgwStreamGroupLoggingId,o.dgwCountPriorStreamsInGroup,r)}function _(e,t){if(e==="FBLQ"&&t.config_id)return t.config_id;if(e==="SKY"){if(t.topic){var n=t.topic.lastIndexOf("/");return n>0?t.topic.substr(0,n):t.topic}return}return e}function f(e,t,n,o,a,i){if(a===void 0&&(a=null),i===void 0&&(i=null),!(e==null||e.requestId==null||e.clientLoggingDisabled!=null)){var l={request_id:e.requestId,resume_id:"0",transport:t,e2e_sample_rate:e.sampleRate,message_type:n,event:o,timestamp_ms:d(),aux_id:e.auxId,additional_data:a,df_trace_id:i};r("RtiRequestStreamE2eClientFalcoEvent").log(function(){return l})}}l.RequestStreamE2ELogger=m,l.createStreamLogger=p,l.logRequestStreamE2EEventStatic=f}),98); __d("RequestStreamTransport",["$InternalEnum"],(function(t,n,r,o,a,i){"use strict";var e=n("$InternalEnum").Mirrored(["WEB_BR_MQTT","WEB_RS_MQTT","WEB_RS_STARGATE"]);i.RequestStreamTransport=e}),66); __d("BladeRunnerSocket",["BladeRunnerEventHandler","BladeRunnerLogger","BladeRunnerStreamStatus","BladeRunnerTypes","BladeRunnerTypesInternal","CurrentUser","FBMqttChannel","MqttPublishListener","Promise","RequestStreamE2EClientLoggerEvent","RequestStreamE2EClientLoggerMessageType","RequestStreamE2ELogger","RequestStreamTransport","getErrorSafe","justknobx","uuidv4"],(function(t,n,r,o,a,i,l){"use strict";var e,s="Connected",u="Disconnected",c="/br_sr",d="/sr_res",m=null;function p(e){var t,n;switch(e.type){case o("BladeRunnerTypes").StreamFrameType.REQUEST:return(t=e.request)==null?void 0:t.getInstrumentationData();case o("BladeRunnerTypes").StreamFrameType.DATA:return(n=e.data)==null?void 0:n.getInstrumentationData()}return null}function _(e){switch(e.type){case o("BladeRunnerTypes").StreamFrameType.REQUEST:return r("RequestStreamE2EClientLoggerMessageType").REQUEST_STREAM;case o("BladeRunnerTypes").StreamFrameType.DATA:return r("RequestStreamE2EClientLoggerMessageType").AMENDMENT}return null}function f(e){if(e===null)return null;switch(e){case o("BladeRunnerStreamStatus").StreamStatus.ACCEPTED:return"Accepted";case o("BladeRunnerStreamStatus").StreamStatus.REJECTED:return"Rejected";case o("BladeRunnerStreamStatus").StreamStatus.STARTED:return"Started";case o("BladeRunnerStreamStatus").StreamStatus.STOPPED:return"Stopped";case o("BladeRunnerStreamStatus").StreamStatus.CLOSED:return"Closed"}return null}function g(e){var t,n={};return e==null||(t=e.frames)==null||t.forEach(function(e){if(e.type===o("BladeRunnerTypes").StreamFrameType.STATUS_UPDATE){var t,r=(t=e.statusUpdate)==null?void 0:t.status,a=f(r);a!==null&&(n.flow_status=a)}}),n}function h(e,t){var n,r;switch(e.type){case o("BladeRunnerTypes").StreamFrameType.REQUEST:t.data_base64_size=(n=e.request)==null||(n=n.payload)==null||(n=n.length)==null?void 0:n.toString();break;case o("BladeRunnerTypes").StreamFrameType.DATA:t.data_base64_size=(r=e.data)==null||(r=r.rawDataSize())==null?void 0:r.toString();break}return null}function y(e,t,n){var a,i=p(e);if(i!=null){var l=_(e);if(l!=null){var s=null;switch(t){case o("MqttPublishListener").MqttPublishEvent.SENT:s=r("RequestStreamE2EClientLoggerEvent").SENT;break;case o("MqttPublishListener").MqttPublishEvent.ACKED:s=r("RequestStreamE2EClientLoggerEvent").PUBACK;break;case o("MqttPublishListener").MqttPublishEvent.NOT_ACKED:case o("MqttPublishListener").MqttPublishEvent.NOT_CONNECTED:case o("MqttPublishListener").MqttPublishEvent.PUBLISH_ERROR:s=r("RequestStreamE2EClientLoggerEvent").FAILURE,n.reason==null&&(n.reason=t);break}if(s!=null)if(h(e,n),((a=e.request)==null?void 0:a.e2eLogger)!=null&&i.clientLoggingDisabled==null){var u;(u=e.request)==null||u.e2eLogger.logE2EEvent(l,s,n,i.auxId)}else o("RequestStreamE2ELogger").logRequestStreamE2EEventStatic(i,o("RequestStreamTransport").RequestStreamTransport.WEB_BR_MQTT,l,s,n)}}}var C=(function(){function t(e){this.$1=[],this.$2=0,this.$3=0,this.$4=null,this.$5=0,this.$6=new Map,this.$7=e!=null?e:r("FBMqttChannel"),this.$8=new Map,r("BladeRunnerLogger").setClientSessionId(r("uuidv4")()),this.$9()}t.get=function(){return m==null&&(m=new t(r("FBMqttChannel"))),m};var a=t.prototype;return a.sendNewStreamRequest=function(n,o){var e=new(r("BladeRunnerEventHandler"))(n,o,this),a=n.getRequest();if(this.$6.set(a.streamId,e),!this.$10()){this.$11(e,a.streamId);return}this.getStreamCount()<=t.maxStreamCount?this.$12(a):(r("BladeRunnerLogger").bumpCounter("socket_request_throttled_max_streams"),r("BladeRunnerLogger").warn("Maximum stream count reached, will not send request: "+JSON.stringify(n.getRequest().getHeaders())),this.$11(e,a.streamId))},a.sendRetryStreamRequest=function(t){this.$12(t.getRequest())},a.sendCancel=function(t){r("BladeRunnerLogger").bumpCounter("socket_send_cancel");var e=new(o("BladeRunnerTypesInternal")).GatewayStreamStatusUpdate;e.streamId=t.streamId,e.status=o("BladeRunnerStreamStatus").StreamStatus.CLOSED,this.$13(e,t),this.removeStream(t.streamId)},a.sendAmendment=function(t,n,a){r("BladeRunnerLogger").bumpCounter("socket_send_amendment");var e=new(o("BladeRunnerTypesInternal")).GatewayStreamData;e.streamId=t,e.setData(n),a!=null&&(e.instrumentationData=a),this.$14(e)},a.sendAmendmentWithAck=function(a,i,l){var t=this;r("BladeRunnerLogger").bumpCounter("socket_send_amendment");var s=this.$15(),u=new(o("BladeRunnerTypesInternal")).GatewayStreamData;u.streamId=a,u.setData(i),u.shouldAck=!0,u.dataId=s,l!=null&&(u.instrumentationData=l);var c=new(e||(e=n("Promise")))(function(e,n){t.$8.set(s,{resolve:e,reject:n})});return this.$14(u),c},a.$14=function(t){this.$1.push(o("BladeRunnerTypesInternal").GatewayStreamFrame.newDataFrame(t)),this.$16()},a.sendDataAcks=function(t){r("BladeRunnerLogger").bumpCounter("socket_send_data_ack",t.length),this.$17(t)},a.removeStream=function(t){this.$6.delete(t)},a.getStreamCount=function(){return this.$6.size},a.getNextStreamId=function(){return this.$5++,this.$5},a.onMQTTStateChanged=function(t){this.$16(),!(t!=u&&t!=s||this.$4==t)&&(this.$4=t,r("BladeRunnerLogger").info("MQTTStateChanged: "+t),t==u?(r("BladeRunnerLogger").bumpCounter("mqtt_state_disconnected"),this.$18()):t==s&&r("BladeRunnerLogger").bumpCounter("mqtt_state_connected"))},a.$12=function(t){if(r("BladeRunnerLogger").bumpCounter("socket_send_request"),this.$1.push(o("BladeRunnerTypesInternal").GatewayStreamFrame.newRequestFrame(t)),!this.$16()){var e;(e=t.e2eLogger)==null||e.logE2EEvent(r("RequestStreamE2EClientLoggerMessageType").REQUEST_STREAM,r("RequestStreamE2EClientLoggerEvent").FAILURE,{reason:"MQTT Not Connected"})}},a.$13=function(t,n){if(this.$1.push(o("BladeRunnerTypesInternal").GatewayStreamFrame.newStatusUpdateFrame(t)),this.$16()){var e;(e=n.e2eLogger)==null||e.logE2EEvent(r("RequestStreamE2EClientLoggerMessageType").CANCEL,r("RequestStreamE2EClientLoggerEvent").SENT)}},a.$17=function(t){for(var e of t)this.$1.push(o("BladeRunnerTypesInternal").GatewayStreamFrame.newDataAckFrame(e));this.$16()},a.$19=function(){return this.$2++,this.$2},a.$15=function(){return this.$3++,this.$3},a.$16=function(){var e=!1;if(this.$7.getConnectionState()===s&&this.$1.length>0)try{this.$20(this.$1),e=!0}catch(e){}finally{this.$1=[]}return e},a.$20=function(t){var e=this,n=new(o("BladeRunnerTypesInternal")).GatewayStreamBatch(this.$19(),t),a=n.write();if(a.length>this.$21()){var i=Math.floor(t.length/2);if(i===0){t.forEach(function(e){return y(e,o("MqttPublishListener").MqttPublishEvent.PUBLISH_ERROR,{reason:"too long"})});var l=new Error("Publish is too long: "+a.length);throw l.stack,this.$22(n,l,"Publish is too long"),l}this.$20(t.slice(0,i)),this.$20(t.slice(i,t.length))}else try{r("BladeRunnerLogger").info("send message to "+c+" ("+a.length+" bytes)");var s={qos:1,skipBuffer:!1};if(n.isInstrumented()){var u=Date.now();s.listener={onEvent:function(n){var e=(Date.now()-u).toString();t.forEach(function(t){y(t,n,{latency:e})})}}}this.$7.publish(c,a,s).catch(function(t){e.$22(n,t,"Failed publishing to MQTT")}),r("BladeRunnerLogger").bumpCounter("mqtt_publish_success")}catch(e){var d=r("getErrorSafe")(e);throw this.$22(n,d,"Failed publishing to MQTT"),d}},a.$9=function(){var e=this;r("BladeRunnerLogger").info("Starting socket with endpoint "+this.$7.getEndpoint()+" useragent "+navigator.userAgent),this.onMQTTStateChanged(this.$7.getConnectionState()),this.$7.subscribeChannelEvents({onMQTTStateChanged:function(n){e.onMQTTStateChanged(n)},onJSError:function(t){var e=t!=null&&typeof t.isRecoverable=="boolean"?t.isRecoverable:!1;e?r("BladeRunnerLogger").bumpCounter("mqtt_channel_recoverable_error"):(r("BladeRunnerLogger").warn("JS error in MQTTChannel: "+(typeof t=="object"&&t!=null?t.toString():"unknown error")+", "+JSON.stringify(t)),r("BladeRunnerLogger").bumpCounter("mqtt_channel_error"))}}),this.$7.subscribe(c,function(e){throw new Error("Unexpected response: "+c+" "+e.toString())}),this.$7.subscribe(d,function(t){e.$23(t)})},a.$23=function(t){var e=o("BladeRunnerTypesInternal").GatewayStreamBatch.read(t);this.processBatch(e)},a.$22=function(t,n,a){for(var e of t.getFrames())if(e.type===o("BladeRunnerTypes").StreamFrameType.REQUEST){var i=e.getRequest(),l=this.$6.get(i.streamId);l!=null&&this.$24(l,i.streamId,o("BladeRunnerStreamStatus").StreamStatus.CLOSED,!0,null)}else if(e.type===o("BladeRunnerTypes").StreamFrameType.DATA){var s=e.getData(),u=s.dataId;if(s.shouldAck!=null&&s.shouldAck&&u!=null){var c=new(o("BladeRunnerTypesInternal")).GatewayStreamDataAck;c.streamId=s.streamId,c.dataId=u,c.success=!1,c.code=o("BladeRunnerTypesInternal").GatewayStreamDataAck.ACK_CODE_FAILED_TO_LAND,c.message=a,this.$25(c)}}r("BladeRunnerLogger").info("Failed publishing to MQTT: "+n.message),r("BladeRunnerLogger").bumpCounter("mqtt_publish_error")},a.$25=function(t){var e=this.$8.get(t.dataId);e!=null&&(this.$8.delete(t.dataId),t.success?e.resolve(!0):t.code===o("BladeRunnerTypesInternal").GatewayStreamDataAck.ACK_CODE_LANDED_BUT_NOT_ACCEPTED?e.resolve(!1):e.reject(t.message))},a.processBatch=function(t){try{o("RequestStreamE2ELogger").logRequestStreamE2EEventStatic(t.getInstrumentationData(),o("RequestStreamTransport").RequestStreamTransport.WEB_BR_MQTT,r("RequestStreamE2EClientLoggerMessageType").RESPONSE,r("RequestStreamE2EClientLoggerEvent").RECEIVED,g(t),t.getInstrumentationDataDfTraceId()),r("BladeRunnerLogger").bumpCounter("socket_process_batch");var e=JSON.stringify(t);r("BladeRunnerLogger").info("Received batch ("+e.length+" bytes)");var n=null;for(var a of t.getFrames()){var i=a.getStreamId();if(n==null&&(n=i),i!=null&&n!=i)throw new Error("Received batch with frames for multiple streams");a.type==o("BladeRunnerTypes").StreamFrameType.DATA_ACK&&this.$25(a.getDataAck())}if(n!=null){var l=this.$6.get(n);l!=null?l.onProxyResponse(t):r("BladeRunnerLogger").info("Received batch with frames for unknown stream id: "+n)}else r("BladeRunnerLogger").info("Received batch with no frames")}catch(e){var s=r("getErrorSafe")(e);throw r("BladeRunnerLogger").exception(s,"Failed processing batch from MQTT"),r("BladeRunnerLogger").bumpCounter("socket_process_batch_error"),s}},a.$18=function(){this.$6.forEach(function(e,t,n){e.onDisconnect()})},a.$11=function(t,n){this.$24(t,n,o("BladeRunnerStreamStatus").StreamStatus.REJECTED,!1,0)},a.$24=function(t,n,r,a,i){var e=new(o("BladeRunnerTypesInternal")).GatewayStreamStatusUpdate;e.streamId=n,e.status=r,e.shouldRetry=a,e.retryDelayMs=i;var l=new(o("BladeRunnerTypesInternal")).GatewayStreamBatch(null,[o("BladeRunnerTypesInternal").GatewayStreamFrame.newStatusUpdateFrame(e)]);t.onProxyResponse(l)},a.$10=function(){return r("CurrentUser").isLoggedIn()?!0:(r("BladeRunnerLogger").bumpCounter("request_stream_user_logged_out"),!1)},a.$21=function(){var e=1048576,t=512*1024;try{var n=r("justknobx")._("317");t=n*e}catch(e){}return Math.max(t-1024,0)},t})();C.maxStreamCount=2e3,l.default=C}),98); __d("BladeRunnerStream",["Promise","asyncToGeneratorRuntime"],(function(t,n,r,o,a,i){var e,l=(function(){function t(e){this.$1=e}var r=t.prototype;return r.getStreamHandler=function(){return this.$1},r.cancel=function(){},r.amendWithAck=(function(){var e=n("asyncToGeneratorRuntime").asyncToGenerator(function*(e){return!1});function t(t){return e.apply(this,arguments)}return t})(),r.amendFireAndForget=function(t){},r.amendWithoutAck=function(t){},r.start=function(){return(e||(e=n("Promise"))).resolve()},r.isAlive=function(){return!1},r.canAmend=function(){return!1},r.getStatus=function(){return null},r.getStreamId=function(){return 0},t})();i.default=l}),66); __d("BladeRunnerStreamState",["BladeRunnerLogger","BladeRunnerStreamStatus","BladeRunnerTypes"],(function(t,n,r,o,a,i,l){var e=(function(){function e(e){this.$1=e,this.$2=null,this.$3=0,this.$4=!1,this.$5=0,this.$6=!1}var t=e.prototype;return t.getRequest=function(){return this.$1},t.updateRetryRequestPayload=function(t){this.$1.updateRetryRequestPayload(t)},t.isAlive=function(){return!(this.$2==o("BladeRunnerStreamStatus").StreamStatus.CLOSED||this.$2==o("BladeRunnerStreamStatus").StreamStatus.REJECTED)},t.canAmend=function(){return this.$2==o("BladeRunnerStreamStatus").StreamStatus.ACCEPTED||this.$2==o("BladeRunnerStreamStatus").StreamStatus.STARTED||this.$2==o("BladeRunnerStreamStatus").StreamStatus.STOPPED},t.getLastStatus=function(){return this.$2},t.setLastStatus=function(t){this.$2=t},t.onError=function(){this.$3+=1},t.getErrorCount=function(){return this.$3},t.resetErrors=function(){this.$3=0},t.getRetryRequestScheduled=function(){return this.$6},t.setRetryRequestScheduled=function(t){this.$6=t},t.witnessFrame=function(t){switch(t.type){case o("BladeRunnerTypes").StreamFrameType.STATUS_UPDATE:var e=t.getStatusUpdate(),n=!0;switch(e.status){case o("BladeRunnerStreamStatus").StreamStatus.ACCEPTED:n=!this.$4,this.$4||(this.$4=!0);break;case o("BladeRunnerStreamStatus").StreamStatus.STARTED:n=this.getLastStatus()!=o("BladeRunnerStreamStatus").StreamStatus.STARTED;break;case o("BladeRunnerStreamStatus").StreamStatus.STOPPED:n=this.getLastStatus()==o("BladeRunnerStreamStatus").StreamStatus.STARTED;break;case o("BladeRunnerStreamStatus").StreamStatus.CLOSED:case o("BladeRunnerStreamStatus").StreamStatus.REJECTED:default:n=!0}return this.setLastStatus(e.status),n;case o("BladeRunnerTypes").StreamFrameType.REWRITE_REQUEST:return this.$7(t.getRewriteRequest()),!1;default:return!0}},t.setRetriesAllowed=function(t){this.$5=t},t.getRetriesAllowed=function(){return this.$5},t.$7=function(t){if(!(t.temporary!=null||t.temporary==!0)){if(t.newBody!=null&&(this.$1.payload=t.newBody),t.newExtraHeader!=null&&(this.$1.extraHeader=t.newExtraHeader,this.$1.headers=JSON.parse(t.newExtraHeader)),t.patchExtraHeader!=null)try{var e=JSON.parse(t.patchExtraHeader),n=this.$1.extraHeader!=null?JSON.parse(this.$1.extraHeader):{};this.$1.headers==null&&(this.$1.headers={});for(var o of Object.keys(e))this.$1.headers[o]=e[o],n[o]=e[o];this.$1.extraHeader=JSON.stringify(n)}catch(e){r("BladeRunnerLogger").warn("Failed to patch header: "+t.patchExtraHeader)}t.killBody!=null&&t.killBody==!0&&(this.$1.payload=null)}},e})();l.default=e}),98); __d("BladeRunnerSocketStream",["BladeRunnerStream","BladeRunnerStreamState","BladeRunnerStreamStatus","Promise","RequestStreamE2EClientLoggerEvent","RequestStreamE2EClientLoggerMessageType","asyncToGeneratorRuntime","uuidv4"],(function(t,n,r,o,a,i,l){var e,s=4,u={reason:"stream_dead"},c=(function(t){function a(e,n,o){var a;return a=t.call(this,e)||this,a.$BladeRunnerSocketStream$p_1=o,a.$BladeRunnerSocketStream$p_2=new(r("BladeRunnerStreamState"))(n),a.$BladeRunnerSocketStream$p_2.setRetriesAllowed(s),a}babelHelpers.inheritsLoose(a,t);var i=a.prototype;return i.start=function(){var t=this;return new(e||(e=n("Promise")))(function(e){t.send(),e()})},i.send=function(){var e,t,n=this.$BladeRunnerSocketStream$p_2.getRequest();(e=n.e2eLogger)==null||e.logE2EEvent(r("RequestStreamE2EClientLoggerMessageType").REQUEST_STREAM,r("RequestStreamE2EClientLoggerEvent").RECEIVED,{data_base64_size:(t=n.payload)==null||(t=t.length)==null?void 0:t.toString()}),this.$BladeRunnerSocketStream$p_1.sendNewStreamRequest(this.$BladeRunnerSocketStream$p_2,this.getStreamHandler())},i.amendWithAck=(function(){var t=n("asyncToGeneratorRuntime").asyncToGenerator(function*(t){var o,a=this.$BladeRunnerSocketStream$p_2.getRequest(),i=a.getInstrumentationData();if(i){var l,s;i.auxId=r("uuidv4")(),(l=a.e2eLogger)==null||l.logE2EEvent(r("RequestStreamE2EClientLoggerMessageType").AMENDMENT,r("RequestStreamE2EClientLoggerEvent").RECEIVED,{data_size:t==null||(s=t.length)==null?void 0:s.toString()},i.auxId)}if(this.canAmend()){if(i){var c,d;(c=a.e2eLogger)==null||c.logE2EEvent(r("RequestStreamE2EClientLoggerMessageType").AMENDMENT,r("RequestStreamE2EClientLoggerEvent").SENT,{data_size:t==null||(d=t.length)==null?void 0:d.toString()},i.auxId)}return this.$BladeRunnerSocketStream$p_1.sendAmendmentWithAck(a.streamId,this.$BladeRunnerSocketStream$p_3(t),i==null?null:JSON.stringify(i))}return(o=a.e2eLogger)==null||o.logE2EEvent(r("RequestStreamE2EClientLoggerMessageType").AMENDMENT,r("RequestStreamE2EClientLoggerEvent").FAILURE,u,i==null?void 0:i.auxId),(e||(e=n("Promise"))).reject("Stream is closed or not accepted")});function o(e){return t.apply(this,arguments)}return o})(),i.amendFireAndForget=function(t){var e=this.$BladeRunnerSocketStream$p_2.getRequest(),n=e.getInstrumentationData();if(n){var o,a;n.auxId=r("uuidv4")(),(o=e.e2eLogger)==null||o.logE2EEvent(r("RequestStreamE2EClientLoggerMessageType").AMENDMENT,r("RequestStreamE2EClientLoggerEvent").RECEIVED,{data_size:t==null||(a=t.length)==null?void 0:a.toString()},n.auxId)}if(this.canAmend()){if(this.$BladeRunnerSocketStream$p_1.sendAmendment(this.$BladeRunnerSocketStream$p_2.getRequest().streamId,this.$BladeRunnerSocketStream$p_3(t),n==null?null:JSON.stringify(n)),n){var i,l;(i=e.e2eLogger)==null||i.logE2EEvent(r("RequestStreamE2EClientLoggerMessageType").AMENDMENT,r("RequestStreamE2EClientLoggerEvent").SENT,{data_size:t==null||(l=t.length)==null?void 0:l.toString()},n.auxId)}}else{var s;throw(s=e.e2eLogger)==null||s.logE2EEvent(r("RequestStreamE2EClientLoggerMessageType").AMENDMENT,r("RequestStreamE2EClientLoggerEvent").FAILURE,u,n==null?void 0:n.auxId),new Error("Stream is closed or not accepted")}},i.amendWithoutAck=function(t){this.amendFireAndForget(t)},i.$BladeRunnerSocketStream$p_3=function(t){return typeof t=="object"?btoa(new TextDecoder("utf8").decode(t)):t},i.cancel=function(){var e,t=this.$BladeRunnerSocketStream$p_2.getRequest();(e=t.e2eLogger)==null||e.logE2EEvent(r("RequestStreamE2EClientLoggerMessageType").CANCEL,r("RequestStreamE2EClientLoggerEvent").RECEIVED),this.isAlive()&&(this.$BladeRunnerSocketStream$p_1.sendCancel(this.$BladeRunnerSocketStream$p_2.getRequest()),this.$BladeRunnerSocketStream$p_2.setLastStatus(o("BladeRunnerStreamStatus").StreamStatus.CLOSED),this.getStreamHandler().onClientCancel())},i.isAlive=function(){return this.$BladeRunnerSocketStream$p_2.isAlive()},i.canAmend=function(){return this.$BladeRunnerSocketStream$p_2.canAmend()},i.getStatus=function(){return this.$BladeRunnerSocketStream$p_2.getLastStatus()},i.getStreamId=function(){return this.$BladeRunnerSocketStream$p_2.getRequest().streamId},a})(r("BladeRunnerStream"));l.default=c}),98); __d("RequestStreamE2ESampling",["invariant","Random","RequestStreamE2EClientSamplingConfig","uuidv4"],(function(t,n,r,o,a,i,l,s){"use strict";function e(e){return e==null?!1:e.requestId!=null&&typeof e.requestId=="string"&&e.forceLogContext!=null&&typeof e.forceLogContext=="string"}function u(e,t){var n=r("RequestStreamE2EClientSamplingConfig").sampleRate;if(n>1&&e!=null){var o=r("RequestStreamE2EClientSamplingConfig").methodToSamplingMultiplier[e];o==0?n=0:o!=null&&(n/=o)}return n==1?1:n/t}function c(e,t,n,o){var a=r("uuidv4")();(t.requestId==null||t.requestId===""||typeof t.requestId!="string")&&(e.requestId!=null&&typeof e.requestId=="string"?t.requestId=e.requestId:t.requestId=a),t.requestId+="/_"+a.substring(0,4),t.resumeId="0",n!=null?t.sampleRate=n:t.sampleRate=void 0;var i="";o!=null&&o.length>0&&(i=o),i.length>0&&(t.requestLogContext!=null&&t.requestLogContext.length>0?t.requestLogContext+=":":t.requestLogContext="",t.requestLogContext+=i),(e==null?void 0:e.method)==="Falco"&&(t.clientLoggingDisabled="Falco");var l={};for(var s of Object.keys(t).sort())l[s]=t[s];return JSON.stringify(l)}function d(t,n,o,a){n&&(!n.requestId.includes("/")&&!n.requestId.includes("#")||s(0,41721));var i=u(t.method,a!=null?a:1);return r("Random").coinflip(i)?c(t,n||{requestId:""},i,o):e(n)?c(t,n||{requestId:""},null,o):""}l.isForceLogged=e,l.getSampleRateForLogging=u,l.normalizeInstrumentationData=c,l.validateInstrumentationData=d}),98); __d("BladeRunnerClient",["Base64","BladeRunnerConfig","BladeRunnerLogger","BladeRunnerSocket","BladeRunnerSocketStream","BladeRunnerTypes","BladeRunnerTypesInternal","RequestStreamE2ELogger","RequestStreamE2ESampling","RequestStreamTransport","cr:2046346"],(function(t,n,r,o,a,i,l){var e=(function(){function e(e,t){this.$2=o("RequestStreamTransport").RequestStreamTransport.WEB_BR_MQTT,this.$1=e!=null?e:r("BladeRunnerSocket").get(),t&&(this.$2=t)}var t=e.prototype;return t.createStream=function(t,n,r,o){return this.$3(t,n,r,o)},t.requestStream=function(t,r,o,a){var e=this.$3(t,r,o,a);return e.send(),n("cr:2046346")!=null&&n("cr:2046346").startPulsarTest(),e},t.logInfo=function(t){r("BladeRunnerLogger").info(t)},t.bumpCounter=function(t){r("BladeRunnerLogger").bumpCounter(t)},t.$3=function(t,n,a,i){var e=new(o("BladeRunnerTypesInternal")).GatewayStreamRequest;return e.streamId=this.$1.getNextStreamId(),e.requestType=o("BladeRunnerTypes").StreamRequestType.BLADE_RUNNER,e.headers=r("BladeRunnerConfig").patchRequestHeaders(t),e.extraHeader=JSON.stringify(e.headers),e.payload=n!=null?r("Base64").encode(n):null,i!=null&&(i.transport="WEB_RS_MQTT"),e.instrumentationData=o("RequestStreamE2ESampling").validateInstrumentationData(e.headers||{},i),e.e2eLogger=o("RequestStreamE2ELogger").createStreamLogger(e.headers,e.instrumentationData,this.$2),new(r("BladeRunnerSocketStream"))(a,e,this.$1)},e})();l.default=e}),98); __d("TWriteBuffer",[],(function(t,n,r,o,a,i){var e=(function(){function e(t){t===void 0&&(t=e.DEFAULT_BYTE_BUFFER_SIZE),this.$1=new DataView(new ArrayBuffer(t)),this.$2=0}var t=e.prototype;return t.write=function(t){this.$2+t.length>this.$1.byteLength&&this.$3(this.$2+t.length);for(var e=0;ethis.$1.byteLength&&this.$3(this.$2+1),this.$1.setUint8(this.$2,t),this.$2++,1},t.writeFloatBE=function(t){return this.$2+Float32Array.BYTES_PER_ELEMENT>this.$1.byteLength&&this.$3(this.$2+Float32Array.BYTES_PER_ELEMENT),this.$1.setFloat32(this.$2,t),this.$2+=Float32Array.BYTES_PER_ELEMENT,Float32Array.BYTES_PER_ELEMENT},t.writeDoubleBE=function(t){return this.$2+Float64Array.BYTES_PER_ELEMENT>this.$1.byteLength&&this.$3(this.$2+Float64Array.BYTES_PER_ELEMENT),this.$1.setFloat64(this.$2,t),this.$2+=Float64Array.BYTES_PER_ELEMENT,Float64Array.BYTES_PER_ELEMENT},t.toByteArray=function(){var e=new Uint8Array(this.$1.buffer,0,this.$2);return e},t.currentSize=function(){return this.$2},t.getUnderlyingDataView=function(){return this.$1},t.$3=function(t){var e=t*2;if(!Number.isSafeInteger(e))throw new Error("unable to resize");for(var n=new DataView(new ArrayBuffer(e)),r=0;r>6|192),e.writeByte(n&63|128);else if((n&64512)==55296){if(o+1>=t.length)throw new Error("UTF-16 string is truncated: ["+n.toString(16)+"]");if((t.charCodeAt(o+1)&64512)!==56320)throw new Error("Invalid UTF-16 string: ["+n.toString(16)+", "+t.charCodeAt(o+1).toString(16)+"]");n=65536+((n&1023)<<10)+(t.charCodeAt(++o)&1023),e.writeByte(n>>18|240),e.writeByte(n>>12&63|128),e.writeByte(n>>6&63|128),e.writeByte(n&63|128)}else e.writeByte(n>>12|224),e.writeByte(n>>6&63|128),e.writeByte(n&63|128);return e.toByteArray()};l.StringToUtf8=e}),98); __d("ThriftTypes",[],(function(t,n,r,o,a,i){var e=Object.freeze({STOP:0,VOID:1,BOOL:2,BYTE:3,I08:3,DOUBLE:4,I16:6,I32:8,I64:10,STRING:11,STRUCT:12,MAP:13,SET:14,LIST:15,FLOAT:19}),l=e;i.default=l}),66); __d("Utf8ToString",[],(function(t,n,r,o,a,i){var e=function(t,n){throw new Error(t+": ["+n.map(function(e){return e.toString(16)}).toString()+"]")},l=function(n){e("Invalid UTF-8 sequence",n)},s=function(n,r){e("Not enough bytes for "+n+"-byte sequence",r)},u=function(t){for(var e=0,n=[];e=128&&r<194)l([r]);else if(r>=194&&r<224){e>=t.length&&s(2,[r]);var o=t[e++];(o&192)!==128&&l([r,o]),n.push(String.fromCharCode((r&31)<<6|o&63))}else if(r>=240&&r<245){e+2>=t.length&&s(4,[r]);var a=t[e++],i=t[e++],u=t[e++];(r==240&&(!(a>=144&&a<192)||(i&192)!==128||(u&192)!==128)||r>=241&&r<244&&((a&192)!==128||(i&192)!==128||(u&192)!==128)||r==244&&(!(a>=128&&a<144)||(i&192)!==128||(u&192)!==128))&&l([r,a,i,u]);var c=((r&7)<<18|(a&63)<<12|(i&63)<<6|u&63)-65536;n.push(String.fromCharCode(55296+(c>>10))),n.push(String.fromCharCode(56320+(c&1023)))}else if(r>=245)l([r]);else{e+1>=t.length&&s(3,[r]);var d=t[e++],m=t[e++];r==224?d>=160&&d<192||l([r,d,m]):r>=225&&r<237?d>=128&&d<192||l([r,d,m]):r==237?d>=128&&d<160||l([r,d,m]):r>=238&&r<240&&(d>=128&&d<192||l([r,d,m])),m>=128&&m<192||l([r,d,m]),n.push(String.fromCharCode((r&15)<<12|(d&63)<<6|m&63))}}return n.join("")};i.Utf8ToString=u}),66); __d("jsbi",[],(function(t,n,r,o,a,i){(function(e,t){typeof i=="object"&&typeof a!="undefined"?a.exports=t():typeof define=="function"&&define.amd?define(t):e.JSBI=t()})(this,function(){"use strict";function e(t){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n,r=0;rc.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded");return r=m(this,a(c).call(this,e)),r.sign=n,r}return o(c,n),r(c,[{key:"toDebugString",value:function(){var e=["BigInt["],t=!0,n=!1,r=void 0;try{for(var o,a,i=this[Symbol.iterator]();!(t=(o=i.next()).done);t=!0)a=o.value,e.push((a&&(a>>>0).toString(16))+", ")}catch(e){n=!0,r=e}finally{try{t||i.return==null||i.return()}finally{if(n)throw r}}return e.push("]"),e.join("")}},{key:"toString",value:function(){var e=0e||36this.length&&(n=this.length);for(var r=65535&e,o=e>>>16,a=0,i=65535&t,l=t>>>16,u=0;u>>16,p=s(d,r),_=s(d,o),f=s(m,r),g=s(m,o),h=i+(65535&p),y=l+a+(h>>>16)+(p>>>16)+(65535&_)+(65535&f);i=(_>>>16)+(f>>>16)+(65535&g)+(y>>>16),a=i>>>16,i&=65535,l=g>>>16,this.__setDigit(u,65535&h|y<<16)}if(a!==0||i!==0||l!==0)throw new Error("implementation bug")}},{key:"__inplaceAdd",value:function(e,t,n){for(var r,o=0,a=0;a>>16,this.__setHalfDigit(t+a,r);return o}},{key:"__inplaceSub",value:function(e,t,n){var r=0;if(1&t){t>>=1;for(var o=this.__digit(t),a=65535&o,i=0;i>>1;i++){var l=e.__digit(i),s=(o>>>16)-(65535&l)-r;r=1&s>>>16,this.__setDigit(t+i,s<<16|65535&a),o=this.__digit(t+i+1),a=(65535&o)-(l>>>16)-r,r=1&a>>>16}var u=e.__digit(i),c=(o>>>16)-(65535&u)-r;if(r=1&c>>>16,this.__setDigit(t+i,c<<16|65535&a),t+i+1>=this.length)throw new RangeError("out of bounds");(1&n)==0&&(o=this.__digit(t+i+1),a=(65535&o)-(u>>>16)-r,r=1&a>>>16,this.__setDigit(t+e.length,4294901760&o|65535&a))}else{t>>=1;for(var d=0;d>>16;var f=(m>>>16)-(p>>>16)-r;r=1&f>>>16,this.__setDigit(t+d,f<<16|65535&_)}var g=this.__digit(t+d),h=e.__digit(d),y=(65535&g)-(65535&h)-r;r=1&y>>>16;var C=0;(1&n)==0&&(C=(g>>>16)-(h>>>16)-r,r=1&C>>>16),this.__setDigit(t+d,C<<16|65535&y)}return r}},{key:"__inplaceRightShift",value:function(e){if(e!==0){for(var t,n=this.__digit(0)>>>e,r=this.length-1,o=0;o>>e;this.__setDigit(r,n)}}},{key:"__digit",value:function(e){return this[e]}},{key:"__unsignedDigit",value:function(e){return this[e]>>>0}},{key:"__setDigit",value:function(e,t){this[e]=0|t}},{key:"__setDigitGrow",value:function(e,t){this[e]=0|t}},{key:"__halfDigitLength",value:function(){var e=this.length;return 65535>=this.__unsignedDigit(e-1)?2*e-1:2*e}},{key:"__halfDigit",value:function(e){return 65535&this[e>>>1]>>>((1&e)<<4)}},{key:"__setHalfDigit",value:function(e,t){var n=e>>>1,r=this.__digit(n),o=1&e?65535&r|t<<16:4294901760&r|65535&t;this.__setDigit(n,o)}}],[{key:"BigInt",value:function(t){var n=Math.floor,r=Number.isFinite;if(typeof t=="number"){if(t===0)return c.__zero();if((0|t)===t)return 0>t?c.__oneDigit(-t,!0):c.__oneDigit(t,!1);if(!r(t)||n(t)!==t)throw new RangeError("The number "+t+" cannot be converted to BigInt because it is not an integer");return c.__fromDouble(t)}if(typeof t=="string"){var o=c.__fromString(t);if(o===null)throw new SyntaxError("Cannot convert "+t+" to a BigInt");return o}if(typeof t=="boolean")return t===!0?c.__oneDigit(1,!1):c.__zero();if(e(t)==="object"){if(t.constructor===c)return t;var a=c.__toPrimitive(t);return c.BigInt(a)}throw new TypeError("Cannot convert "+t+" to a BigInt")}},{key:"toNumber",value:function(e){var t=e.length;if(t===0)return 0;if(t===1){var n=e.__unsignedDigit(0);return e.sign?-n:n}var r=e.__digit(t-1),o=u(r),a=32*t-o;if(1024>>=12;var p=d-12,_=12<=d?0:l<<20+d,f=20+d;0>>32-p,_=l<>>32-f,f-=32);var g=c.__decideRounding(e,f,s,l);if((g===1||g===0&&(1&_)==1)&&(_=_+1>>>0,_===0&&(m++,m>>>20!=0&&(m=0,i++,1023=c.__kMaxLengthBits)throw new RangeError("BigInt too big");if(e.length===1&&e.__digit(0)===2){var r=1+(n>>>5),o=e.sign&&(1&n)!=0,a=new c(r,o);a.__initializeDigits();var i=1<<(31&n);return a.__setDigit(r-1,i),a}var l=null,s=e;for((1&n)!=0&&(l=e),n>>=1;n!==0;n>>=1)s=c.multiply(s,s),(1&n)!=0&&(l===null?l=s:l=c.multiply(l,s));return l}},{key:"multiply",value:function(e,t){if(e.length===0)return e;if(t.length===0)return t;var n=e.length+t.length;32<=e.__clzmsd()+t.__clzmsd()&&n--;var r=new c(n,e.sign!==t.sign);r.__initializeDigits();for(var o=0;oc.__absoluteCompare(e,t))return c.__zero();var n,r=e.sign!==t.sign,o=t.__unsignedDigit(0);if(t.length===1&&65535>=o){if(o===1)return r===e.sign?e:c.unaryMinus(e);n=c.__absoluteDivSmall(e,o,null)}else n=c.__absoluteDivLarge(e,t,!0,!1);return n.sign=r,n.__trim()}},{key:"remainder",value:function(t,n){if(n.length===0)throw new RangeError("Division by zero");if(0>c.__absoluteCompare(t,n))return t;var e=n.__unsignedDigit(0);if(n.length===1&&65535>=e){if(e===1)return c.__zero();var r=c.__absoluteModSmall(t,e);return r===0?c.__zero():c.__oneDigit(r,t.sign)}var o=c.__absoluteDivLarge(t,n,!1,!0);return o.sign=t.sign,o.__trim()}},{key:"add",value:function(e,t){var n=e.sign;return n===t.sign?c.__absoluteAdd(e,t,n):0<=c.__absoluteCompare(e,t)?c.__absoluteSub(e,t,n):c.__absoluteSub(t,e,!n)}},{key:"subtract",value:function(e,t){var n=e.sign;return n===t.sign?0<=c.__absoluteCompare(e,t)?c.__absoluteSub(e,t,n):c.__absoluteSub(t,e,!n):c.__absoluteAdd(e,t,n)}},{key:"leftShift",value:function(e,t){return t.length===0||e.length===0?e:t.sign?c.__rightShiftByAbsolute(e,t):c.__leftShiftByAbsolute(e,t)}},{key:"signedRightShift",value:function(e,t){return t.length===0||e.length===0?e:t.sign?c.__leftShiftByAbsolute(e,t):c.__rightShiftByAbsolute(e,t)}},{key:"unsignedRightShift",value:function(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}},{key:"lessThan",value:function(e,t){return 0>c.__compareToBigInt(e,t)}},{key:"lessThanOrEqual",value:function(e,t){return 0>=c.__compareToBigInt(e,t)}},{key:"greaterThan",value:function(e,t){return 0=c.__kMaxLengthBits)return t;var n=e+31>>>5;if(t.lengthc.__kMaxLengthBits)throw new RangeError("BigInt too big");return c.__truncateAndSubFromPowerOfTwo(e,t,!1)}if(e>=c.__kMaxLengthBits)return t;var n=e+31>>>5;if(t.length>>r))return t}return c.__truncateToNBits(e,t)}},{key:"ADD",value:function(e,t){if(e=c.__toPrimitive(e),t=c.__toPrimitive(t),typeof e=="string")return typeof t!="string"&&(t=t.toString()),e+t;if(typeof t=="string")return e.toString()+t;if(e=c.__toNumeric(e),t=c.__toNumeric(t),c.__isBigInt(e)&&c.__isBigInt(t))return c.add(e,t);if(typeof e=="number"&&typeof t=="number")return e+t;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}},{key:"LT",value:function(e,t){return c.__compare(e,t,0)}},{key:"LE",value:function(e,t){return c.__compare(e,t,1)}},{key:"GT",value:function(e,t){return c.__compare(e,t,2)}},{key:"GE",value:function(e,t){return c.__compare(e,t,3)}},{key:"EQ",value:function(t,n){for(;;){if(c.__isBigInt(t))return c.__isBigInt(n)?c.equal(t,n):c.EQ(n,t);if(typeof t=="number"){if(c.__isBigInt(n))return c.__equalToNumber(n,t);if(e(n)!=="object")return t==n;n=c.__toPrimitive(n)}else if(typeof t=="string"){if(c.__isBigInt(n))return t=c.__fromString(t),t!==null&&c.equal(t,n);if(e(n)!=="object")return t==n;n=c.__toPrimitive(n)}else if(typeof t=="boolean"){if(c.__isBigInt(n))return c.__equalToNumber(n,+t);if(e(n)!=="object")return t==n;n=c.__toPrimitive(n)}else if(e(t)==="symbol"){if(c.__isBigInt(n))return!1;if(e(n)!=="object")return t==n;n=c.__toPrimitive(n)}else if(e(t)==="object"){if(e(n)==="object"&&n.constructor!==c)return t==n;t=c.__toPrimitive(t)}else return t==n}}},{key:"NE",value:function(e,t){return!c.EQ(e,t)}},{key:"__zero",value:function(){return new c(0,!1)}},{key:"__oneDigit",value:function(e,t){var n=new c(1,t);return n.__setDigit(0,e),n}},{key:"__decideRounding",value:function(e,t,n,r){if(0t)o=-t-1;else{if(n===0)return-1;n--,r=e.__digit(n),o=31}var a=1<>>20,r=n-1023,o=(r>>>5)+1,a=new c(o,0>e),i=1048575&c.__kBitConversionInts[1]|1048576,l=c.__kBitConversionInts[0],s=20,u=31&r,d=0;if(u>>m,i=i<<32-m|l>>>m,l<<=32-m}else if(u===s)d=32,t=i,i=l;else{var p=u-s;d=32-p,t=i<>>32-p,i=l<=e&&9<=e||(159>=e?e==32:131071>=e?e==160||e==5760:196607>=e?(e&=131071,10>=e||e==40||e==41||e==47||e==95||e==4096):e==65279)}},{key:"__fromString",value:function(e){var t=11073741824/l)return null;var u=l*i+s>>>c.__kBitsPerCharTableShift,d=new c(u+31>>>5,!1),m=10>t?t:10,p=10>=c.__kBitsPerCharTableShift;var _=[],f=[],g=!1;do{for(var h,y=0,C=0;;){if(h=void 0,a-48>>>0>>0>>0>>0>>c.__kBitsPerCharTableShift+5;d.__inplaceMultiplyAdd(L,R,k)}while(!b)}if(o!==r){if(!c.__isWhitespace(a))return null;for(o++;o>>s-a)}if(o!==0){if(r>=e.length)throw new Error("implementation bug");e.__setDigit(r++,o)}for(;r>>1)+(85&r),r=(51&r>>>2)+(51&r),r=(15&r>>>4)+(15&r);var o=r,a=t-1,i=e.__digit(n-1),l=u(i),s=0|(32*n-l+o-1)/o;if(e.sign&&s++,268435456>>y,_=32-y;_>=o;)d[m--]=c.__kConversionChars[p&a],p>>>=o,_-=o}var C=(p|i<<_)&a;for(d[m--]=c.__kConversionChars[C],p=i>>>o-_;p!==0;)d[m--]=c.__kConversionChars[p&a],p>>>=o;if(e.sign&&(d[m--]="-"),m!==-1)throw new Error("implementation bug");return d.join("")}},{key:"__toStringGeneric",value:function(e,t,n){var r=e.length;if(r===0)return"";if(r===1){var o=e.__unsignedDigit(0).toString(t);return n===!1&&e.sign&&(o="-"+o),o}var a=32*r-u(e.__digit(r-1)),i=c.__kMaxBitsPerChar[t],l=i-1,s=a*c.__kBitsPerCharTableMultiplier;s+=l-1,s=0|s/l;var d,m,p=s+1>>1,_=c.exponentiate(c.__oneDigit(t,!1),c.__oneDigit(p,!1)),f=_.__unsignedDigit(0);if(_.length===1&&65535>=f){d=new c(e.length,!1),d.__initializeDigits();for(var g,h=0,y=2*e.length-1;0<=y;y--)g=h<<16|e.__halfDigit(y),d.__setHalfDigit(y,0|g/f),h=0|g%f;m=h.toString(t)}else{var C=c.__absoluteDivLarge(e,_,!0,!0);d=C.quotient;var b=C.remainder.__trim();m=c.__toStringGeneric(b,t,!0)}d.__trim();for(var v=c.__toStringGeneric(d,t,!0);m.lengthr?c.__absoluteLess(n):0}},{key:"__compareToNumber",value:function(e,t){if(!0|t){var n=e.sign,r=0>t;if(n!==r)return c.__unequalSign(n);if(e.length===0){if(r)throw new Error("implementation bug");return t===0?0:-1}if(1o?c.__absoluteGreater(n):at)return c.__unequalSign(n);if(t===0)throw new Error("implementation bug: should be handled elsewhere");if(e.length===0)return-1;c.__kBitConversionDouble[0]=t;var r=2047&c.__kBitConversionInts[1]>>>20;if(r==2047)throw new Error("implementation bug: handled elsewhere");var o=r-1023;if(0>o)return c.__absoluteGreater(n);var a=e.length,i=e.__digit(a-1),l=u(i),s=32*a-l,d=o+1;if(sd)return c.__absoluteGreater(n);var m=1048576|1048575&c.__kBitConversionInts[1],p=c.__kBitConversionInts[0],_=20,f=31-l;if(f!==(s-1)%31)throw new Error("implementation bug");var g,h=0;if(f<_){var y=_-f;h=y+32,g=m>>>y,m=m<<32-y|p>>>y,p<<=32-y}else if(f===_)h=32,g=m,m=p;else{var C=f-_;h=32-C,g=m<>>32-C,m=p<>>=0,g>>>=0,i>g)return c.__absoluteGreater(n);if(i>>0,m=p,p=0):g=0;var v=e.__unsignedDigit(b);if(v>g)return c.__absoluteGreater(n);if(vt&&e.__unsignedDigit(0)===i(t):c.__compareToDouble(e,t)===0}},{key:"__comparisonResultToBool",value:function(e,t){switch(t){case 0:return 0>e;case 1:return 0>=e;case 2:return 0t;case 3:return e>=t}if(c.__isBigInt(e)&&typeof t=="string")return t=c.__fromString(t),t!==null&&c.__comparisonResultToBool(c.__compareToBigInt(e,t),n);if(typeof e=="string"&&c.__isBigInt(t))return e=c.__fromString(e),e!==null&&c.__comparisonResultToBool(c.__compareToBigInt(e,t),n);if(e=c.__toNumeric(e),t=c.__toNumeric(t),c.__isBigInt(e)){if(c.__isBigInt(t))return c.__comparisonResultToBool(c.__compareToBigInt(e,t),n);if(typeof t!="number")throw new Error("implementation bug");return c.__comparisonResultToBool(c.__compareToNumber(e,t),n)}if(typeof e!="number")throw new Error("implementation bug");if(c.__isBigInt(t))return c.__comparisonResultToBool(c.__compareToNumber(t,e),2^n);if(typeof t!="number")throw new Error("implementation bug");return n===0?et:n===3?e>=t:void 0}},{key:"__absoluteAdd",value:function(e,t,n){if(e.length>>16)+(l>>>16)+(u>>>16);a=d>>>16,o.__setDigit(i,65535&u|d<<16)}for(;i>>16)+(p>>>16);a=_>>>16,o.__setDigit(i,65535&p|_<<16)}return i>>16;var u=(i>>>16)-(l>>>16)-o;o=1&u>>>16,r.__setDigit(a,65535&s|u<<16)}for(;a>>16;var p=(d>>>16)-o;o=1&p>>>16,r.__setDigit(a,65535&m|p<<16)}return r.__trim()}},{key:"__absoluteAddOne",value:function(e,t){var n=2r?0:e.__unsignedDigit(r)>t.__unsignedDigit(r)?1:-1}},{key:"__multiplyAccumulate",value:function(e,t,n,r){if(t!==0){for(var o=65535&t,a=t>>>16,i=0,l=0,u=0,c=0;c>>16,_=e.__digit(c),f=65535&_,g=_>>>16,h=s(f,o),y=s(f,a),C=s(g,o),b=s(g,a);m+=l+(65535&h),p+=u+i+(m>>>16)+(h>>>16)+(65535&y)+(65535&C),i=p>>>16,l=(y>>>16)+(C>>>16)+(65535&b)+i,i=l>>>16,l&=65535,u=b>>>16,d=65535&m|p<<16,n.__setDigit(r,d)}for(;i!==0||l!==0||u!==0;r++){var v=n.__digit(r),S=(65535&v)+l,R=(v>>>16)+(S>>>16)+u+i;l=0,u=0,i=R>>>16,v=65535&S|R<<16,n.__setDigit(r,v)}}}},{key:"__internalMultiplyAdd",value:function(e,t,n,r,o){for(var a=n,i=0,l=0;l>>16;var m=s(u>>>16,t),p=(65535&m)+(c>>>16)+a;a=p>>>16,i=m>>>16,o.__setDigit(l,p<<16|65535&d)}if(o.length>r)for(o.__setDigit(r++,a+i);r>>0,i=0|a/t;r=0|a%t,a=(r<<16|e.__halfDigit(o-1))>>>0;var l=0|a/t;r=0|a%t,n.__setDigit(o>>>1,i<<16|l)}return n}},{key:"__absoluteModSmall",value:function(e,t){for(var n,r=0,o=2*e.length-1;0<=o;o--)n=(r<<16|e.__halfDigit(o))>>>0,r=0|n%t;return r}},{key:"__absoluteDivLarge",value:function(e,t,n,r){var o=t.__halfDigitLength(),a=t.length,i=e.__halfDigitLength()-o,l=null;n&&(l=new c(i+2>>>1,!1),l.__initializeDigits());var u=new c(o+2>>>1,!1);u.__initializeDigits();var d=c.__clz16(t.__halfDigit(o-1));0>>0;g=0|y/p;for(var C=0|y%p,b=t.__halfDigit(o-2),v=m.__halfDigit(f+o-2);s(g,b)>>>0>(C<<16|v)>>>0&&(g--,C+=p,!(65535>>1,_|g))}return r?(m.__inplaceRightShift(d),n?{quotient:l,remainder:m}:m):n?l:void 0}},{key:"__clz16",value:function(e){return u(e)-16}},{key:"__specialLeftShift",value:function(e,t,n){var r=e.length,o=new c(r+n,!1);if(t===0){for(var a=0;a>>32-t;return 0n)throw new RangeError("BigInt too big");var r=n>>>5,o=31&n,a=e.length,i=o!==0&&e.__digit(a-1)>>>32-o!=0,l=a+r+(i?1:0),s=new c(l,e.sign);if(o===0){for(var u=0;u>>32-o;if(i)s.__setDigit(a+r,d);else if(d!==0)throw new Error("implementation bug")}return s.__trim()}},{key:"__rightShiftByAbsolute",value:function(e,t){var n=e.length,r=e.sign,o=c.__toShiftAmount(t);if(0>o)return c.__rightShiftByMaximum(r);var a=o>>>5,i=31&o,l=n-a;if(0>=l)return c.__rightShiftByMaximum(r);var s=!1;if(r){if((e.__digit(a)&(1<>>i,g=n-a-1,h=0;h>>i;m.__setDigit(g,f)}return s&&(m=c.__absoluteAddOne(m,!0,m)),m.__trim()}},{key:"__rightShiftByMaximum",value:function(e){return e?c.__oneDigit(1,!0):c.__zero()}},{key:"__toShiftAmount",value:function(e){if(1c.__kMaxLengthBits?-1:t}},{key:"__toPrimitive",value:function(t){var n=1>>5,r=new c(n,t.sign),o=n-1,a=0;a>>l}return r.__setDigit(o,i),r.__trim()}},{key:"__truncateAndSubFromPowerOfTwo",value:function(e,t,n){for(var r=Math.min,o=e+31>>>5,a=new c(o,n),i=0,l=o-1,s=0,u=r(l,t.length);i>>16;var p=0-(d>>>16)-s;s=1&p>>>16,a.__setDigit(i,65535&m|p<<16)}for(;i>>16;var y=0-(f>>>16)-s;_=65535&h|y<<16}else{var C=32-g;f=f<>>C;var b=1<<32-C,v=(65535&b)-(65535&f)-s;s=1&v>>>16;var S=(b>>>16)-(f>>>16)-s;_=65535&v|S<<16,_&=b-1}return a.__setDigit(l,_),a.__trim()}},{key:"__digitPow",value:function(e,t){for(var n=1;0>>=1,e*=e;return n}}]),c})(c(Array));return p.__kMaxLength=33554432,p.__kMaxLengthBits=p.__kMaxLength<<5,p.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],p.__kBitsPerCharTableShift=5,p.__kBitsPerCharTableMultiplier=1<this.$3&&t.fid-this.$3<=D-1?e+=this.$1.writeByte(t.fid-this.$3<<4|r):(e+=this.$1.writeByte(r),e+=this.writeI16(t.fid)),this.$3=t.fid,e},n.$8=function(t){var e=0,n=this.$9(t.etype);return t.size<=D-2?e+=this.$1.writeByte(t.size<<4|n):(e+=this.$1.writeByte(240|n),e+=this.writeVarint32(t.size)),e},n.readFieldBegin=function(){var t=this.$1.readByte(),n=t&15;if(n===(e||(e=r("ThriftTypes"))).STOP)return{ftype:(e||(e=r("ThriftTypes"))).STOP,fid:0};var o=(t&240)>>>4,a;o===0?a=this.readI16():a=this.$3+o;var i=this.$10(n);return(n===u.CT_BOOLEAN_TRUE||n===u.CT_BOOLEAN_FALSE)&&(this.$5=n===u.CT_BOOLEAN_TRUE),this.$3=a,{ftype:i,fid:a}},n.readListBegin=function(){return this.$11()},n.readListEnd=function(){return 0},n.readSetBegin=function(){return this.$11()},n.readSetEnd=function(){return 0},n.readMapBegin=function(){var e=this.readVarint32();if(e>0){var t=this.$1.readByte(),n=this.$12(t>>4,"readMapBegin:key"),r=this.$12(t&15,"readMapBegin:value");return{ktype:this.$10(n),vtype:this.$10(r),size:e}}return{size:e}},n.readMapEnd=function(){return 0},n.$12=function(t,n){if(t<0||t>13)throw new Error(n+" read invalid compact type: "+t);return t},n.$11=function(){var e=this.$1.readByte(),t=this.$12(e&15,"_readListOrSetBegin"),n=this.$10(t),r=e>>4&15;return r===15&&(r=this.readVarint32()),{etype:n,size:r}},n.readFieldEnd=function(){return 0},n.readByte=function(){return this.$6.setUint8(0,this.$1.readByte()),this.$6.getInt8(0)},n.writeByte=function(t){if(tm)throw new Error("byte to write is out of range: "+t);return this.$6.setInt8(0,t),this.$1.writeByte(this.$6.getUint8(0))},n.readFloat=function(){return this.$1.readFloatBE()},n.writeFloat=function(t){return this.$1.writeFloatBE(t)},n.readDouble=function(){return this.$1.readDoubleBE()},n.writeDouble=function(t){return this.$1.writeDoubleBE(t)},n.writeString=function(t){return this.writeBinary(o("StringToUtf8").StringToUtf8(t))},n.skip=function(n){switch(n){case(e||(e=r("ThriftTypes"))).STOP:return;case(e||(e=r("ThriftTypes"))).BOOL:this.readBool();break;case(e||(e=r("ThriftTypes"))).BYTE:this.readByte();break;case(e||(e=r("ThriftTypes"))).DOUBLE:this.readDouble();break;case(e||(e=r("ThriftTypes"))).I16:this.readI16();break;case(e||(e=r("ThriftTypes"))).I32:this.readI32();break;case(e||(e=r("ThriftTypes"))).I64:this.readI64();break;case(e||(e=r("ThriftTypes"))).STRING:this.readString();break;case(e||(e=r("ThriftTypes"))).STRUCT:{this.readStructBegin();for(var t;t=this.readFieldBegin(),t.ftype!==(e||(e=r("ThriftTypes"))).STOP;)this.skip(t.ftype);this.readStructEnd();break}case(e||(e=r("ThriftTypes"))).MAP:{var o=this.readMapBegin();if(o.size>0&&o.ktype!=null&&o.vtype!=null)for(var a=o.ktype,i=o.vtype,l=0;l_)throw new Error("trying to write i16 out of range: "+t);return this.writeVarint32(this.i32ToZigzag(t))},n.readI16=function(){var e=this.zigzagToI32(this.readVarint32());if(e_)throw new Error("read invalid i16: "+e);return e},n.writeI32=function(t){if(tg)throw new Error("i32 out of range: "+t);return this.writeVarint32(this.i32ToZigzag(t))},n.readI32=function(){return this.zigzagToI32(this.readVarint32())},n.writeI64=function(t){return this.writeVarint64(this.i64ToZigzag(t))},n.readI64=function(){return this.zigzagToI64(this.readVarint64())},n.readBool=function(){var e;return this.$5!=null?(e=this.$5,this.$5=null):e=this.$1.readByte()===u.CT_BOOLEAN_TRUE,e},n.writeBool=function(t){var e=0;return this.$4!=null?(e+=this.$7(this.$4,t?c.CT_BOOLEAN_TRUE:c.CT_BOOLEAN_FALSE),this.$4=null):e+=this.$1.writeByte(t?u.CT_BOOLEAN_TRUE:u.CT_BOOLEAN_FALSE),e},n.readBinary=function(){var e=this.readVarint32();return e===0?new Uint8Array(0):this.$1.readBytes(e)},n.writeBinary=function(t){var e=0;return e+=this.writeVarint32(t.length),e+=this.$1.write(t),e},n.i32ToZigzag=function(t){if(tg)throw new Error("number: "+t+" is out of range of i32");return(t<<1^(t<0?4294967295:0))>>>0},n.zigzagToI32=function(t){if(t<0||t>y)throw new Error("number: "+t+" is out of range of uint32");return t>>>1^-1*(t&1)},n.i64ToZigzag=function(t){if(r("jsbi").greaterThan(t,C)||r("jsbi").lessThan(t,b))throw new Error("i64 out of range: "+t.toString());return r("jsbi").bitwiseXor(r("jsbi").signedRightShift(t,S),r("jsbi").leftShift(t,R))},n.zigzagToI64=function(t){if(r("jsbi").lessThan(t,0)||r("jsbi").greaterThan(t,v))throw new Error("invalid uint64: "+t.toString());return r("jsbi").equal(r("jsbi").bitwiseAnd(t,R),R)?r("jsbi").bitwiseNot(r("jsbi").signedRightShift(t,R)):r("jsbi").signedRightShift(t,R)},n.writeVarint32=function(t){if(t<0||t>y)throw new Error("writeVarint32 received out of range uint32: "+t);for(var e=t,n=0;;)if(e>>>7)this.$1.writeByte(e&127|128),n++,e>>>=7;else{this.$1.writeByte(e),n++;break}return n},n.readVarint32=function(){for(var e=0,t=0,n;;){if(n=this.$1.readByte(),e=(e|(n&127)<>>0,t+=7,(n&128)==0){if(t===35&&(n&240)!=0)throw new Error("result exceeded 32 bit limit");break}if(t>28)throw new Error("result exceeded 32 bit limit")}return e},n.writeVarint64=function(t){if(r("jsbi").lessThan(t,L)||r("jsbi").greaterThan(t,v))throw new Error("invalid uint64: "+t.toString());for(var e=t,n=0;;)if(r("jsbi").equal(r("jsbi").signedRightShift(e,E),L)){this.$1.writeByte(r("jsbi").toNumber(e)),n++;break}else{var o,a=(o=r("jsbi")).toNumber(o.bitwiseOr(o.bitwiseAnd(e,I),T));this.$1.writeByte(a),n++,e=o.signedRightShift(e,E)}return n},n.readVarint64=function(){for(var e=L,t=L,n;;){var o;if(n=(o=r("jsbi")).BigInt(this.$1.readByte()),e=o.bitwiseOr(e,o.leftShift(o.bitwiseAnd(n,I),t)),t=o.add(t,E),r("jsbi").equal(r("jsbi").bitwiseAnd(n,T),L)){if(r("jsbi").equal(t,k)&&r("jsbi").notEqual(n,R))throw new Error("result exceeded 64 bit limit");break}if(r("jsbi").greaterThan(t,S))throw new Error("result exceeded 64 bit limit")}return e},n.readString=function(){return o("Utf8ToString").Utf8ToString(this.readBinary())},n.getLastFieldId=function(){return this.$3},n.getLastField=function(){return this.$2},n.getBooleanFieldInfo=function(){return this.$4},n.getBooleanValue=function(){return this.$5},n.$9=function(t){return d[t]},n.$10=function(n){switch(n){case u.CT_STOP:return(e||(e=r("ThriftTypes"))).STOP;case u.CT_BOOLEAN_FALSE:case u.CT_BOOLEAN_TRUE:return(e||(e=r("ThriftTypes"))).BOOL;case u.CT_BYTE:return(e||(e=r("ThriftTypes"))).BYTE;case u.CT_I16:return(e||(e=r("ThriftTypes"))).I16;case u.CT_I32:return(e||(e=r("ThriftTypes"))).I32;case u.CT_I64:return(e||(e=r("ThriftTypes"))).I64;case u.CT_DOUBLE:return(e||(e=r("ThriftTypes"))).DOUBLE;case u.CT_FLOAT:return(e||(e=r("ThriftTypes"))).FLOAT;case u.CT_BINARY:return(e||(e=r("ThriftTypes"))).STRING;case u.CT_LIST:return(e||(e=r("ThriftTypes"))).LIST;case u.CT_SET:return(e||(e=r("ThriftTypes"))).SET;case u.CT_MAP:return(e||(e=r("ThriftTypes"))).MAP;case u.CT_STRUCT:return(e||(e=r("ThriftTypes"))).STRUCT;default:throw new Error("don't know what type")}},t})();l.default=x}),98); __d("TNoOpWriteBuffer",[],(function(t,n,r,o,a,i){var e=(function(){function e(){this.$1=0}var t=e.prototype;return t.write=function(t){return this.$1+=t.length,t.length},t.writeByte=function(t){return this.$1++,1},t.writeFloatBE=function(t){return this.$1+=Float32Array.BYTES_PER_ELEMENT,Float32Array.BYTES_PER_ELEMENT},t.writeDoubleBE=function(t){return this.$1+=Float64Array.BYTES_PER_ELEMENT,Float64Array.BYTES_PER_ELEMENT},t.toByteArray=function(){throw new Error("operation not supported")},t.currentSize=function(){return this.$1},t.readByte=function(){throw new Error("operation not supported")},t.readBytes=function(t){throw new Error("operation not supported")},t.readFloatBE=function(){throw new Error("operation not supported")},t.readDoubleBE=function(){throw new Error("operation not supported")},e})();i.default=e}),66); __d("TReadBuffer",[],(function(t,n,r,o,a,i){var e=(function(){function e(e){this.$1=e,this.$2=0}var t=e.prototype;return t.readByte=function(){if(this.$2this.$1.length)throw new Error("not enough bytes to read");var e=new Uint8Array(this.$1.buffer,this.$3(),t);return this.$2+=t,e},t.readFloatBE=function(){if(Float32Array.BYTES_PER_ELEMENT+this.$2>this.$1.length)throw new Error("not enough bytes to read");var e=new DataView(this.$1.buffer).getFloat32(this.$3());return this.$2+=Float32Array.BYTES_PER_ELEMENT,e},t.readDoubleBE=function(){if(Float64Array.BYTES_PER_ELEMENT+this.$2>this.$1.length)throw new Error("not enough bytes to read");var e=new DataView(this.$1.buffer).getFloat64(this.$3());return this.$2+=Float64Array.BYTES_PER_ELEMENT,e},t.$3=function(){return this.$2+this.$1.byteOffset},t.getCurrentCursor=function(){return this.$2},t.writeByte=function(t){throw new Error("operation not supported")},t.write=function(t){throw new Error("operation not supported")},t.toByteArray=function(){throw new Error("operation not supported")},t.writeFloatBE=function(t){throw new Error("operation not supported")},t.writeDoubleBE=function(t){throw new Error("operation not supported")},e})();i.default=e}),66); __d("CompactSerializerPolyfill",["TCompactProtocolPolyfill","TNoOpWriteBuffer","TReadBuffer","TWriteBuffer","getErrorSafe"],(function(t,n,r,o,a,i,l){"use strict";function e(e,t){var n=new(r("TReadBuffer"))(e),o=new(r("TCompactProtocolPolyfill"))(n);return t(o)}function s(t,n,o){try{return e(t,n)}catch(e){o!=null&&o(r("getErrorSafe")(e))}return null}function u(e,t,n){n===void 0&&(n=!1);var o;if(n){var a=new(r("TNoOpWriteBuffer")),i=new(r("TCompactProtocolPolyfill"))(a);t(e,i),o=new(r("TWriteBuffer"))(a.currentSize())}else o=new(r("TWriteBuffer"));var l=new(r("TCompactProtocolPolyfill"))(o);return t(e,l),l.toByteArray()}function c(e,t,n,o){n===void 0&&(n=!1);try{return u(e,t,n)}catch(e){o!=null&&o(r("getErrorSafe")(e))}return null}l.deserialize=e,l.deserializeNoThrow=s,l.serialize=u,l.serializeNoThrow=c}),98); __d("ContextualConfigConstants",[],(function(t,n,r,o,a,i){"use strict";var e=1e3,l=", ",s={SAME:"same",NULL:"null",NNULL:"nnull",CATCH_ALL:"catch_all",EQ:"eq",NEQ:"neq",LT:"lt",LTE:"lte",GT:"gt",GTE:"gte",COR:"cor",CONTAINS:"contains",REGEX:"regex",IN:"in",NIN:"nin"},u={DENSE:"dense",MULTI_OUTPUT_RESOLVED:"multi-output-resolved",TABLE:"table"},c=[],d=[],m=[],p={BAD_BOOLEAN_FORMAT:"Bad boolean format",BAD_CONFIG:"Bad config",BAD_CONTEXT_IDENTIFIER:"Bad context identifier",BAD_CONTEXT_VALUE:"Bad context value",BAD_MONITORED_CONTEXTS:"Bad monitored contexts",BAD_NUMBER_FORMAT:"Bad number format",BAD_OUTPUT_NAME:"Bad output name",BAD_OUTPUT_TYPE:"Bad output type",BAD_VALUE_ORDER:"Bad values order",DUPLICATE_OUTPUT_NAME:"Duplicate output name",ILLEGAL_BOOLEAN_STRATEGY:"Illegal boolean strategy",ILLEGAL_BUCKET_VALUES:"Illegal bucket values",ILLEGAL_NUMERIC_STRATEGY:"Illegal numeric strategy",ILLEGAL_STRING_STRATEGY:"Illegal string strategy",INVALID_BOOLEAN:"Invalid boolean",INVALID_FLOAT:"Invalid float",INVALID_INTEGER:"Invalid integer",INVALID_STRING:"Invalid string",INVALID_VALUE_TYPE:"Invalid value type",MISMATCH_NUMBER_OF_VALUES:"Mismatching number of values",MISSING_BUCKETS:"Missing buckets",MISSING_BUCKET_MATCH:"Missing bucket match",MISSING_BUCKET_NAME:"Missing bucket name",MISSING_BUCKET_STRATEGY:"Missing bucket strategy",MISSING_CONTEXT_IN_CONFIG:"Missing context in config",MISSING_DEFAULT_VALUE:"Missing default value",MISSING_OUTPUTS_DEFINITION:"Missing outputs field definition",MISSING_RESULTS:"Missing results",MISSING_TABLE:"Missing table",MISSING_TABLE_ITEM_BUCKET:"Missing table item bucket",MISSING_TABLE_ITEM_VALUES:"Missing table item values",MISSING_VECTOR:"Missing vector",REGEX_SYNTAX_ERROR:"Regex syntax error",REQUESTED_PARAM_NOT_FOUND:"Requested param not found",RESULTS_VECTOR_SIZE_MISMATCH:"Results vector size mismatch",UNDECLARED_OUTPUT_PARAM:"Undeclared output param",UNKNOWN_BUCKET_DEFINITION:"Unknown bucket definition",UNKNOWN_CONFIG_TYPE:"Unknown config type",UNSUPPORTED_CONFIG_VERSION:"Unsupported config version"},_=10,f=", ",g={BOOL:"BOOL",FLOAT:"FLOAT",INT:"INT",STRING:"STRING"};i.ANALYTICS_SAMPLE_RATE=e,i.BUCKET_DELIMITER=l,i.CONTEXT_BUCKET_STRATEGY=s,i.CONFIG_TYPE=u,i.EMPTY_RESOLVED_CONTEXTS=c,i.EMPTY_RESOLVED_MONITORS=d,i.EMPTY_RESULT_PARAMS=m,i.ERROR=p,i.JSON_SUB_SAMPLE_RATE=_,i.LIST_DELIMITER=f,i.TYPE=g}),66); __d("ContextualConfigResolvedContextsUtils",[],(function(t,n,r,o,a,i){"use strict";var e=function(t){var e=[];for(var n of t){var r=n.bucketIndex;if(r==null)break;e.push(r)}return e},l=function(t){var e=[];for(var n of t){var r=n.bucketName;if(r===void 0)break;e.push(r)}return e},s=function(t){return t.name},u=function(t){return t.map(s)},c=function(t){var e=[];for(var n of t){var r=n.value;if(r===void 0)break;e.push(r)}return e};i.getBucketIndices=e,i.getBucketNames=l,i.getContextNames=u,i.getContextValues=c}),66); __d("ContextualConfigCollateExposureData",["ContextualConfigConstants","ContextualConfigResolvedContextsUtils"],(function(t,n,r,o,a,i,l){"use strict";var e=["cfg_ver_timestamp","policy_id","version","sample_rate"],s=function(t){return t.join(o("ContextualConfigConstants").LIST_DELIMITER)},u=function(n,r){for(var t of e)r[t]!=null&&(n[t]=r[t]);r.name&&(n.config_name=r.name)},c=function(t,n){var e=n[0],r=n[1],a=n[2],i=n[3];e!=null&&(t.exception=e.message),t.result=s(r.map(function(e){return e.value}))||"INVALID",t.context=s(o("ContextualConfigResolvedContextsUtils").getContextNames(a)),t.context_value=s(o("ContextualConfigResolvedContextsUtils").getContextValues(a)),t.bucket_name=s(o("ContextualConfigResolvedContextsUtils").getBucketNames(a)),t.monitor=s(o("ContextualConfigResolvedContextsUtils").getContextNames(i)),t.monitor_value=s(o("ContextualConfigResolvedContextsUtils").getContextValues(i))};function d(e,t,n){var r={sample_rate:o("ContextualConfigConstants").ANALYTICS_SAMPLE_RATE};return u(r,e),c(r,t),n&&(r.config_contents=JSON.stringify(e)),r}l.default=d}),98); __d("ContextualConfigExposureEvent",["Random"],(function(t,n,r,o,a,i,l){"use strict";var e=(function(){function e(e,t,n){this.$2=e,this.$4=o("Random").random()<1/e.sample_rate,this.$3=t,this.$1=n}var t=e.prototype;return t.getData=function(){return this.$2},t.log=function(t){var e=this.$2,n=this.$3,r=this.$4;return t&&n(e),r&&this.$1(e),this},t.isSampled=function(){return this.$4},e})();l.default=e}),98); __d("ContextualConfigExposureLoggerFactory",["ContextualConfigExposureEvent"],(function(t,n,r,o,a,i,l){"use strict";var e=(function(){function e(e,t){this.$2=e,this.$1=t}var t=e.prototype;return t.createEvent=function(t){var e=new(r("ContextualConfigExposureEvent"))(t,this.$2,this.$1);return e},e})();function s(t,n){return new e(t,n)}l.default=s}),98); __d("MarauderLogger",["Banzai","CacheStorage","MarauderConfig"],(function(t,n,r,o,a,i){var e="client_event",l="navigation",s=18e4,u="marauder",c="marauder_last_event_time",d="marauder_last_session_id",m={},p=[],_=!1,f=null,g=null,h=null,y=0,C,b,v=!1,S=null;function R(){P().set(c,L())}n("Banzai").subscribe(n("Banzai").SHUTDOWN,R);function L(){return C=C||P().get(c)||0,C}function E(){v||(b=P().get(d),v=!0);var e=Date.now();return(!b||e-s>L())&&(b=e.toString(16)+"-"+(~~(Math.random()*16777215)).toString(16),P().set(d,b)),b}function k(){var e;return{user_agent:window.navigator.userAgent,screen_height:window.screen.availHeight,screen_width:window.screen.availWidth,density:(e=window.screen.devicePixelRatio)!=null?e:null,platform:window.navigator.platform||null,locale:window.navigator.language||null}}function I(){return{locale:navigator.language}}function T(e,t,n,r,o,a,i){var l=i!=null&&i!=0?i:Date.now();C=i!=null&&i!=0?Date.now():l;var s=t!=null&&t!=""?t:f;return{name:e,time:l/1e3,module:s,obj_type:r,obj_id:o,uuid:a,extra:n}}function D(e,t,n){return T("content",null,{flags:t},null,null,e,n)}function x(e){var t=window.__mrdr;if(t)for(var n in t){var r=t[n];if(r[3]!==0){if(delete t[n],n==="1")if(h!==null)n=h;else continue;e.push(D(n,1,r[1])),e.push(D(n,2,r[2])),e.push(D(n,3,r[3]))}}}function $(t,r){if(x(t),t.length!==0){_&&t.push(T("counters",null,m));var o=n("Banzai").BASIC;r==="vital"&&(o=n("Banzai").VITAL);var a=n("MarauderConfig").gk_enabled;if(y===0&&a&&(t.push(T("device_status",null,I())),o={delay:5e3}),r==="signal"&&(o={signal:!0}),a&&Math.random()<.01&&t.push(T("device_info",null,k())),h!==null)for(var i=0;i0},p=function(t){return typeof t=="number"&&!isNaN(t)&&t!==1/0&&t!==-1/0},_=function(t){return typeof t=="string"},f=function(t){switch(t){case o("ContextualConfigConstants").TYPE.BOOL:case o("ContextualConfigConstants").TYPE.FLOAT:case o("ContextualConfigConstants").TYPE.INT:case o("ContextualConfigConstants").TYPE.STRING:return!0;default:return!1}};l.isArray=e,l.isBoolean=s,l.isDefined=u,l.isKey=c,l.isInteger=d,l.isNonEmptyString=m,l.isNumber=p,l.isString=_,l.isType=f}),98); __d("ContextualConfigParseBoolean",["ContextualConfigConstants"],(function(t,n,r,o,a,i,l){"use strict";function e(e){switch(e.toUpperCase()){case"TRUE":return!0;case"FALSE":return!1;default:throw new Error(o("ContextualConfigConstants").ERROR.BAD_BOOLEAN_FORMAT)}}l.default=e}),98); __d("ContextualConfigParsePredBoolean",["ContextualConfigConstants","ContextualConfigParseBoolean"],(function(t,n,r,o,a,i,l){"use strict";function e(e,t){var n;switch(t){case o("ContextualConfigConstants").CONTEXT_BUCKET_STRATEGY.SAME:var a=r("ContextualConfigParseBoolean")(e);n=function(t){return t===a};break;case o("ContextualConfigConstants").CONTEXT_BUCKET_STRATEGY.NULL:n=function(t){return t==null};break;case o("ContextualConfigConstants").CONTEXT_BUCKET_STRATEGY.NNULL:n=function(t){return t!=null};break;case o("ContextualConfigConstants").CONTEXT_BUCKET_STRATEGY.CATCH_ALL:n=function(t){return!0};break;default:throw new Error(o("ContextualConfigConstants").ERROR.ILLEGAL_BOOLEAN_STRATEGY)}return function(e){return n(e)}}l.default=e}),98); __d("ContextualConfigParseFloat",["ContextualConfigAssert","ContextualConfigConstants","ContextualConfigValidators"],(function(t,n,r,o,a,i,l){"use strict";var e,s=/^[-\+]?([1-9]\d*|0)(\.\d+)?$/,u=function(t){return s.test(t)};function c(t){(e||(e=r("ContextualConfigAssert")))(u(t),o("ContextualConfigConstants").ERROR.BAD_NUMBER_FORMAT);var n=parseFloat(t);return e(o("ContextualConfigValidators").isNumber(n),o("ContextualConfigConstants").ERROR.BAD_NUMBER_FORMAT),n}l.default=c}),98); __d("ContextualConfigParseInteger",["ContextualConfigAssert","ContextualConfigConstants","ContextualConfigValidators"],(function(t,n,r,o,a,i,l){"use strict";var e,s=/^[-\+]?([1-9]\d*|0)$/,u=function(t){return s.test(t)};function c(t){(e||(e=r("ContextualConfigAssert")))(u(t),o("ContextualConfigConstants").ERROR.BAD_NUMBER_FORMAT);var n=parseInt(t,10);return e(o("ContextualConfigValidators").isNumber(n),o("ContextualConfigConstants").ERROR.BAD_NUMBER_FORMAT),n}l.default=c}),98); __d("ContextualConfigPredAssertions",["ContextualConfigAssert","ContextualConfigConstants"],(function(t,n,r,o,a,i,l){"use strict";var e,s=function(n){return(e||(e=r("ContextualConfigAssert")))(n>0,o("ContextualConfigConstants").ERROR.MISMATCH_NUMBER_OF_VALUES)},u=function(n,a){return(e||(e=r("ContextualConfigAssert")))(n===a,o("ContextualConfigConstants").ERROR.MISMATCH_NUMBER_OF_VALUES)},c=function(n,a){return(e||(e=r("ContextualConfigAssert")))(n=l[0]&&tl[0]};break;case o("ContextualConfigConstants").CONTEXT_BUCKET_STRATEGY.GTE:o("ContextualConfigPredAssertions").assertNumberOfValues(l.length,1),s=function(t){return typeof t!="number"||i&&!o("ContextualConfigValidators").isInteger(t)?!1:t>=l[0]};break;default:throw new Error(o("ContextualConfigConstants").ERROR.ILLEGAL_NUMERIC_STRATEGY)}return function(e){return s(e)}}l.default=s}),98); __d("ContextualConfigParseRegExp",["ContextualConfigConstants"],(function(t,n,r,o,a,i,l){"use strict";var e=/^\/(.+)\/(.*)$/;function s(t){try{var n=t.match(e);return n!=null?new RegExp(n[1],n[2]):new RegExp(t)}catch(e){throw new Error(o("ContextualConfigConstants").ERROR.REGEX_SYNTAX_ERROR)}}l.default=s}),98); __d("ContextualConfigParsePredString",["ContextualConfigConstants","ContextualConfigParseRegExp","ContextualConfigPredAssertions"],(function(t,n,r,o,a,i,l){"use strict";var e=function(t){if(typeof t!="string")throw new Error(o("ContextualConfigConstants").ERROR.INVALID_VALUE_TYPE);return t},s=function(n){var t=[];for(var r of n)t.push(e(r));return t};function u(e,t,n){var a=s(n),i;switch(t){case o("ContextualConfigConstants").CONTEXT_BUCKET_STRATEGY.SAME:i=function(n){return typeof n!="string"?!1:n===e};break;case o("ContextualConfigConstants").CONTEXT_BUCKET_STRATEGY.NULL:i=function(t){return t==null};break;case o("ContextualConfigConstants").CONTEXT_BUCKET_STRATEGY.NNULL:i=function(t){return t!=null};break;case o("ContextualConfigConstants").CONTEXT_BUCKET_STRATEGY.CATCH_ALL:i=function(t){return!0};break;case o("ContextualConfigConstants").CONTEXT_BUCKET_STRATEGY.IN:o("ContextualConfigPredAssertions").assertHasValues(a.length),i=function(t){return typeof t!="string"?!1:a.indexOf(t)!==-1};break;case o("ContextualConfigConstants").CONTEXT_BUCKET_STRATEGY.NIN:o("ContextualConfigPredAssertions").assertHasValues(a.length),i=function(t){return typeof t!="string"?!1:a.indexOf(t)===-1};break;case o("ContextualConfigConstants").CONTEXT_BUCKET_STRATEGY.CONTAINS:o("ContextualConfigPredAssertions").assertNumberOfValues(a.length,1),i=function(t){return typeof t!="string"?!1:t.indexOf(a[0])!==-1};break;case o("ContextualConfigConstants").CONTEXT_BUCKET_STRATEGY.REGEX:o("ContextualConfigPredAssertions").assertNumberOfValues(a.length,1);var l=r("ContextualConfigParseRegExp")(a[0]);i=function(t){return typeof t!="string"?!1:l.test(t)};break;default:throw new Error(o("ContextualConfigConstants").ERROR.ILLEGAL_STRING_STRATEGY)}return function(e){return i(e)}}l.default=u}),98); __d("ContextualConfigParseContextBuckets",["ContextualConfigAssert","ContextualConfigConstants","ContextualConfigParsePredBoolean","ContextualConfigParsePredNumeric","ContextualConfigParsePredString","ContextualConfigValidators"],(function(t,n,r,o,a,i,l){"use strict";var e,s=function(n){return(e||(e=r("ContextualConfigAssert")))(o("ContextualConfigValidators").isDefined(n),o("ContextualConfigConstants").ERROR.MISSING_BUCKETS)},u=function(n){return(e||(e=r("ContextualConfigAssert")))(o("ContextualConfigValidators").isArray(n),o("ContextualConfigConstants").ERROR.MISSING_BUCKETS)},c=o("ContextualConfigValidators").isKey(o("ContextualConfigConstants").CONTEXT_BUCKET_STRATEGY),d=function(n){return(e||(e=r("ContextualConfigAssert")))(o("ContextualConfigValidators").isString(n)&&c(n.toUpperCase()),o("ContextualConfigConstants").ERROR.MISSING_BUCKET_STRATEGY)},m=function(n){return(e||(e=r("ContextualConfigAssert")))(o("ContextualConfigValidators").isArray(n),o("ContextualConfigConstants").ERROR.ILLEGAL_BUCKET_VALUES)},p=function(n){return(e||(e=r("ContextualConfigAssert")))(o("ContextualConfigValidators").isNonEmptyString(n),o("ContextualConfigConstants").ERROR.MISSING_BUCKET_NAME)},_=function(t,n){var e=n.name;p(e);var a=n.strategy;d(a);var i=n.values||[];switch(m(i),t){case o("ContextualConfigConstants").TYPE.BOOL:return r("ContextualConfigParsePredBoolean")(e,a);case o("ContextualConfigConstants").TYPE.FLOAT:return r("ContextualConfigParsePredNumeric")(e,a,i,!1);case o("ContextualConfigConstants").TYPE.INT:return r("ContextualConfigParsePredNumeric")(e,a,i,!0);case o("ContextualConfigConstants").TYPE.STRING:return r("ContextualConfigParsePredString")(e,a,i);default:throw new Error(o("ContextualConfigConstants").ERROR.UNKNOWN_BUCKET_DEFINITION)}},f=function(t,n){s(n);var e=n.name;return p(e),{name:e,pred:_(t,n)}};function g(e,t){return u(t),t.map(function(t){return f(e,t)})}l.default=g}),98); __d("ContextualConfigParseContexts",["ContextualConfigAssert","ContextualConfigConstants","ContextualConfigParseContextBuckets","ContextualConfigValidators"],(function(t,n,r,o,a,i,l){"use strict";var e,s=function(n){return(e||(e=r("ContextualConfigAssert")))(o("ContextualConfigValidators").isDefined(n),o("ContextualConfigConstants").ERROR.BAD_CONTEXT_IDENTIFIER)},u=function(n){return(e||(e=r("ContextualConfigAssert")))(o("ContextualConfigValidators").isArray(n)&&n.length>0,o("ContextualConfigConstants").ERROR.MISSING_CONTEXT_IN_CONFIG)},c=function(n){return(e||(e=r("ContextualConfigAssert")))(o("ContextualConfigValidators").isNonEmptyString(n),o("ContextualConfigConstants").ERROR.BAD_CONTEXT_IDENTIFIER)},d=function(n){return(e||(e=r("ContextualConfigAssert")))(o("ContextualConfigValidators").isType(n),o("ContextualConfigConstants").ERROR.BAD_CONTEXT_IDENTIFIER)},m=function(t){s(t);var e=t.buckets,n=t.name,o=t.type;return c(n),d(o),{name:n,type:o,buckets:r("ContextualConfigParseContextBuckets")(o,e)}};function p(e){return u(e),e.map(m)}l.default=p}),98); __d("ContextualConfigIsEqualParams",[],(function(t,n,r,o,a,i){"use strict";function e(e,t){if(e.length!==t.length)return!1;for(var n=0;n=0;r-=1)e.push(n),n*=t[r].buckets.length;return e.reverse()},c=function(t,n,o,a){try{var e=n.slice(o,o+t.length);return[null,r("ContextualConfigParseDenseResultParams")(t,e)]}catch(e){return[r("getErrorSafe")(e),a]}},d=function(n,o,a){try{var t=a.reduce(function(t,o,a){return(e||(e=r("ContextualConfigAssert")))(a=e&&this.$12(n)}},t.$7=function(){var e=this.$4;e!=null&&this.size>=e&&this.$12(this.$2)},t.$12=function(t){var e=t.getHeadKey();if(e!=null){var n=t.get(e);n&&this.delete(n.markerId,n.instanceKey)}},t.$10=function(t,n){return t+":"+n},t.$11=function(t){var e=this.$3.get(t);return e||(e=new(r("DoublyLinkedListMap")),this.$3.set(t,e)),e},e})();l.default=e}),98); __d("QPLTimestamp",[],(function(t,n,r,o,a,i){"use strict";function e(e){if(e===0)return"0";var t=e.toFixed(6).split(".",2),n=t[0],r=t[1];return n==="0"?r.replace(/^0+/,""):n+r}function l(t,n){var r=n-t;return e(r)}i.timestampToSerializedNanoseconds=e,i.calculateDurationAsNanoseconds=l}),66); __d("crc32",[],(function(t,n,r,o,a,i){function e(e){for(var t=-1,n=0,r=e.length;n>>8^l[(t^e.charCodeAt(n))&255];return~t}var l=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];t.Int32Array!==void 0&&(l=new Int32Array(l)),i.default=e}),66); __d("QPLUtils",["crc32"],(function(t,n,r,o,a,i,l){"use strict";function e(e){return r("crc32")(e)>>>0}function s(t){return t!=null?e(t):0}l.unsignedCrc32=e,l.deriveInstanceKey=s}),98); __d("QuickPerformanceLoggerTypes",[],(function(t,n,r,o,a,i){"use strict";var e=1,l=3;i.EVENT_BASED_SAMPLING=e,i.USER_BASED_SAMPLING=l}),66); __d("QPLCore",["QPLCoreHelpers","QPLEvent","QPLMarkerMap","QPLTimestamp","QPLUtils","QuickPerformanceLoggerTypes","uuidv4"],(function(t,n,r,o,a,i,l){"use strict";var e;function s(e){if(e==null)return e;var t={};for(var n in e)t[n]=String(e[n]);return t}function u(e){if(e==null)return e;var t={};for(var n in e)t[n]=e[n].map(String);return t}function c(e,t,n,r){var o,a=t[e];if(!a||Object.entries(a).length===0)return null;var i={};return Object.keys(a).forEach(function(e){var t=a[e];t==null||t.length===0?delete a[e]:r?i[e]=r(t):i[e]=t}),o={},o[e]=babelHelpers.extends({},n&&n[e],i),o}function d(e,t){if(e==null)return t;var n=babelHelpers.extends({},t,c("string",e,t),c("int",e,t,Math.trunc),c("double",e,t),c("bool",e,t),c("string_array",e,t),c("int_array",e,t,function(e){return e.map(Math.trunc)}),c("double_array",e,t),c("bool_array",e,t));return Object.keys(n).forEach(function(e){var t=n[e];(t==null||Object.entries(t).length===0)&&delete n[e]}),Object.entries(n).length!==0?n:null}function m(e,t){var n={};g.isMarkerTracked(t)&&(n.tracked_for_loss=!0),typeof t.absoluteTimeOrigin=="number"&&(n.absolute_time_origin_ns=o("QPLTimestamp").timestampToSerializedNanoseconds(t.absoluteTimeOrigin));var r=babelHelpers.extends({},e,n);return r}function p(e,t){if(!t)return e;var n={};return t.string&&(n.annotations=t.string),t.int&&(n.annotations_int=s(t.int)),t.double&&(n.annotations_double=t.double),t.bool&&(n.annotations_bool=t.bool),t.string_array&&(n.annotations_string_array=t.string_array),t.int_array&&(n.annotations_int_array=u(t.int_array)),t.double_array&&(n.annotations_double_array=t.double_array),t.bool_array&&(n.annotations_bool_array=t.bool_array),babelHelpers.extends({},e,n)}var _=new Map([[o("QuickPerformanceLoggerTypes").EVENT_BASED_SAMPLING,"random_sampling"],[o("QuickPerformanceLoggerTypes").USER_BASED_SAMPLING,"per_user"]]);function f(e,t){return e===0?!1:e<=1?!0:typeof t=="string"?o("QPLUtils").unsignedCrc32(t)%e===0:Math.random()*e<=1}var g=(function(){function t(e){var t;this.$2=1,this.$3=100,this.$4=new Map,this.$5=new Map,this.$6=null,this.$8=new Map,this.activeMarkers=new Map,this.$1=e,this.$7=e.logger,this.$5=(t=e.listenersWithMarker)!=null?t:new Map,this.$9=new(r("QPLMarkerMap"))}var n=t.prototype;return n.$10=function(t,n){try{return n()}catch(e){this.$1.onError&&this.$1.onError(t,e)}},n.getMarker=function(n,r){var t=this;return this.$10("getMarker",function(){var a=t.$11((e||(e=o("QPLEvent"))).getMarkerId(n));if(!a)return null;var i=a.get(r);return i||null})},n.isMarkerOn=function(n,r){var t,a=this;return r===void 0&&(r=0),(t=this.$10("isMarkerOn",function(){var t=a.$11((e||(e=o("QPLEvent"))).getMarkerId(n));if(!t)return!1;var i=t.get(r);return!!i}))!=null?t:!1},t.isMarkerTracked=function(t){return t.trackedForLoss===!0||t.type===2},n.$11=function(t){return this.activeMarkers.get(t)},n.addMarker=function(t,n,r){var e=this.activeMarkers.get(t);e||(e=new Map,this.activeMarkers.set(t,e)),e.set(n,r)},n.deleteMarker=function(t,n){var e;(e=this.activeMarkers.get(t))==null||e.delete(n),this.$12(t,n)},n.markerStart=function(r,a,i,l){var n=this;a===void 0&&(a=0),i===void 0&&(i=this.currentTimestamp());var s=l===void 0?{}:l,u=s.cancelExisting,c=u===void 0?!1:u,d=s.cancelOnUnload,m=d===void 0?!1:d,p=s.trackedForLoss,_=p===void 0?!1:p,f=s.type,g=f===void 0?1:f,h=s.samplingBasis,y=h===void 0?null:h,C=s.qplInternalDoNotUseAbsoluteTimeOrigin,b=s.timeoutMS,v=b===void 0?null:b,S=s.onMarkerTimeout__DoNotUse,R=S===void 0?null:S,L=s.enableE2ETracing,E=L===void 0?!1:L,k=s.crashResilient,I=k===void 0?!1:k;this.$10("markerStart",function(){var l=n.getMarker(r,a);if(l){var s=Math.round(i-l.timestamp);c&&(n.markerAnnotate(r,{string:{cancelType:"DUPLICATE_EVENT"},int:{time_between_markers_ms:s}},{instanceKey:a}),n.markerEnd(r,4,a,i))}var u=n.$13(r,y),d=u[0],p=u[1],f=u[2],h=null;E&&(h=n.$1.e2eTracingIDGenerator?n.$1.e2eTracingIDGenerator(r):null);var b={event:r,passesSampling:d,timestamp:i,sampleRate:p,samplingMethod:f,points:[],cancelOnUnload:m,trackedForLoss:_,type:g,timeoutMS:v,e2eTracingID:h,isCrashResilient:I};if(typeof C=="number"&&(b.absoluteTimeOrigin=C),n.$4.forEach(function(e){e.onMarkerStart&&e.onMarkerStart(r,a,i)}),n.$5.forEach(function(e){e.onMarkerStartWithMarker(r,a,i,b)}),d&&(n.addMarker((e||(e=o("QPLEvent"))).getMarkerId(r),a,b),v!=null&&n.$14(r,a,v,R)),d&&t.isMarkerTracked(b)&&n.$15({marker_id:27787271,action_id:51,sample_rate:1,annotations_int:{tracked_marker_id:String((e||(e=o("QPLEvent"))).getMarkerId(r))},marker_type:1}),h!==null){var S;n.markerAnnotate(r,{string:(S={},S.qpl_e2e__tracing_id=h,S)},{instanceKey:a})}d&&n.$4.forEach(function(e){e.onMarkerStarted&&e.onMarkerStarted(r,a,i,n.$16(b))})})},n.$16=function(t){if(t==null){var e={isCrashResilient:!1};return e}return{isCrashResilient:t.isCrashResilient}},n.$17=function(t,n){this.$9.delete(t,n)},n.$18=function(t,n,r){this.$9.set(t,n,r)},n.$12=function(t,n){var e,r=this.$9.get(t,n);r&&(e=this.$1.runtimeAbstractionLayer)!=null&&e.clearTimeout&&(this.$1.runtimeAbstractionLayer.clearTimeout(r),this.$17(t,n))},n.$14=function(n,r,a,i){var t=this,l=(e||(e=o("QPLEvent"))).getMarkerId(n);try{var s,u;if(this.$12(l,r),!((s=this.$1.runtimeAbstractionLayer)!=null&&s.setTimeout))return;var c=(u=this.$1.runtimeAbstractionLayer)==null?void 0:u.setTimeout(function(){i!=null&&i(n,r),t.$4.forEach(function(e){e.onTimeoutEvent!=null&&e.onTimeoutEvent({event:n,instanceKey:r,passesSampling:!0})}),t.$17(l,r),t.markerEnd(n,113,r)},a);this.$18(l,r,c)}catch(e){}},n.markerAnnotate=function(t,n,r){var e=this,o=r===void 0?{}:r,a=o.instanceKey,i=a===void 0?0:a;this.$10("markerAnnotate",function(){e.$4.forEach(function(e){Object.keys(n).forEach(function(r){var o=n[r];o&&Object.keys(o).forEach(function(n){e.onAnnotation&&e.onAnnotation(t,i,n,o[n],r)})})});var r=e.getMarker(t,i);r&&(r.annotations=d(n,r.annotations))})},n.markerPoint=function(t,n,r){var e=this,o=r===void 0?{}:r,a=o.instanceKey,i=a===void 0?0:a,l=o.data,s=o.timestamp,u=s===void 0?this.currentTimestamp():s;this.$10("markerPoint",function(){e.$4.forEach(function(e){e.onMarkerPoint&&e.onMarkerPoint(t,i,n,l,u)});var r=e.getMarker(t,i);if(r){var o={name:n,timeSinceStart:Math.trunc(u-r.timestamp)},a=d(l);a&&(o.data=a),r.points.push(o)}})},n.markerEnd=function(n,r,a,i){var t=this;a===void 0&&(a=0),i===void 0&&(i=this.currentTimestamp()),this.$10("markerEnd",function(){var l=t.getMarker(n,a);if(!l){t.$4.forEach(function(e){var o={durationMs:0,passesSampling:!1};e.onMarkerEnd&&e.onMarkerEnd(r,n,a,i,babelHelpers.extends({},o,t.$16(l)))});return}var c=r,d=t.$19(l,l.timestamp,i);d&&r===2&&(c=5947);var f=l.points.map(function(e){return e.data?{name:e.name,timeSinceStart:String(e.timeSinceStart),data:(function(t,n,r,o,a,i,l,c){var d={};if(((t=e.data)==null?void 0:t.string)!=null&&(d.string=e.data.string),((n=e.data)==null?void 0:n.string_array)!=null&&(d.string_array=e.data.string_array),((r=e.data)==null?void 0:r.int)!=null){var m;d.int=s((m=e.data)==null?void 0:m.int)}if(((o=e.data)==null?void 0:o.int_array)!=null){var p;d.int_array=u((p=e.data)==null?void 0:p.int_array)}return((a=e.data)==null?void 0:a.double)!=null&&(d.double=e.data.double),((i=e.data)==null?void 0:i.double_array)!=null&&(d.double_array=e.data.double_array),((l=e.data)==null?void 0:l.bool)!=null&&(d.bool=e.data.bool),((c=e.data)==null?void 0:c.bool_array)!=null&&(d.bool_array=e.data.bool_array),d})()}:{name:e.name,timeSinceStart:String(e.timeSinceStart)}}),g={marker_id:(e||(e=o("QPLEvent"))).getMarkerId(n),action_id:c,instance_id:a,sample_rate:l.sampleRate,method:_.get(l.samplingMethod),duration_ns:o("QPLTimestamp").calculateDurationAsNanoseconds(l.timestamp,i),points:f,metadata:{application_analytics:{time_since_qpl_module_init:i-t.$1.moduleLoadTimestamp}},marker_type:l.type,flags:1,unique_marker_id_debug_only:l.uniqueMarkerDebugId},h=p(g,l.annotations),y=m(h,l);t.$4.forEach(function(e){var t={durationMs:l?i-l.timestamp:0,logData:y,passesSampling:l.passesSampling,isCrashResilient:l.isCrashResilient};e.onMarkerEnd&&e.onMarkerEnd(c,n,a,i,t)}),l.passesSampling&&(l.timestampIsApproximate!==!0&&t.$15(y),t.$6===(e||(e=o("QPLEvent"))).getMarkerId(n)&&t.$1.onDebuggingIdEnded&&t.$1.onDebuggingIdEnded()),t.deleteMarker(e.getMarkerId(n),a)})},n.markerDrop=function(n,r){var t=this;r===void 0&&(r=0),this.$10("markerDrop",function(){var a=t.getMarker(n,r);t.deleteMarker((e||(e=o("QPLEvent"))).getMarkerId(n),r);var i=t.currentTimestamp();t.$4.forEach(function(e){if(e.onMarkerDrop){var o;e.onMarkerDrop(n,r,i,babelHelpers.extends({passesSampling:(o=a==null?void 0:a.passesSampling)!=null?o:!1},t.$16(a)))}})})},n.markEvent=function(n,r,a,i){var t=this,l=i===void 0?{}:i,s=l.timestamp,u=s===void 0?this.currentTimestamp():s,c=l.annotations;this.$10("markEvent",function(){var i;if(t.$4.forEach(function(e){e.onMarkEvent&&e.onMarkEvent({event:n,timestamp:u,annotations:c})}),!((i=t.$1.quickLogConfigHelper)!=null&&i.isKillswitchOn())){var l=t.$13(n),s=l[0],m=l[1],f=l[2];if(s){var g=d(typeof c=="function"?c():c),h={marker_id:(e||(e=o("QPLEvent"))).getMarkerId(n),action_id:51,instance_id:0,sample_rate:m,method:_.get(f),da_type:r,da_level:a,metadata:{application_analytics:{time_since_qpl_module_init:u-t.$1.moduleLoadTimestamp}},marker_type:1,flags:1};t.$15(p(h,g))}}})},n.markerStartForJoin=function(t,n,r){var e=this,a=r===void 0?{}:r,i=a.instanceKey,l=i===void 0?0:i,s=a.cancelExisting,u=s===void 0?!1:s,c=a.cancelOnUnload,d=c===void 0?!1:c,m=a.trackedForLoss,p=m===void 0?!1:m,_=a.type,f=_===void 0?1:_,g=a.qplInternalDoNotUseAbsoluteTimeOrigin,h=g===void 0?null:g,y=a.timeoutMS,C=y===void 0?null:y,b=a.monotonicTimestamp,v=b===void 0?this.currentTimestamp():b,S=a.absoluteTimeOriginMs,R=S===void 0?this.currentUnixTimestamp():S,L=a.sourceIsPrimary,E=L===void 0?!1:L,k=a.closeSession,I=a.onMarkerTimeout__DoNotUse,T=a.unreliableSourceClockProcessId,D=a.crashResilient,x=a.joinNamespaces,$=a.actionPriority;this.$10("markerStartForJoin",function(){e.markerStart(t,l,v,{cancelExisting:u,cancelOnUnload:d,trackedForLoss:p,type:f,samplingBasis:n,qplInternalDoNotUseAbsoluteTimeOrigin:h,timeoutMS:C,onMarkerTimeout__DoNotUse:I,crashResilient:D});var r=o("QPLCoreHelpers").generateJoinAnnotations(n,R,E,k,T,x,$);e.markerAnnotate(t,r,{instanceKey:l})})},n.addAlignmentPointForJoin=function(t,n,r){var e=this,a=r===void 0?{}:r,i=a.instanceKey,l=i===void 0?0:i,s=a.requestId,u=s===void 0?"default_id":s,c=a.timestamp,d=c===void 0?this.currentTimestamp():c;this.$10("addAlignmentPointForJoin",function(){var r=o("QPLCoreHelpers").getAlignmentPointName(n,u);r!=null&&e.markerPoint(t,r,{instanceKey:l,timestamp:d})})},n.setAlwaysOnSampleRate=function(t,n){this.$8.set(t,n)},n.setDefaultSampleRate=function(t){this.$3=t},n.currentTimestamp=function(){var e,t=this;return(e=this.$10("currentTimestamp",function(){return t.$1.monotonicNowMs()}))!=null?e:0},n.currentUnixTimestamp=function(){var e,t=this;return(e=this.$10("currentUnixTimestamp",function(){return t.$1.unixNowMs()}))!=null?e:0},n.enableDebug=function(t){this.$6=t},n.disableDebug=function(){this.$6=null},n.addListener=function(t){var e,n=this;return(e=this.$10("addListener",function(){var e=n.$2++;return n.$4.set(e,t),{dispose:function(){n.$4.delete(e)}}}))!=null?e:{dispose:function(){}}},n.$13=function(n,r){var t,a;if(this.$1.unsampleAllEvents&&this.$1.unsampleAllEvents()||this.$6===(e||(e=o("QPLEvent"))).getMarkerId(n))return[!0,1,o("QuickPerformanceLoggerTypes").EVENT_BASED_SAMPLING];var i=(e||(e=o("QPLEvent"))).getSampleRate(n),l=e.getSamplingMethod(n);if(this.$8.get(n)==null&&i!==0&&l===o("QuickPerformanceLoggerTypes").USER_BASED_SAMPLING)return[!0,i!=null?i:1,o("QuickPerformanceLoggerTypes").USER_BASED_SAMPLING];var s=(t=(a=this.$8.get(n))!=null?a:i)!=null?t:this.$3,u=l!=null?l:o("QuickPerformanceLoggerTypes").EVENT_BASED_SAMPLING,c=f(s,r);return[c,s,u]},n.$15=function(t){this.$4.forEach(function(e){e.onUploadEvent&&e.onUploadEvent(t)});var e=this.$1.decorateEventBeforeUpload?this.$1.decorateEventBeforeUpload(t):t;this.$1.sendEvent(t,e)},n.$19=function(t,n,r){if(t.timeoutMS==null)return!1;var e=r-n;return e>=t.timeoutMS},n.getActiveMarkerIds=function(t){var e,n=this,r=t.type;return(e=this.$10("getActiveMarkerIds",function(){var e=new Set;return n.activeMarkers.forEach(function(t,n){t.forEach(function(t){if(t.type===r){e.add(n);return}})}),Array.from(e)}))!=null?e:[]},n.getActiveE2ETraceIds=function(){var e,t=this;return(e=this.$10("getActiveE2ETraceIds",function(){var e=new Map;return t.activeMarkers.forEach(function(t,n){var r=new Map;t.forEach(function(e,t){e.e2eTracingID!=null&&r.set(t,{e2eTraceID:e.e2eTracingID,qplEvent:e.event})}),r.size>0&&e.set(n,r)}),e}))!=null?e:new Map},n.getActiveE2ETraceIdsAsArray=function(){var e,t=this;return(e=this.$10("getActiveE2ETraceIdsAsArray",function(){var e=[];return t.activeMarkers.forEach(function(t,n){t.forEach(function(t,n){t.e2eTracingID!=null&&e.push(t.e2eTracingID)})}),e}))!=null?e:[]},n.forEachMarkerInstance=function(t,n){var e=this;this.$10("forEachMarkerInstance",function(){var r=e.$11(t);if(r)for(var o of r.entries()){var a=o[0],i=o[1];n(a,i.event)}})},n.getMarkerStartTs=function(t,n){var e=this,r=n===void 0?{}:n,o=r.instanceKey,a=o===void 0?0:o;return this.$10("getMarkerStartTs",function(){var n=e.getMarker(t,a);if(n)return n.timestamp})},n.markerLogDebugPoints=function(n,a){var t=this,i=a===void 0?{}:a,l=i.instanceKey,s=l===void 0?0:l;this.$10("markerLogDebugPoints",function(){var a=(e||(e=o("QPLEvent"))).getMarkerId(n),i=t.getMarker(n,s);if(i){var l=r("uuidv4")();i.uniqueMarkerDebugId=l}})},t})();g.normalizeAnnotations=d,l.default=g}),98); __d("QPLInspector",[],(function(t,n,r,o,a,i){var e=(function(){function e(){this.$1=[],this.$2={}}var t=e.prototype;return t.appendLog=function(t){for(var e in this.$2)!Object.prototype.hasOwnProperty.call(this.$2,e)||t.marker_id!==e||this.$2[t.marker_id].forEach(function(e){return e(t)});this.$1.push(t)},t.dumpLogs=function(){return this.$1},t.addListener=function(t,n){Object.prototype.hasOwnProperty.call(this.$2,t)||(this.$2[t]=[]),this.$2[t].push(n),this.$1.forEach(function(e){e.marker_id===t&&n(e)})},t.removeListener=function(t,n){var e=this.$2[t].indexOf(n);e!==-1&&this.$2[t].splice(e,1)},e})(),l=new e;i.default=l}),66); __d("QuickPerformanceLogger",["Arbiter","Env","FBLogger","ODS","PerfFalcoEvent","PerfXSharedFields","Promise","QPLCore","QPLEvent","QPLInspector","Run","WebStorage","clearTimeout","cr:12180","cr:1984081","cr:686","getErrorSafe","gkx","guid","performanceAbsoluteNow","performanceNavigationStart","performanceNow","setTimeout"],(function(t,n,r,o,a,i,l){"use strict";var e,s,u,c,d,m,p,_,f=typeof window!="undefined"?window:self;function g(t,n){r("FBLogger")("qpl").catching(r("getErrorSafe")(n)).MUSTFIX(e||(e=babelHelpers.taggedTemplateLiteralLoose(["QPL error in ",""])),t)}function h(e){var t=r("PerfXSharedFields").getCommonData(),n={memory_stats:{total_mem:t.ram_gb!=null?t.ram_gb*1073741824:null},network_stats:{downlink_megabits:t.downlink_megabits,network_subtype:t.effective_connection_type,rtt_ms:t.rtt_ms},sitedata_info:{client_push_phase:t.client_push_phase,client_revision:t.client_revision,server_revision:t.server_revision},locale_info:{locale:t.locale,isRTL:t.isRTL}};if(r("gkx")("20836")&&(n.workplace_info={is_gemini:r("gkx")("21050")}),r("gkx")("21051")&&typeof f.__sapienzMetadataCallback__=="function"){var o=f.__sapienzMetadataCallback__();n.sapienz={request_id:String(o.requestId),config_name:String(o.configName)}}return babelHelpers.extends({},e,{metadata:babelHelpers.extends({},e.metadata,n)})}function y(e,t,n){return{i:e,m:n,r:t}}function C(e,t){return new(_||(_=n("Promise")))(function(){var n=t||e;typeof f.__je2e_recordQPLMarker=="function"&&f.__je2e_recordQPLMarker(n),(p||(p=r("Env"))).enable_qplinspector===!0&&r("QPLInspector").appendLog(n),r("gkx")("21053")||r("gkx")("20935")||r("gkx")("5679")?r("PerfFalcoEvent").logImmediately(function(){return n}):r("gkx")("2160")||r("gkx")("21055")||r("gkx")("1624")?r("PerfFalcoEvent").logCritical(function(){return n}):r("PerfFalcoEvent").log(function(){return n})})}function b(e){var t=(s||(s=o("QPLEvent"))).getMarkerId(e),n=t+"_"+r("guid")();return(m||(m=o("ODS"))).bumpEntityKey(2401,"obc.www.all","qpl.e2e_tracing_id_generated."+t),n}function v(e){var t=babelHelpers.extends({},e,{config_type:r("gkx")("21056")?"alpha_beta":"prod"});return h(t)}function S(){return(p||(p=r("Env"))).enable_qplinspector===!0||typeof f.__je2e_recordQPLMarker=="function"||r("gkx")("21057")}function R(){r("Arbiter").inform("qpl_debugger_finished")}var L=(u||(u=r("performanceAbsoluteNow")))();typeof f.__je2e_felabsTracePlugin_setQplInit=="function"&&f.__je2e_felabsTracePlugin_setQplInit((c||(c=r("performanceNow")))());var E={debug:function(t,n,r){},warn:function(t){r("FBLogger")("qpl").blameToPreviousDirectory().warn(t)}},k="qpl",I=(function(e){function t(){var t;t=e.call(this,{decorateEventBeforeUpload:v,unsampleAllEvents:S,onDebuggingIdEnded:R,monotonicNowMs:u||(u=r("performanceAbsoluteNow")),unixNowMs:u||(u=r("performanceAbsoluteNow")),moduleLoadTimestamp:L,logger:E,sendEvent:C,e2eTracingIDGenerator:b,runtimeAbstractionLayer:{setTimeout:r("setTimeout"),clearTimeout:r("clearTimeout")},debugLoggingEnabled:(p||(p=r("Env"))).qpl_debug_logging,onError:g})||this;var n=r("gkx")("21055")?r("gkx")("21058")?function(e){return o("Run").onBeforeUnload(e,!1)}:o("Run").onBeforeUnload:o("Run").onUnload;return n(function(){t.$QuickPerformanceLogger$p_1(),t.$QuickPerformanceLogger$p_2(706,{respectUnloadPolicy:!0,timestamp:t.currentTimestamp()})}),t.$QuickPerformanceLogger$p_3(),t.initQplFlipperPlugin(),t.initQplSapienzPlugin(),t.initQplUserTimingPlugin(),t}babelHelpers.inheritsLoose(t,e);var a=t.prototype;return a.$QuickPerformanceLogger$p_3=function(){var e=this,t=(d||(d=r("WebStorage"))).getSessionStorageForRead();if(!t){this.$QuickPerformanceLogger$p_4("#loadSavedState","sessionStorage is not available");return}var n=t.getItem(k);if(n!=null){t.removeItem(k);var o=JSON.parse(n);if(o==null){this.$QuickPerformanceLogger$p_4("#loadSavedState","Saved state failed to deserialize");return}if(o.markers==null||o.markers.length===0){this.$QuickPerformanceLogger$p_4("#loadSavedState","No saved markers found");return}o.markers.forEach(function(t){var n=t[0],r=t[1],o=t[2];e.addMarker(n,r,o),e.$QuickPerformanceLogger$p_4("#loadSavedState","Marker "+n+" (instanceKey: "+r+") resumed")})}},a.$QuickPerformanceLogger$p_1=function(){var e=this,t=[];if(this.activeMarkers.forEach(function(e,n){e.forEach(function(e,r){e.resumeAfterNavigation===!0&&(delete e.resumeAfterNavigation,t.push([n,r,e]))})}),t.length>0){var n={markers:t},o=(d||(d=r("WebStorage"))).getSessionStorage(),a=d.setItemGuarded(o,k,JSON.stringify(n));a&&(t.forEach(function(t){var n=t[0],r=t[1],o=t[2],a=y(n,o.sampleRate,o.samplingMethod);e.markerEnd(a,96,r)}),this.$QuickPerformanceLogger$p_4("#storeSavedState","Failed to store saved state: "+a.message),r("FBLogger")("qpl").catching(a).warn("Failed to store QPL state: "+JSON.stringify(n,null,2))),t.forEach(function(t){var n=t[0],r=t[1];e.deleteMarker(n,r)})}},a.markerStoreBeforeNavigation=function(t,n){var e=n===void 0?{}:n,r=e.instanceKey,a=r===void 0?0:r,i=(s||(s=o("QPLEvent"))).getMarkerId(t),l=this.getMarker(t,a);if(!l){this.$QuickPerformanceLogger$p_4("markerStoreBeforeNavigation","Failed to set marker to store on page unload. Could not find marker "+i+", instancekey="+a);return}l.resumeAfterNavigation=!0,this.$QuickPerformanceLogger$p_4("markerStoreBeforeNavigation","Set marker "+i+" to store on page unload, instancekey="+a)},a.markerStartFromNavStart=function(t,n,o){n===void 0&&(n=0);var e=o===void 0?{}:o,a=e.cancelExisting,i=a===void 0?!1:a,l=e.cancelOnUnload,s=l===void 0?!1:l,u=e.trackedForLoss,c=u===void 0?!1:u,d=e.type,m=d===void 0?1:d,p=e.qplInternalDoNotUseConvertToTimeOnServer,_=e.onMarkerTimeout__DoNotUse,f=e.timeoutMS,g=f===void 0?null:f,h=e.crashResilient,y=h===void 0?!1:h,C=r("performanceNavigationStart")(),b=typeof p=="function"?p(C):void 0;if(this.markerStart(t,n,C,{cancelExisting:i,cancelOnUnload:s,trackedForLoss:c,type:m,qplInternalDoNotUseAbsoluteTimeOrigin:b,onMarkerTimeout__DoNotUse:_,timeoutMS:g,crashResilient:y}),r("performanceNavigationStart").isPolyfilled===!0){var v=this.getMarker(t,n);v&&(v.timestampIsApproximate=!0)}},a.markerStartForJoinFromNavStart=function(t,n,o){var e=o===void 0?{}:o,a=e.instanceKey,i=a===void 0?0:a,l=e.cancelExisting,s=l===void 0?!1:l,u=e.cancelOnUnload,c=u===void 0?!1:u,d=e.trackedForLoss,m=d===void 0?!1:d,p=e.type,_=p===void 0?1:p,f=e.qplInternalDoNotUseConvertToTimeOnServer,g=e.absoluteTimeOriginMs,h=e.sourceIsPrimary,y=h===void 0?!1:h,C=e.closeSession,b=e.unreliableSourceClockProcessId,v=e.onMarkerTimeout__DoNotUse,S=e.timeoutMS,R=e.crashResilient,L=R===void 0?!1:R,E=r("performanceNavigationStart")(),k=typeof f=="function"?f(E):void 0;if(this.markerStartForJoin(t,n,{instanceKey:i,cancelExisting:s,cancelOnUnload:c,trackedForLoss:m,type:_,qplInternalDoNotUseAbsoluteTimeOrigin:k,monotonicTimestamp:E,absoluteTimeOriginMs:g,sourceIsPrimary:y,closeSession:C,unreliableSourceClockProcessId:b,timeoutMS:S,onMarkerTimeout__DoNotUse:v,crashResilient:L}),r("performanceNavigationStart").isPolyfilled===!0){var I=this.getMarker(t,i);I&&(I.timestampIsApproximate=!0)}},a.$QuickPerformanceLogger$p_2=function(t,n){var e=this,r=n===void 0?{}:n,o=r.respectUnloadPolicy,a=r.timestamp;this.activeMarkers.forEach(function(n,r){n.forEach(function(n,i){if(o!==!0||n.cancelOnUnload===!0){var l=y(r,n.sampleRate,n.samplingMethod);e.markerEnd(l,t,i,a)}})})},a.$QuickPerformanceLogger$p_4=function(t,n,r){E.debug(t,n,r)},a.initQplFlipperPlugin=function(){n("cr:686")!=null&&this.addListener(n("cr:686").qplFlipperPlugin.listener())},a.initQplSapienzPlugin=function(){n("cr:1984081")!=null&&this.addListener(n("cr:1984081").getQplSapienzListener())},a.initQplUserTimingPlugin=function(){n("cr:12180")!=null&&this.addListener(n("cr:12180").getQplUserTimingListener())},t})(r("QPLCore")),T=new I;i.exports=T}),34); __d("qpl",["FBLogger","QPLHasteSupportDataStorage"],(function(t,n,r,o,a,i,l){"use strict";var e={},s={_:function(n,o){var t=e[o];if(t==null){var a=r("QPLHasteSupportDataStorage").get(o);a==null?(r("FBLogger")("staticresources").mustfix("Failed to find a Haste-supplied config for the QPL event identified by token `%s`.",o),t={i:n}):t=babelHelpers.extends({i:n},a),e[o]=t}return t}},u=s;l.default=u}),98); __d("DGWLoggingContext",["DGWGlobalLogger","DgwClientFalcoEvent","IDGWLoggingContext","NetworkStatus","ODS","QuickPerformanceLogger","Random","qpl"],(function(t,n,r,o,a,i,l){"use strict";var e,s,u="dgw_client",c=r("qpl")._(701242292,"2919"),d=r("qpl")._(701238781,"3037"),m={VERBOSE:-1,INFO:0,WARNING:1,ERROR:2,FATAL:3};function p(e){switch(e){case o("IDGWLoggingContext").DGWLoggingComponent.GROUPED_STREAM_COMPONENT:case o("IDGWLoggingContext").DGWLoggingComponent.ACK_MANAGER_COMPONENT:return!0;default:return!1}}var _=(function(){function t(e,t,n,r,o,a,i){a===void 0&&(a=!1),i===void 0&&(i=!1),this.$5=""+e,this.$1=t,this.$4=n,this.$3=r,this.sgTransportId=o,this.$2=a,this.$6=i}var n=t.prototype;return n.getGlobalLogger=function(){return o("DGWGlobalLogger").getInstance()},t.bumpODSKey=function(t,n,r){if(r===void 0&&(r=1),!!o("Random").coinflip(r)){var e=t+"."+n;(s||(s=o("ODS"))).bumpEntityKey(3589,"dgw_web_client",e,r)}},n.bumpODSKey=function(t,n,r){if(r===void 0&&(r=1),!!o("Random").coinflip(r)){var e=this.$4+"."+t+"."+n;(s||(s=o("ODS"))).bumpEntityKey(3589,"dgw_web_client",e,r)}},n.logEvent=function(t,n,r,o,a){o===void 0&&(o=!1),this.$2||this.$7(t,n,null,m.INFO,r,o,a)},n.$7=function(t,n,o,a,i,l,s){var e=this;l===void 0&&(l=!1),!(l&&!this.$6)&&(p(t)&&this.$1!=null||!p(t)&&this.sgTransportId!=null)&&r("DgwClientFalcoEvent").log(function(){return{event:n,logging_id:s!=null?s:e.$1,dgw_version:e.$5,message:o,severity:a,uuid:e.$3,dgw_component:t,extra_info:i,destination_tier:e.$4,sg_transport_id:e.sgTransportId,source:2}})},n.logError=function(t,n,o,a,i,l,s){if(i===void 0&&(i=!1),s===void 0&&(s=!1),!this.$2){var e=a;if(s){var u="onLine:"+String(r("NetworkStatus").isOnline());e=a!=null&&a!==""?a+", "+u:u}this.$7(t,n,o,m.ERROR,e,i,l)}},n.logWarn=function(t,n,r,o,a){a===void 0&&(a=!1),this.$2||this.$7(t,n,r,m.WARNING,o,a)},n.$8=function(t){switch(t){case o("IDGWLoggingContext").QPLEvent.STREAM_LIFECYCLE:return c;case o("IDGWLoggingContext").QPLEvent.STREAM_GROUP_TRANSPORT:return d}},n.qplMarkerStart=function(n,o){(e||(e=r("QuickPerformanceLogger"))).markerStart(this.$8(n),o)},n.qplMarkerEnd=function(n,a,i){var t=a===o("IDGWLoggingContext").QPLResult.SUCCESS?2:3;(e||(e=r("QuickPerformanceLogger"))).markerEnd(this.$8(n),t,i)},n.qplMarkerPoint=function(n,o,a){(e||(e=r("QuickPerformanceLogger"))).markerPoint(this.$8(n),o,{instanceKey:a})},n.qplMarkerAnnotate=function(n,o,a){(e||(e=r("QuickPerformanceLogger"))).markerAnnotate(this.$8(n),o,{instanceKey:a})},t})();l.DGWLoggingComponent=o("IDGWLoggingContext").DGWLoggingComponent,l.QPLEvent=o("IDGWLoggingContext").QPLEvent,l.QPLResult=o("IDGWLoggingContext").QPLResult,l.DGW_MODULE=u,l.DGWLoggingContext=_}),98); __d("DGWStream",["$InternalEnum"],(function(t,n,r,o,a,i){"use strict";var e=n("$InternalEnum").Mirrored(["ABNORMAL_CLOSURE","GOING_AWAY","SERVER_INTERNAL_ERROR","PREMATURE_CLOSE","UNKNOWN_ERROR","KEEPALIVE_TIMEOUT","TRANSPORT_CLOSED_BEFORE_STREAM_INIT","TRANSPORT_ESTABLISHMENT_ERROR","TRANSPORT_ESTABLISHMENT_TIMEOUT","ESTABLISHMENT_TIMEOUT","UNAUTHENTICATED","UNAUTHORIZED","REJECTED","BAD_REQUEST","DGW_SERVER_ERROR","ESTABLISHMENT_ERROR","ACK_TIMEOUT"]);function l(t){switch(t){case e.UNAUTHENTICATED:case e.UNAUTHORIZED:case e.REJECTED:case e.BAD_REQUEST:case e.UNKNOWN_ERROR:case e.SERVER_INTERNAL_ERROR:return!1;default:return!0}}i.StreamError=e,i.isRetryableError=l}),66); __d("DGWCppBridge",[],(function(t,n,r,o,a,i){var e=(function(){var e=typeof document!="undefined"&&document.currentScript?document.currentScript.src:void 0;return(function(t){t=t||{};var t=typeof t!="undefined"?t:{},n=(function(){function e(){}function t(e,t){return function(){e.apply(t,arguments)}}function n(e){if(!(this instanceof n))throw new TypeError("Promises must be constructed via new");if(typeof e!="function")throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],s(e,this)}function r(e,t){for(;e._state===3;)e=e._value;if(e._state===0){e._deferreds.push(t);return}e._handled=!0,n._immediateFn(function(){var n=e._state===1?t.onFulfilled:t.onRejected;if(n===null){(e._state===1?o:a)(t.promise,e._value);return}var r;try{r=n(e._value)}catch(e){a(t.promise,e);return}o(t.promise,r)})}function o(e,r){try{if(r===e)throw new TypeError("A promise cannot be resolved with itself.");if(r&&(typeof r=="object"||typeof r=="function")){var o=r.then;if(r instanceof n){e._state=3,e._value=r,i(e);return}else if(typeof o=="function"){s(t(o,r),e);return}}e._state=1,e._value=r,i(e)}catch(t){a(e,t)}}function a(e,t){e._state=2,e._value=t,i(e)}function i(e){e._state===2&&e._deferreds.length===0&&n._immediateFn(function(){e._handled||n._unhandledRejectionFn(e._value)});for(var t=0,o=e._deferreds.length;t=0;--o)r[48+o]=52+o,r[65+o]=o,r[97+o]=26+o;r[43]=62,r[47]=63;function a(e,t,n){for(var o,a,i=0,l=t,s=n.length,u=t+(s*3>>2)-(n[s-2]=="=")-(n[s-1]=="=");i>4,l>2),l>2]=e,s[m+68>>2]=t,s[m+64>>2]=n,s[m+60>>2]=r,s[m+56>>2]=o,s[m+52>>2]=i;e:{if(!s[m+52>>2]||!s[m+56>>2]|(!s[m+72>>2]|!s[m+68>>2]|(!s[m+64>>2]|!s[m+60>>2]))){s[m+76>>2]=5;break e}s[s[m+64>>2]>>2]=0,s[s[m+60>>2]>>2]=0,t=s[m+68>>2],n=s[m+56>>2],r=s[m+52>>2],e=T+-64|0,T=e,s[e+56>>2]=s[m+72>>2],s[e+52>>2]=t,s[e+48>>2]=n,s[e+44>>2]=r,s[e+40>>2]=0,s[e+36>>2]=s[e+56>>2];t:{n:{r:{for(;;){if(!s[e+52>>2])break n;if(s[e+32>>2]=s[e+36>>2],a[e+31|0]=u[s[e+36>>2]],s[e+52>>2]=s[e+52>>2]-1,s[e+36>>2]=s[e+36>>2]+1,u[e+31|0]==10||u[e+31|0]==2|u[e+31|0]==4|u[e+31|0]==9){s[e+40>>2]=s[e+40>>2]+1;continue}if(s[e+24>>2]=1,J(u[e+31|0])&1){if(p=e,f=ee(u[e+31|0])&1,a[p+23|0]=f,s[e+16>>2]=a[e+23|0]&1?1:2,d[e+52>>2]>2]){s[s[e+48>>2]>>2]=s[e+32>>2],s[s[e+44>>2]>>2]=s[e+52>>2]+s[e+24>>2];break t}if(s[e+52>>2]=s[e+52>>2]-s[e+16>>2],s[e+24>>2]=s[e+16>>2]+s[e+24>>2],s[e+36>>2]=s[e+16>>2]+s[e+36>>2],!(u[e+31|0]!=14&&u[e+31|0]!=8)){s[e+40>>2]=s[e+40>>2]+1;continue}}if(d[e+52>>2]<3)break r;if(s[e+12>>2]=0,t=s[e+36>>2],n=u[t|0]|u[t+1|0]<<8,a[e+12|0]=n,a[e+13|0]=n>>>8,a[e+14|0]=u[t+2|0],s[e+52>>2]=s[e+52>>2]-3,s[e+24>>2]=s[e+24>>2]+3,s[e+36>>2]=s[e+36>>2]+3,d[e+12>>2]<=d[e+52>>2]){s[e+40>>2]=s[e+40>>2]+1,s[e+36>>2]=s[e+12>>2]+s[e+36>>2],s[e+52>>2]=s[e+52>>2]-s[e+12>>2];continue}break}s[s[e+48>>2]>>2]=s[e+32>>2],s[s[e+44>>2]>>2]=s[e+52>>2]+s[e+24>>2];break t}s[s[e+48>>2]>>2]=s[e+32>>2],s[s[e+44>>2]>>2]=s[e+52>>2]+s[e+24>>2];break t}s[s[e+44>>2]>>2]=s[e+52>>2]}if(s[e+60>>2]=s[e+40>>2],T=e- -64|0,s[m+48>>2]=s[e+60>>2],!s[m+48>>2]){s[m+76>>2]=0;break e}if(p=m,f=$(_(s[m+48>>2],20)),s[p+44>>2]=f,!s[m+44>>2]){s[m+76>>2]=3;break e}for(s[m+40>>2]=s[m+44>>2],s[m+36>>2]=s[m+72>>2],s[m+32>>2]=s[m+68>>2]-s[s[m+52>>2]>>2],s[m+28>>2]=0;;){if(d[m+28>>2]>2]){if(d[m+32>>2]<1){V(s[m+44>>2],s[m+28>>2]),s[m+76>>2]=1;break e}a[m+27|0]=u[s[m+36>>2]],s[m+36>>2]=s[m+36>>2]+1,s[m+32>>2]=s[m+32>>2]-1;t:{if(!u[m+27|0]|u[m+27|0]==1|(u[m+27|0]==2|u[m+27|0]==3)|(u[m+27|0]==4|u[m+27|0]==9|u[m+27|0]==10)||J(u[m+27|0])&1)break t;V(s[m+44>>2],s[m+28>>2]),s[m+76>>2]=6;break e}e=s[m+40>>2],s[e>>2]=u[m+27|0]&15|s[e>>2]&-16;t:{if(u[m+27|0]==10||u[m+27|0]==2|u[m+27|0]==4|u[m+27|0]==9){e=s[m+40>>2],s[e>>2]=s[e>>2]&-268435441,s[m+40>>2]=s[m+40>>2]+20;break t}if(J(u[m+27|0])&1){e=T-48|0,T=e,s[e+40>>2]=s[m+40>>2],s[e+36>>2]=m+36,s[e+32>>2]=m+32;n:{if(!(J(s[s[e+40>>2]>>2]&15)&1)){s[e+44>>2]=1;break n}if(p=e,f=ee(s[s[e+40>>2]>>2]&15)&1,a[p+31|0]=f,s[e+24>>2]=a[e+31|0]&1?1:2,d[s[e+32>>2]>>2]>2]){s[e+44>>2]=1;break n}if(ae(s[e+40>>2]+4|0,s[s[e+36>>2]>>2],s[e+24>>2]),t=s[e+36>>2],s[t>>2]=s[e+24>>2]+s[t>>2],t=s[e+32>>2],s[t>>2]=s[t>>2]-s[e+24>>2],(s[s[e+40>>2]>>2]&15)==8){t=s[e+40>>2],s[t>>2]=s[t>>2]&-268435441,s[e+44>>2]=0;break n}if((s[s[e+40>>2]>>2]&15)==14){t=s[e+40>>2],s[t>>2]=s[t>>2]&-268435441,s[e+44>>2]=0;break n}if(d[s[e+32>>2]>>2]<3){s[e+44>>2]=11;break n}if(s[e+20>>2]=0,t=s[s[e+36>>2]>>2],n=u[t|0]|u[t+1|0]<<8,a[e+20|0]=n,a[e+21|0]=n>>>8,a[e+22|0]=u[t+2|0],t=s[e+36>>2],s[t>>2]=s[t>>2]+3,t=s[e+32>>2],s[t>>2]=s[t>>2]-3,t=s[e+40>>2],s[t>>2]=s[t>>2]&-268435441|(s[e+20>>2]&16777215)<<4,d[s[e+32>>2]>>2]>2]){s[e+44>>2]=11;break n}if((s[s[e+40>>2]>>2]&15)==15){if(s[s[e+40>>2]+12>>2]=s[e+20>>2],t=$(s[e+20>>2]),s[s[e+40>>2]+8>>2]=t,!s[s[e+40>>2]+8>>2]){s[e+44>>2]=3;break n}ae(s[s[e+40>>2]+8>>2],s[s[e+36>>2]>>2],s[e+20>>2]),t=s[e+36>>2],s[t>>2]=s[e+20>>2]+s[t>>2],t=s[e+32>>2],s[t>>2]=s[t>>2]-s[e+20>>2],s[e+44>>2]=0;break n}if((s[s[e+40>>2]>>2]&15)==5){if(s[s[e+40>>2]+12>>2]=s[e+20>>2],t=$(s[e+20>>2]),s[s[e+40>>2]+8>>2]=t,!s[s[e+40>>2]+8>>2]){s[e+44>>2]=3;break n}ae(s[s[e+40>>2]+8>>2],s[s[e+36>>2]>>2],s[e+20>>2]),t=s[e+36>>2],s[t>>2]=s[e+20>>2]+s[t>>2],t=s[e+32>>2],s[t>>2]=s[t>>2]-s[e+20>>2],s[e+44>>2]=0;break n}r:{if(!((s[s[e+40>>2]>>2]&15)!=6&&(s[s[e+40>>2]>>2]&15)!=7)){if(p=e,f=G(s[e+36>>2],s[e+32>>2],e+19|0,e+18|0),s[p+12>>2]=f,s[e+12>>2]){s[e+44>>2]=s[e+12>>2];break n}break r}if(!((s[s[e+40>>2]>>2]&15)!=13&&(s[s[e+40>>2]>>2]&15)!=12)){n=s[e+32>>2],t=T-32|0,s[t+24>>2]=s[e+36>>2],s[t+20>>2]=n,s[t+16>>2]=e+19,s[t+12>>2]=e+16,l[t+10>>1]=0;o:{if(d[s[t+20>>2]>>2]<2){s[t+28>>2]=1;break o}n=s[s[t+24>>2]>>2],n=u[n|0]|u[n+1|0]<<8,a[t+10|0]=n,a[t+11|0]=n>>>8,n=s[t+24>>2],s[n>>2]=s[n>>2]+2,n=s[t+20>>2],s[n>>2]=s[n>>2]-2,a[s[t+16>>2]]=(c[t+10>>1]&32768)==32768,l[s[t+12>>2]>>1]=c[t+10>>1]&32767,s[t+28>>2]=0}if(s[e+12>>2]=s[t+28>>2],s[e+12>>2]){s[e+44>>2]=s[e+12>>2];break n}}}if((s[s[e+40>>2]>>2]&15)==12){t=s[e+40>>2],l[t+8>>1]=l[t+8>>1]&1|c[e+16>>1]<<1,s[e+44>>2]=0;break n}if((s[s[e+40>>2]>>2]&15)==7){t=s[e+40>>2],a[t+8|0]=a[t+8|0]&1|u[e+18|0]<<1,s[e+44>>2]=0;break n}if((s[s[e+40>>2]>>2]&15)==13){n=s[e+32>>2],r=s[e+20>>2],o=s[e+40>>2]+12|0,i=s[e+40>>2],t=T-32|0,T=t,s[t+24>>2]=s[e+36>>2],s[t+20>>2]=n,s[t+16>>2]=r,s[t+12>>2]=o,s[t+8>>2]=i+16;r:{if(d[t+16>>2]<2){s[t+28>>2]=9;break r}if(s[s[t+8>>2]>>2]=s[t+16>>2]-2,d[s[t+20>>2]>>2]>2]>>2]){s[t+28>>2]=1;break r}if(n=$(s[s[t+8>>2]>>2]),s[s[t+12>>2]>>2]=n,!s[s[t+12>>2]>>2]){s[t+28>>2]=3;break r}ae(s[s[t+12>>2]>>2],s[s[t+24>>2]>>2],s[s[t+8>>2]>>2]),n=s[t+24>>2],s[n>>2]=s[s[t+8>>2]>>2]+s[n>>2],n=s[t+20>>2],s[n>>2]=s[n>>2]-s[s[t+8>>2]>>2],s[t+28>>2]=0}if(T=t+32|0,s[e+8>>2]=s[t+28>>2],s[e+8>>2]){s[e+44>>2]=s[e+8>>2];break n}t=s[e+40>>2],l[t+8>>1]=a[e+19|0]&1|c[t+8>>1]&65534,t=s[e+40>>2],l[t+8>>1]=l[t+8>>1]&1|c[e+16>>1]<<1,s[e+44>>2]=0;break n}if((s[s[e+40>>2]>>2]&15)==6){if(p=e,f=q(s[e+36>>2],s[e+32>>2],s[e+20>>2],s[e+40>>2]+12|0,s[e+40>>2]+16|0),s[p+4>>2]=f,s[e+4>>2]){s[e+44>>2]=s[e+4>>2];break n}t=s[e+40>>2],a[t+8|0]=a[e+19|0]&1|u[t+8|0]&254,t=s[e+40>>2],a[t+8|0]=a[t+8|0]&1|u[e+18|0]<<1,s[e+44>>2]=0;break n}s[e+44>>2]=1}if(T=e+48|0,s[m+20>>2]=s[e+44>>2],!s[m+20>>2]){s[m+40>>2]=s[m+40>>2]+20;break t}V(s[m+44>>2],s[m+28>>2]),s[m+76>>2]=s[m+20>>2];break e}if(s[m+16>>2]=0,d[m+32>>2]<3){V(s[m+44>>2],s[m+28>>2]),s[m+76>>2]=1;break e}if(e=s[m+36>>2],t=u[e|0]|u[e+1|0]<<8,a[m+16|0]=t,a[m+17|0]=t>>>8,a[m+18|0]=u[e+2|0],s[m+36>>2]=s[m+36>>2]+3,s[m+32>>2]=s[m+32>>2]-3,!(s[m+16>>2]==1|u[m+27|0]!=1)){V(s[m+44>>2],s[m+28>>2]),s[m+76>>2]=7;break e}if(e=s[m+40>>2],s[e>>2]=s[e>>2]&-268435441|(s[m+16>>2]&16777215)<<4,u[m+27|0]==3){if(s[m+16>>2]!=1){V(s[m+44>>2],s[m+28>>2]),s[m+76>>2]=10;break e}if(a[m+15|0]=0,d[m+32>>2]<1){O(s[m+44>>2]),s[m+76>>2]=1;break e}a[m+15|0]=u[s[m+36>>2]],s[m+36>>2]=s[m+36>>2]+1,s[m+32>>2]=s[m+32>>2]-1;n:{if(u[m+15|0]<=4){a[s[m+40>>2]+4|0]=u[m+15|0];break n}a[s[m+40>>2]+4|0]=4}s[m+40>>2]=s[m+40>>2]+20;break t}if(p=m,f=G(m+36|0,m+32|0,m+14|0,m+13|0),s[p+8>>2]=f,s[m+8>>2]){V(s[m+44>>2],s[m+28>>2]),s[m+76>>2]=s[m+8>>2];break e}if(u[m+27|0]==1){e=s[m+40>>2],a[e+4|0]=a[e+4|0]&1|u[m+13|0]<<1,s[m+40>>2]=s[m+40>>2]+20;break t}if(!u[m+27|0]){if(p=m,f=q(m+36|0,m+32|0,s[m+16>>2],s[m+40>>2]+8|0,s[m+40>>2]+12|0),s[p+4>>2]=f,s[m+4>>2]){V(s[m+44>>2],s[m+28>>2]),s[m+76>>2]=s[m+4>>2];break e}e=s[m+40>>2],a[e+4|0]=a[m+14|0]&1|u[e+4|0]&254,e=s[m+40>>2],a[e+4|0]=a[e+4|0]&1|u[m+13|0]<<1,s[m+40>>2]=s[m+40>>2]+20}}s[m+28>>2]=s[m+28>>2]+1;continue}break}if(s[m+32>>2]){V(s[m+44>>2],s[m+48>>2]),s[m+76>>2]=1;break e}s[s[m+64>>2]>>2]=s[m+44>>2],s[s[m+60>>2]>>2]=s[m+48>>2],s[m+76>>2]=0}return T=m+80|0,s[m+76>>2]}function $(e){var t=0,n=0,r=0,o=0,a=0,i=0,l=0,u=0,c=0,d=0,m=0;c=8;e:{t:{if(e>>>0>4294967239)break t;for(;;){c=c>>>0>8?c:8,n=s[603],a=n,o=s[602],l=o,e=e>>>0>8?e+3&-4:8;n:{if(e>>>0<=127){i=(e>>>3|0)-1|0;break n}if(r=h(e),i=((e>>>29-r^4)-(r<<2)|0)+110|0,e>>>0<=4095)break n;r=((e>>>30-r^2)-(r<<1)|0)+71|0,i=r>>>0<63?r:63}if(t=i,r=t&31,(t&63)>>>0>=32?(t=0,n=n>>>r|0):(t=n>>>r|0,n=((1<>>r),r=t,n|t){for(;;){a=n,t=r;n:{if(t|n){o=t-1|0,u=o+1|0,l=o,o=n-1|0,l=(o|0)!=-1?u:l,o=h(n^o)+32|0,n=h(t^l),n=(n|0)==32?o:n,t=63-n|0,D=0-(n>>>0>63)|0;break n}D=0,t=64}o=t,t=o,n=t&31,(t&63)>>>0>=32?(t=0,l=r>>>n|0):(t=r>>>n|0,l=((1<>>n),r=t,i=o+i|0,a=i<<4,t=s[a+1384>>2],o=a+1376|0;n:{if((t|0)!=(o|0)){if(n=F(t,c,e),n)break t;n=s[t+4>>2],s[n+8>>2]=s[t+8>>2],s[s[t+8>>2]+4>>2]=n,s[t+8>>2]=o,n=a+1380|0,s[t+4>>2]=s[n>>2],s[n>>2]=t,s[s[t+4>>2]+8>>2]=t,i=i+1|0,n=(r&1)<<31|l>>>1,r=r>>>1|0;break n}d=s[603],t=i,u=t&63,n=u,a=n&31,n>>>0>=32?(n=0,o=-1>>>a|0):(n=-1>>>a|0,o=(1<>>a),o=o&-2,a=u&31,u>>>0>=32?(n=o<>>32-a|n<>>0>=32?(n=-1<>>32-t|-1<>>0>=32?(o=0,t=n>>>t|0):(o=n>>>t|0,t=((1<>>t),n=t|u,D=a|o,s[602]=s[602]&n,s[603]=D&d,n=l^1}if(!(n|r))break}o=s[602],a=s[603]}n:{if(a|o){r=h(a),r=63-((r|0)==32?h(o)+32|0:r)<<4,t=r+1376|0,r=s[r+1384>>2];r:{if(!a&o>>>0<1073741824||(i=98,(t|0)==(r|0)))break r;for(;;){if(n=F(r,c,e),n)break t;if(r=s[r+8>>2],!i)break r;if(i=i-1|0,(t|0)==(r|0))break}}if(M(e+48|0))break n;if(!r|(t|0)==(r|0))break e;for(;;){if(n=F(r,c,e),n)break t;if(r=s[r+8>>2],(t|0)==(r|0))break}break e}if(!M(e+48|0))break e}if(n=0,e>>>0>4294967239)break t;for(r=c,t=0;;){if(i=t,r){r=r-1&r,t=t+1|0;continue}break}if(!(i>>>0<=1))break}}return n}return 0}function P(e,t,n,r,o,i,m){e=e|0,t=t|0,n=n|0,r=r|0,o=o|0,i=i|0,m=m|0;var p=0,_=0,f=0;p=T-32|0,T=p,l[p+26>>1]=e,s[p+20>>2]=t,s[p+16>>2]=n,a[p+15|0]=r,l[p+12>>1]=o,s[p+8>>2]=i,s[p+4>>2]=m;e:{if(!(!(a[p+15|0]&1)|c[p+12>>1]<=32767)){s[p+28>>2]=4;break e}t=s[p+20>>2],n=s[p+16>>2],r=s[p+8>>2],o=s[p+4>>2],i=a[p+15|0]&1,e=T+-64|0,T=e,s[e+56>>2]=p+26,s[e+52>>2]=t,s[e+48>>2]=n,s[e+44>>2]=r,s[e+40>>2]=o,a[e+39|0]=2,a[e+38|0]=13,s[e+32>>2]=p+12,a[e+31|0]=i,a[e+30|0]=2;t:{n:{if(!(!s[e+52>>2]|(!s[e+44>>2]|!s[e+40>>2]))&&d[e+48>>2]<=16777215)break n;s[e+60>>2]=5;break t}if(s[e+24>>2]=s[e+48>>2]+(u[e+39|0]+(u[e+30|0]+4|0)|0),_=e,f=$(s[e+24>>2]),s[_+20>>2]=f,!s[e+20>>2]){s[e+60>>2]=3;break t}if(s[e+16>>2]=s[e+20>>2],a[s[e+16>>2]]=u[e+38|0],s[e+16>>2]=s[e+16>>2]+1,ae(s[e+16>>2],s[e+56>>2],u[e+30|0]),s[e+16>>2]=u[e+30|0]+s[e+16>>2],s[e+12>>2]=u[e+39|0]+s[e+48>>2],d[e+12>>2]>2]){O(s[e+20>>2]),s[e+60>>2]=9;break t}if(t=s[e+16>>2],n=u[e+12|0]|u[e+13|0]<<8,a[t|0]=n,a[t+1|0]=n>>>8,a[t+2|0]=u[e+14|0],s[e+16>>2]=s[e+16>>2]+3,a[e+31|0]&1)n:{if(u[e+38|0]==6){t=s[e+32>>2],a[t|0]=u[t|0]|128;break n}r:{if(u[e+38|0]==13){t=s[e+32>>2],l[t>>1]=c[t>>1]|32768;break r}O(s[e+20>>2]),s[e+60>>2]=1;break t}}ae(s[e+16>>2],s[e+32>>2],u[e+39|0]),s[e+16>>2]=u[e+39|0]+s[e+16>>2],ae(s[e+16>>2],s[e+52>>2],s[e+48>>2]),s[s[e+44>>2]>>2]=s[e+20>>2],s[s[e+40>>2]>>2]=s[e+24>>2],s[e+60>>2]=0}T=e- -64|0,s[p+28>>2]=s[e+60>>2]}return T=p+32|0,s[p+28>>2]}function N(e,t,n,r,o){e=e|0,t=t|0,n=n|0,r=r|0,o=o|0;var i=0,c=0,m=0;i=T-32|0,T=i,l[i+30>>1]=e,s[i+24>>2]=t,s[i+20>>2]=n,s[i+16>>2]=r,s[i+12>>2]=o,t=s[i+24>>2],n=s[i+20>>2],r=s[i+16>>2],o=s[i+12>>2],e=T-48|0,T=e,s[e+40>>2]=i+30,s[e+36>>2]=t,s[e+32>>2]=n,s[e+28>>2]=r,s[e+24>>2]=o,a[e+23|0]=2,a[e+22|0]=15;e:{if(!(s[e+24>>2]&&s[e+28>>2])){s[e+44>>2]=5;break e}if(s[s[e+28>>2]>>2]=0,s[s[e+24>>2]>>2]=0,!(d[e+32>>2]<=16777215&&s[e+36>>2])){s[e+44>>2]=5;break e}if(s[e+16>>2]=s[e+32>>2]+(u[e+23|0]+4|0),c=e,m=$(s[e+16>>2]),s[c+12>>2]=m,!s[e+12>>2]){s[e+44>>2]=3;break e}s[e+8>>2]=s[e+12>>2],a[s[e+8>>2]]=u[e+22|0],s[e+8>>2]=s[e+8>>2]+1,ae(s[e+8>>2],s[e+40>>2],u[e+23|0]),s[e+8>>2]=u[e+23|0]+s[e+8>>2],t=s[e+8>>2],n=u[e+32|0]|u[e+33|0]<<8,a[t|0]=n,a[t+1|0]=n>>>8,a[t+2|0]=u[e+34|0],s[e+8>>2]=s[e+8>>2]+3,ae(s[e+8>>2],s[e+36>>2],s[e+32>>2]),s[e+8>>2]=s[e+32>>2]+s[e+8>>2],s[s[e+28>>2]>>2]=s[e+12>>2],s[s[e+24>>2]>>2]=s[e+16>>2],s[e+44>>2]=0}return T=e+48|0,T=i+32|0,s[e+44>>2]}function M(e){var t=0,n=0,r=0,o=0,i=0,l=0;r=s[343],n=e+3&-4,t=r+n|0;e:{t:{if(t>>>0<=r>>>0&&n||t>>>0>Re()<<16>>>0&&!(I(t|0)|0))break t;s[343]=t;break e}s[604]=48,r=-1}if((r|0)!=-1){n=e+r|0,t=n-16|0,s[t+12>>2]=16,s[t>>2]=16,e=s[600],e?l=s[e+8>>2]:l=0;e:{t:{if((l|0)==(r|0)){if(o=r-(s[r-4>>2]&-2)|0,i=s[o-4>>2],s[e+8>>2]=n,e=o-(i&-2)|0,n=-16,!(a[(e+s[e>>2]|0)-4|0]&1))break t;n=s[e+4>>2],s[n+8>>2]=s[e+8>>2],s[s[e+8>>2]+4>>2]=n,t=t-e|0,s[e>>2]=t;break e}s[r+12>>2]=16,s[r>>2]=16,s[r+8>>2]=n,s[r+4>>2]=e,s[600]=r,n=16}e=r+n|0,t=t-e|0,s[e>>2]=t}s[((t&-4)+e|0)-4>>2]=t|1,l=e,o=s[e>>2]-8|0;e:{if(o>>>0<=127){t=(o>>>3|0)-1|0;break e}if(i=h(o),t=((o>>>29-i^4)-(i<<2)|0)+110|0,o>>>0<=4095)break e;t=((o>>>30-i^2)-(i<<1)|0)+71|0,t=t>>>0<63?t:63}n=t<<4,s[l+4>>2]=n+1376,n=n+1384|0,s[e+8>>2]=s[n>>2],s[n>>2]=e,s[s[e+8>>2]+4>>2]=e,n=s[603],e=t&31,(t&63)>>>0>=32?(t=1<>>32-e,e=1<>1]=e,l[o+8>>1]=t,s[o+4>>2]=n,s[o>>2]=r;e:{if(c[o+8>>1]>32767){s[o+12>>2]=4;break e}t=s[o+4>>2],n=s[o>>2],e=T-48|0,T=e,s[e+40>>2]=o+10,s[e+36>>2]=t,s[e+32>>2]=n,a[e+31|0]=2,a[e+30|0]=12,s[e+24>>2]=o+8,a[e+23|0]=2;t:{if(!(s[e+32>>2]&&s[e+36>>2])){s[e+44>>2]=5;break t}if(s[e+16>>2]=u[e+31|0]+(u[e+23|0]+4|0),i=e,d=$(s[e+16>>2]),s[i+12>>2]=d,!s[e+12>>2]){s[e+44>>2]=3;break t}s[e+8>>2]=s[e+12>>2],a[s[e+8>>2]]=u[e+30|0],s[e+8>>2]=s[e+8>>2]+1,ae(s[e+8>>2],s[e+40>>2],u[e+23|0]),s[e+8>>2]=u[e+23|0]+s[e+8>>2],s[e+4>>2]=u[e+31|0],t=s[e+8>>2],n=u[e+4|0]|u[e+5|0]<<8,a[t|0]=n,a[t+1|0]=n>>>8,a[t+2|0]=u[e+6|0],s[e+8>>2]=s[e+8>>2]+3,ae(s[e+8>>2],s[e+24>>2],u[e+31|0]),s[s[e+32>>2]>>2]=s[e+16>>2],s[s[e+36>>2]>>2]=s[e+12>>2],s[e+44>>2]=0}T=e+48|0,s[o+12>>2]=s[e+44>>2]}return T=o+16|0,s[o+12>>2]}function A(e,t,n){e=e|0,t=t|0,n=n|0;var r=0,o=0,a=0,i=0,l=0;a=T+-64|0,T=a,o=1;e:{if(j(e,t,0)||(o=0,!t))break e;r=T+-64|0,T=r,o=s[t>>2],i=s[o-4>>2],l=s[o-8>>2],s[r+20>>2]=0,s[r+16>>2]=1084,s[r+12>>2]=t,s[r+8>>2]=1132,o=0,ie(r+24|0,39),t=t+l|0;t:{if(j(i,1132,0)){s[r+56>>2]=1,Se[s[s[i>>2]+20>>2]](i,r+8|0,t,t,1,0),o=s[r+32>>2]==1?t:0;break t}Se[s[s[i>>2]+24>>2]](i,r+8|0,t,1,0);n:switch(s[r+44>>2]){case 0:o=s[r+48>>2]==1&&s[r+36>>2]==1&&s[r+40>>2]==1?s[r+28>>2]:0;break t;case 1:break n;default:break t}if(s[r+48>>2]|s[r+36>>2]!=1|s[r+40>>2]!=1&&s[r+32>>2]!=1)break t;o=s[r+24>>2]}if(T=r- -64|0,t=o,o=0,!t)break e;ie(a+8|4,52),s[a+56>>2]=1,s[a+20>>2]=-1,s[a+16>>2]=e,s[a+8>>2]=t,Se[s[s[t>>2]+28>>2]](t,a+8|0,s[n>>2],1),e=s[a+32>>2],(e|0)==1&&(s[n>>2]=s[a+24>>2]),o=(e|0)==1}return e=o,T=a- -64|0,e|0}function F(e,t,n){var r=0,o=0,a=0,i=0;if(r=e+4|0,o=(r+t|0)-1&0-t,t=s[e>>2],o+n>>>0<=(t+e|0)-4>>>0){a=s[e+4>>2],s[a+8>>2]=s[e+8>>2],s[s[e+8>>2]+4>>2]=a,(r|0)!=(o|0)&&(o=o-r|0,a=e-(s[e-4>>2]&-2)|0,r=o+s[a>>2]|0,s[a>>2]=r,s[(a+(r&-4)|0)-4>>2]=r,e=e+o|0,t=t-o|0,s[e>>2]=t);e:{if(n+24>>>0<=t>>>0){r=(e+n|0)+8|0,t=(t-n|0)-8|0,s[r>>2]=t,s[(r+(t&-4)|0)-4>>2]=t|1,i=r,a=s[r>>2]-8|0;t:{if(a>>>0<=127){o=(a>>>3|0)-1|0;break t}if(t=h(a),o=((a>>>29-t^4)-(t<<2)|0)+110|0,a>>>0<=4095)break t;t=((a>>>30-t^2)-(t<<1)|0)+71|0,o=t>>>0<63?t:63}t=o,o=t<<4,s[i+4>>2]=o+1376,o=o+1384|0,s[r+8>>2]=s[o>>2],s[o>>2]=r,s[s[r+8>>2]+4>>2]=r,o=s[603],r=t&31,(t&63)>>>0>=32?(t=1<>>32-r,i=1<>2]=t,s[((t&-4)+e|0)-4>>2]=t;break e}s[(e+t|0)-4>>2]=t}e=e+4|0}else e=0;return e}function O(e){var t=0,n=0,r=0,o=0,a=0;if(e){n=e-4|0,o=s[n>>2],r=o,t=n,a=s[e-8>>2],e=a&-2,(e|0)!=(a|0)&&(t=n-e|0,r=s[t+4>>2],s[r+8>>2]=s[t+8>>2],s[s[t+8>>2]+4>>2]=r,r=e+o|0),e=n+o|0,n=s[e>>2],(n|0)!=s[(e+n|0)-4>>2]&&(o=s[e+4>>2],s[o+8>>2]=s[e+8>>2],s[s[e+8>>2]+4>>2]=o,r=r+n|0),s[t>>2]=r,s[((r&-4)+t|0)-4>>2]=r|1,a=t,r=s[t>>2]-8|0;e:{if(r>>>0<=127){e=(r>>>3|0)-1|0;break e}if(o=h(r),e=((r>>>29-o^4)-(o<<2)|0)+110|0,r>>>0<=4095)break e;e=((r>>>30-o^2)-(o<<1)|0)+71|0,e=e>>>0<63?e:63}n=e<<4,s[a+4>>2]=n+1376,n=n+1384|0,s[t+8>>2]=s[n>>2],s[n>>2]=t,s[s[t+8>>2]+4>>2]=t,n=s[603],t=e&31,(e&63)>>>0>=32?(e=1<>>32-t,t=1<>2]=e,s[r+36>>2]=t,s[r+32>>2]=n;e:{if(!(s[r+32>>2]&&s[r+36>>2])){s[r+44>>2]=5;break e}if(d[r+40>>2]>4){s[r+44>>2]=8;break e}if(s[r+28>>2]=5,o=r,i=$(s[r+28>>2]),s[o+24>>2]=i,!s[r+24>>2]){s[r+44>>2]=3;break e}s[r+20>>2]=s[r+24>>2],a[r+19|0]=3,a[s[r+20>>2]]=u[r+19|0],s[r+20>>2]=s[r+20>>2]+1,s[r+12>>2]=1,e=s[r+20>>2],t=u[r+12|0]|u[r+13|0]<<8,a[e|0]=t,a[e+1|0]=t>>>8,a[e+2|0]=u[r+14|0],s[r+20>>2]=s[r+20>>2]+3,a[r+11|0]=s[r+40>>2],a[s[r+20>>2]]=u[r+11|0],s[s[r+36>>2]>>2]=s[r+24>>2],s[s[r+32>>2]>>2]=s[r+28>>2],s[r+44>>2]=0}return T=r+48|0,s[r+44>>2]}function W(e,t,n,r,o){if(e=e|0,t=t|0,n=n|0,r=r|0,o=o|0,j(e,s[t+8>>2],o)){se(t,n,r);return}e:{if(j(e,s[t>>2],o)){if(!(s[t+20>>2]!=(n|0)&&s[t+16>>2]!=(n|0))){if((r|0)!=1)break e;s[t+32>>2]=1;return}s[t+32>>2]=r;t:{if(s[t+44>>2]==4)break t;if(l[t+52>>1]=0,e=s[e+8>>2],Se[s[s[e>>2]+20>>2]](e,t,n,n,1,o),u[t+53|0]){if(s[t+44>>2]=3,!u[t+52|0])break t;break e}s[t+44>>2]=4}if(s[t+20>>2]=n,s[t+40>>2]=s[t+40>>2]+1,s[t+36>>2]!=1|s[t+24>>2]!=2)break e;a[t+54|0]=1;return}e=s[e+8>>2],Se[s[s[e>>2]+24>>2]](e,t,n,r,o)}}function q(e,t,n,r,o){var a=0;a=T-32|0,T=a,s[a+24>>2]=e,s[a+20>>2]=t,s[a+16>>2]=n,s[a+12>>2]=r,s[a+8>>2]=o;e:{if(d[a+16>>2]<1){s[a+28>>2]=9;break e}if(s[s[a+8>>2]>>2]=s[a+16>>2]-1,d[s[a+20>>2]>>2]>2]>>2]){s[a+28>>2]=1;break e}if(e=$(s[s[a+8>>2]>>2]),s[s[a+12>>2]>>2]=e,!s[s[a+12>>2]>>2]){s[a+28>>2]=3;break e}ae(s[s[a+12>>2]>>2],s[s[a+24>>2]>>2],s[s[a+8>>2]>>2]),e=s[a+24>>2],s[e>>2]=s[s[a+8>>2]>>2]+s[e>>2],e=s[a+20>>2],s[e>>2]=s[e>>2]-s[s[a+8>>2]>>2],s[a+28>>2]=0}return T=a+32|0,s[a+28>>2]}function U(e,t,n){e=e|0,t=t|0,n=n|0;var r=0,o=0,i=0;r=T-32|0,T=r,l[r+26>>1]=e,s[r+20>>2]=t,s[r+16>>2]=n,s[s[r+16>>2]>>2]=3,o=r,i=$(s[s[r+16>>2]>>2]),s[o+12>>2]=i;e:{if(!s[r+12>>2]){s[r+28>>2]=3;break e}s[s[r+20>>2]>>2]=s[r+12>>2],a[r+11|0]=14,a[s[r+12>>2]]=u[r+11|0],s[r+12>>2]=s[r+12>>2]+1,e=s[r+12>>2],t=u[r+26|0]|u[r+27|0]<<8,a[e|0]=t,a[e+1|0]=t>>>8,s[r+28>>2]=0}return T=r+32|0,s[r+28>>2]}function V(e,t){var n=0;for(n=T-16|0,T=n,s[n+12>>2]=e,s[n+8>>2]=t,s[n+4>>2]=0;;){if(d[n+4>>2]>2]){s[n>>2]=s[n+12>>2]+_(s[n+4>>2],20);e:{if(!(s[s[n>>2]>>2]&15)){O(s[s[n>>2]+8>>2]);break e}t:{if((s[s[n>>2]>>2]&15)==5){O(s[s[n>>2]+8>>2]);break t}(s[s[n>>2]>>2]&15)==6&&O(s[s[n>>2]+12>>2])}}s[n+4>>2]=s[n+4>>2]+1;continue}break}O(s[n+12>>2]),T=n+16|0}function H(e,t,n,r){a[e+53|0]=1;e:{if(s[e+4>>2]!=(n|0))break e;if(a[e+52|0]=1,n=s[e+16>>2],!n){if(s[e+36>>2]=1,s[e+24>>2]=r,s[e+16>>2]=t,(r|0)!=1|s[e+48>>2]!=1)break e;a[e+54|0]=1;return}if((t|0)==(n|0)){if(n=s[e+24>>2],(n|0)==2&&(s[e+24>>2]=r,n=r),s[e+48>>2]!=1|(n|0)!=1)break e;a[e+54|0]=1;return}a[e+54|0]=1,s[e+36>>2]=s[e+36>>2]+1}}function G(e,t,n,r){var o=0;o=T-32|0,s[o+24>>2]=e,s[o+20>>2]=t,s[o+16>>2]=n,s[o+12>>2]=r,a[o+11|0]=0;e:{if(d[s[o+20>>2]>>2]<1){s[o+28>>2]=1;break e}a[o+11|0]=u[s[s[o+24>>2]>>2]],e=s[o+24>>2],s[e>>2]=s[e>>2]+1,e=s[o+20>>2],s[e>>2]=s[e>>2]-1,a[s[o+16>>2]]=(u[o+11|0]&128)==128,a[s[o+12>>2]]=u[o+11|0]&127,s[o+28>>2]=0}return s[o+28>>2]}function z(e,t,n,r,o){if(e=e|0,t=t|0,n=n|0,r=r|0,o=o|0,j(e,s[t+8>>2],o)){se(t,n,r);return}e:{if(!j(e,s[t>>2],o))break e;if(!(s[t+20>>2]!=(n|0)&&s[t+16>>2]!=(n|0))){if((r|0)!=1)break e;s[t+32>>2]=1;return}s[t+20>>2]=n,s[t+32>>2]=r,s[t+40>>2]=s[t+40>>2]+1,s[t+36>>2]!=1|s[t+24>>2]!=2||(a[t+54|0]=1),s[t+44>>2]=4}}function j(e,t,n){var r=0;if(!n)return s[e+4>>2]==s[t+4>>2];if((e|0)==(t|0))return 1;n=s[e+4>>2],e=u[n|0],t=s[t+4>>2],r=u[t|0];e:{if(!e|(r|0)!=(e|0))break e;for(;;){if(r=u[t+1|0],e=u[n+1|0],!e)break e;if(t=t+1|0,n=n+1|0,(e|0)!=(r|0))break}}return(e|0)==(r|0)}function K(e,t){e=e|0,t=t|0;var n=0,r=0,o=0;n=T-32|0,T=n,s[n+24>>2]=e,s[n+20>>2]=t,r=n,o=$(1),s[r+16>>2]=o;e:{if(!s[n+16>>2]){s[n+28>>2]=3;break e}a[n+15|0]=9,a[s[n+16>>2]]=u[n+15|0],s[s[n+24>>2]>>2]=s[n+16>>2],s[s[n+20>>2]>>2]=1,s[n+28>>2]=0}return T=n+32|0,s[n+28>>2]}function Q(e,t){e=e|0,t=t|0;var n=0,r=0,o=0;n=T-32|0,T=n,s[n+24>>2]=e,s[n+20>>2]=t,r=n,o=$(1),s[r+16>>2]=o;e:{if(!s[n+16>>2]){s[n+28>>2]=3;break e}a[n+15|0]=10,a[s[n+16>>2]]=u[n+15|0],s[s[n+24>>2]>>2]=s[n+16>>2],s[s[n+20>>2]>>2]=1,s[n+28>>2]=0}return T=n+32|0,s[n+28>>2]}function X(e,t){e=e|0,t=t|0;var n=0,r=0,o=0;n=T-32|0,T=n,s[n+24>>2]=e,s[n+20>>2]=t,r=n,o=$(1),s[r+16>>2]=o;e:{if(!s[n+16>>2]){s[n+28>>2]=3;break e}a[n+15|0]=2,a[s[n+16>>2]]=u[n+15|0],s[s[n+24>>2]>>2]=s[n+16>>2],s[s[n+20>>2]>>2]=1,s[n+28>>2]=0}return T=n+32|0,s[n+28>>2]}function Y(e,t){e=e|0,t=t|0;var n=0,r=0,o=0;n=T-32|0,T=n,s[n+24>>2]=e,s[n+20>>2]=t,r=n,o=$(1),s[r+16>>2]=o;e:{if(!s[n+16>>2]){s[n+28>>2]=3;break e}a[n+15|0]=4,a[s[n+16>>2]]=u[n+15|0],s[s[n+24>>2]>>2]=s[n+16>>2],s[s[n+20>>2]>>2]=1,s[n+28>>2]=0}return T=n+32|0,s[n+28>>2]}function J(e){var t=0;t=T-16|0,T=t,s[t+12>>2]=e,e=1;e:{if(ee(s[t+12>>2])&1||(e=1,s[t+12>>2]==15)||(e=1,s[t+12>>2]==13)||(e=1,s[t+12>>2]==12))break e;e=s[t+12>>2]==14}return T=t+16|0,e}function Z(e,t,n){var r=0;if(r=s[e+16>>2],!r){s[e+36>>2]=1,s[e+24>>2]=n,s[e+16>>2]=t;return}e:{if((t|0)==(r|0)){if(s[e+24>>2]!=2)break e;s[e+24>>2]=n;return}a[e+54|0]=1,s[e+24>>2]=2,s[e+36>>2]=s[e+36>>2]+1}}function ee(e){var t=0;t=T-16|0,s[t+12>>2]=e,e=1;e:{if(s[t+12>>2]==5||(e=1,s[t+12>>2]==6)||(e=1,s[t+12>>2]==7))break e;e=s[t+12>>2]==8}return e}function te(e,t,n,r,o,a){if(e=e|0,t=t|0,n=n|0,r=r|0,o=o|0,a=a|0,j(e,s[t+8>>2],a)){H(t,n,r,o);return}e=s[e+8>>2],Se[s[s[e>>2]+20>>2]](e,t,n,r,o,a)}function ne(){for(var e=0,t=0,n=0;t=e<<4,n=t+1376|0,s[t+1380>>2]=n,s[t+1384>>2]=n,e=e+1|0,(e|0)!=64;);M(48)}function re(e,t,n,r){if(e=e|0,t=t|0,n=n|0,r=r|0,j(e,s[t+8>>2],0)){Z(t,n,r);return}e=s[e+8>>2],Se[s[s[e>>2]+28>>2]](e,t,n,r)}function oe(e,t,n,r,o,a){e=e|0,t=t|0,n=n|0,r=r|0,o=o|0,a=a|0,j(e,s[t+8>>2],a)&&H(t,n,r,o)}function ae(e,t,n){if(n)for(;a[e|0]=u[t|0],e=e+1|0,t=t+1|0,n=n-1|0,!!n;);}function ie(e,t){if(t)for(;a[e|0]=0,e=e+1|0,t=t-1|0,!!t;);}function le(e,t,n,r){e=e|0,t=t|0,n=n|0,r=r|0,j(e,s[t+8>>2],0)&&Z(t,n,r)}function se(e,t,n){s[e+28>>2]==1|s[e+4>>2]!=(t|0)||(s[e+28>>2]=n)}function ue(e,t){return e=e|0,t=t|0,_(t,20)+e|0}function ce(e){return e=e|0,c[e+8>>1]>>>1|0}function de(e){return e=e|0,l[e+8>>1]&1}function me(e){return e=e|0,s[e+12>>2]}function pe(e){return e=e|0,s[e>>2]&15}function _e(e){return e=e|0,s[e+16>>2]}function fe(e){return e=e|0,c[e+4>>1]}function ge(e){return e=e|0,s[e+8>>2]}function he(e){return e=e|0,u[e+4|0]}function ye(e){return e=e|0,e|0}function Ce(e){return $(e)}function be(e){e=e|0,O(e)}function ve(e){e=e|0}n=u,i(t);var Se=e([null,ye,be,ve,ve,A,oe,z,le,be,te,W,re]);function Re(){return o.byteLength/65536|0}function Le(e){e=e|0;var t=Re()|0,i=t+e|0;if(t0&&(e+=t-e%t),e}var T,D,x,$,P,N,M,w,A;function F(e){T=e,t.HEAP8=D=new Int8Array(e),t.HEAP16=$=new Int16Array(e),t.HEAP32=N=new Int32Array(e),t.HEAPU8=x=new Uint8Array(e),t.HEAPU16=P=new Uint16Array(e),t.HEAPU32=M=new Uint32Array(e),t.HEAPF32=w=new Float32Array(e),t.HEAPF64=A=new Float64Array(e)}var O=t.INITIAL_MEMORY||2097152;t.wasmMemory?R=t.wasmMemory:R=new S.Memory({initial:O/65536,maximum:32768}),R&&(T=R.buffer),O=T.byteLength,F(T);var B,W=[],q=[],U=[],V=!1;function H(){if(t.preRun)for(typeof t.preRun=="function"&&(t.preRun=[t.preRun]);t.preRun.length;)j(t.preRun.shift());ue(W)}function G(){V=!0,ue(q)}function z(){if(t.postRun)for(typeof t.postRun=="function"&&(t.postRun=[t.postRun]);t.postRun.length;)Q(t.postRun.shift());ue(U)}function j(e){W.unshift(e)}function K(e){q.unshift(e)}function Q(e){U.unshift(e)}if((!Math.imul||Math.imul(4294967295,5)!==-5)&&(Math.imul=function(t,n){var e=t>>>16,r=t&65535,o=n>>>16,a=n&65535;return r*a+(e*a+r*o<<16)|0}),!Math.fround){var X=new Float32Array(1);Math.fround=function(e){return X[0]=e,X[0]}}Math.clz32||(Math.clz32=function(e){var t=32,n=e>>16;return n&&(t-=16,e=n),n=e>>8,n&&(t-=8,e=n),n=e>>4,n&&(t-=4,e=n),n=e>>2,n&&(t-=2,e=n),n=e>>1,n?t-2:t-e}),Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)});var Y=0,J=null,Z=null;function ee(e){Y++,t.monitorRunDependencies&&t.monitorRunDependencies(Y)}function te(e){if(Y--,t.monitorRunDependencies&&t.monitorRunDependencies(Y),Y==0&&(J!==null&&(clearInterval(J),J=null),Z)){var n=Z;Z=null,n()}}t.preloadedImages={},t.preloadedAudios={};function ne(e){t.onAbort&&t.onAbort(e),e+="",C(e),L=!0,E=1,e="abort("+e+"). Build with -s ASSERTIONS=1 for more info.";var n=new S.RuntimeError(e);throw o(n),n}var re="data:application/octet-stream;base64,";function oe(e){return e.startsWith(re)}var ae="dgwcppbridge.wasm";oe(ae)||(ae=p(ae));function ie(e){try{if(e==ae&&b)return new Uint8Array(b);var t=ge(e);if(t)return t;if(g)return g(e);throw"both async and sync fetching of the wasm failed"}catch(e){ne(e)}}function le(){return!b&&(c||d)&&typeof fetch=="function"?fetch(ae,{credentials:"same-origin"}).then(function(e){if(!e.ok)throw"failed to load wasm binary file at '"+ae+"'";return e.arrayBuffer()}).catch(function(){return ie(ae)}):n.resolve().then(function(){return ie(ae)})}function se(){var e={a:he};function n(e,n){var r=e.exports;t.asm=r,B=t.asm.A,K(t.asm.c),te("wasm-instantiate")}ee("wasm-instantiate");function r(e){n(e.instance)}function a(t){return le().then(function(t){var n=S.instantiate(t,e);return n}).then(t,function(e){C("failed to asynchronously prepare wasm: "+e),ne(e)})}function i(){return!b&&typeof S.instantiateStreaming=="function"&&!oe(ae)&&typeof fetch=="function"?fetch(ae,{credentials:"same-origin"}).then(function(t){var n=S.instantiateStreaming(t,e);return n.then(r,function(e){return C("wasm streaming compile failed: "+e),C("falling back to ArrayBuffer instantiation"),a(r)})}):a(r)}if(t.instantiateWasm)try{var l=t.instantiateWasm(e,n);return l}catch(e){return C("Module.instantiateWasm callback failed with error: "+e),!1}return i().catch(o),{}}function ue(e){for(;e.length>0;){var n=e.shift();if(typeof n=="function"){n(t);continue}var r=n.func;typeof r=="number"?n.arg===void 0?B.get(r)():B.get(r)(n.arg):r(n.arg===void 0?null:n.arg)}}function ce(e){try{return R.grow(e-T.byteLength+65535>>>16),F(R.buffer),1}catch(e){}}function de(e){var t=x.length;e=e>>>0;var n=2147483648;if(e>n)return!1;for(var r=1;r<=4;r*=2){var o=t*(1+.2/r);o=Math.min(o,e+100663296);var a=Math.min(n,I(Math.max(e,o),65536)),i=ce(a);if(i)return!0}return!1}var me=!1;function pe(e){for(var t=[],n=0;n255&&(r&=255),t.push(String.fromCharCode(r))}return t.join("")}var _e=typeof atob=="function"?atob:function(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="",r,o,a,i,l,s,u,c=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");do i=t.indexOf(e.charAt(c++)),l=t.indexOf(e.charAt(c++)),s=t.indexOf(e.charAt(c++)),u=t.indexOf(e.charAt(c++)),r=i<<2|l>>4,o=(l&15)<<4|s>>2,a=(s&3)<<6|u,n=n+String.fromCharCode(r),s!==64&&(n=n+String.fromCharCode(o)),u!==64&&(n=n+String.fromCharCode(a));while(c0||(H(),Y>0))return;function n(){Ve||(Ve=!0,t.calledRun=!0,!L&&(G(),r(t),t.onRuntimeInitialized&&t.onRuntimeInitialized(),z()))}t.setStatus?(t.setStatus("Running..."),setTimeout(function(){setTimeout(function(){t.setStatus("")},1),n()},1)):n()}if(t.run=He,t.preInit)for(typeof t.preInit=="function"&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();return He(),t.ready})})();typeof i=="object"&&typeof a=="object"?a.exports=e:typeof define=="function"&&define.amd?define([],function(){return e}):typeof i=="object"&&(i.Module=e)}),null); __d("DGWUtils",["Base64","DGWConstants","DGWCppBridge","IDGWLoggingContext","Promise","Random","URI","asyncToGeneratorRuntime","getErrorSafe"],(function(t,n,r,o,a,i,l){"use strict";var e,s,u=4;function c(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=o("Random").random()*16|0,n=e==="x"?t:t&3|8;return n.toString(16)})}function d(e){var t=new TextDecoder,n=t.decode(e),o=r("Base64").encode(n),a=o.replace(/\+/gi,"-").replace(/\//gi,"_").replace(/=/gi,"");return a}var m=null,p=null;function _(){return p==null&&(p=(s||(s=n("Promise"))).resolve().then(function(){return r("DGWCppBridge")()}).then(function(e){m=e})),p}var f=(function(){function t(){}return t.initialize=(function(){var e=n("asyncToGeneratorRuntime").asyncToGenerator(function*(){return _()});function t(){return e.apply(this,arguments)}return t})(),t.constructConnectUrl=function(n){var t,a,i=n.appId,l=n.appVersion,s=n.authToken,u=n.authType,c=n.deviceId,m=n.dgwVersion,p=n.endpoint,_=n.establishStreamFrame,f=n.fbId,g=n.headers,h=n.loggingId,y=n.regionHint,C=n.serviceId,b=n.tier,v=n.trafficTracing,S=(t={},t[(a=o("DGWConstants")).HEADER_CONSTANTS.HEADER_APPID]=i,t[a.HEADER_CONSTANTS.HEADER_APPVERSION]=l,t[a.HEADER_CONSTANTS.HEADER_AUTHTYPE]=u,t[a.HEADER_CONSTANTS.HEADER_DGW_VERSION]=""+m,t[a.HEADER_CONSTANTS.HEADER_UUID]=f,t[a.HEADER_CONSTANTS.HEADER_TARGET_TIER]=b,t);_!==void 0&&(S[o("DGWConstants").HEADER_CONSTANTS.HEADER_ESTABLISH_STREAM_FRAME_BASE64]=d(_)),h!==void 0&&(S[o("DGWConstants").HEADER_CONSTANTS.HEADER_LOGGING_ID]=h),y!==void 0&&(S[o("DGWConstants").HEADER_CONSTANTS.HEADER_REGIONHINT]=y),c!==void 0&&(S[o("DGWConstants").HEADER_CONSTANTS.HEADER_DEVICE_ID]=c),v!==void 0&&(S[o("DGWConstants").HEADER_CONSTANTS.TRAFFIC_TRACING]="debug:"+v),s!==void 0&&(S[o("DGWConstants").HEADER_CONSTANTS.HEADER_AUTHTOKEN]=s),Object.keys(g).forEach(function(e){var t=o("DGWConstants").HEADER_CONSTANTS.APPHEADER_PREFIX+e;Object.prototype.hasOwnProperty.call(S,t)||(S[t]=g[e])});var R=new(e||(e=r("URI")))(p);return R.setQueryData(S),R.setPath(R.getPath()+"/"+C),R.toString().length>2e3&&(delete S[o("DGWConstants").HEADER_CONSTANTS.HEADER_ESTABLISH_STREAM_FRAME_BASE64],R.setQueryData(S)),R.toStringRawQuery()},t})(),g=(function(){function e(e,t,n){this.$1=null,this.$2=e,this.$3=t,this.$4=n}e.initialize=(function(){var e=n("asyncToGeneratorRuntime").asyncToGenerator(function*(){return _()});function t(){return e.apply(this,arguments)}return t})();var t=e.prototype;return t.malloc=function(t){try{var e=m.__malloc(t);if(e===0){var n;return(n=this.$2)==null||n.logError(o("IDGWLoggingContext").DGWLoggingComponent.CODEC_COMPONENT,"wasm malloc failure","malloc returned 0"),-1}return e}catch(e){var a;return(a=this.$2)==null||a.logError(o("IDGWLoggingContext").DGWLoggingComponent.CODEC_COMPONENT,"wasm malloc failure","exception during malloc",r("getErrorSafe")(e).message),-1}},t.free=function(t){m.__free(t)},t.append=function(t){if(this.$1==null){this.$1=t;return}var e=this.$1.length,n=new Uint8Array(e+t.length);n.set(this.$1,0),n.set(t,e),this.$1=n},t.processData=function(){var e=this;if(this.$1!=null){var t=this.$1.length,n=this.malloc(t);if(n!==-1){var r=m.HEAPU8.subarray(n,n+t);if(this.$1)for(var a=0;ag){var h;this.$1=new Uint8Array(((h=this.$1)==null?void 0:h.subarray(g))||[])}else this.$1=null;for(var y=m.HEAPU32.subarray(s/u,s/u+1)[0],C=m.HEAPU32.subarray(l/u,l/u+1)[0],b=[],v=function(){var t=m.__getDGWFramePtr(C,S),n=m.__getFrameType(t);switch(n){case o("DGWConstants").DgwFrameType.DgwFrameType_Drain:{var r,a=m.__getDrainReasonFromDrainFrame(t),i=o("DGWConstants").drainReasonToDrainReasonString(a);(r=e.$2)==null||r.logEvent(o("IDGWLoggingContext").DGWLoggingComponent.CODEC_COMPONENT,"Received Drain Frame from server","DrainReason: "+i),b.push(function(){var t;return(t=e.$3)==null?void 0:t.receivedDrainSignal(i)});break}case o("DGWConstants").DgwFrameType.DgwFrameType_StreamGroup_EstabStream:{var l=m.__getStreamIdFromStreamGroupFrame(t),s=m.__getEncodedParamsFromEstablishStreamFrame(t),u=new Uint8Array(m.HEAPU8.subarray(s,s+m.__getEncodedParamsSizeFromEstablishStreamFrame(t)));e.free(s),b.push(function(){var t;return(t=e.$3)==null?void 0:t.onGroupedStreamEstablishStreamReceived(l,u)});break}case o("DGWConstants").DgwFrameType.DgwFrameType_StreamGroup_Data:{var c=m.__getStreamIdFromStreamGroupFrame(t),d=m.__getDataFromGroupedStreamDataFrame(t),p=new Uint8Array(m.HEAPU8.subarray(d,d+m.__getDataSizeFromGroupedStreamDataFrame(t)));e.free(d);var _=m.__getRequiresAckFromGroupedStreamDataFrame(t)?m.__getAckIdFromGroupedStreamDataFrame(t):null;b.push(function(){var t;return(t=e.$3)==null?void 0:t.onGroupedStreamDataReceived(c,p,_)});break}case o("DGWConstants").DgwFrameType.DgwFrameType_StreamGroup_Ack:{var f=m.__getStreamIdFromStreamGroupFrame(t),g=m.__getAckIdFromGroupedStreamAckFrame(t);b.push(function(){var t;return(t=e.$3)==null?void 0:t.onGroupedStreamAckReceived(f,g)});break}case o("DGWConstants").DgwFrameType.DgwFrameType_StreamGroup_EndOfData:{var h=m.__getStreamIdFromStreamGroupFrame(t);b.push(function(){var t;return(t=e.$3)==null?void 0:t.onGroupedStreamEndOfDataReceived(h)});break}case o("DGWConstants").DgwFrameType.DgwFrameType_Ping:{b.push(function(){var t;return(t=e.$3)==null?void 0:t.onPingReceived()});break}case o("DGWConstants").DgwFrameType.DgwFrameType_Pong:{b.push(function(){var t;return(t=e.$3)==null?void 0:t.onPongReceived()});break}default:break}e.free(t)},S=0;S0&&(this.$6.bumpODSKey(o("IDGWLoggingContext").DGWLoggingComponent.PINGER,"reset.newtimeout"),this.$2=window.setTimeout(function(){e.$7()},this.$1))},t.cancel=function(){this.$2&&(this.$6.bumpODSKey(o("IDGWLoggingContext").DGWLoggingComponent.PINGER,"canceled"),window.clearTimeout(this.$2),this.$2=null)},e})();l.DGWPinger=e}),98); __d("DGWStreamGroupCallbacks",["$InternalEnum"],(function(t,n,r,o,a,i){"use strict";var e=n("$InternalEnum")({TRANSPORT_SERVER_INTERNAL_ERROR:0,TRANSPORT_ABNORMAL_CLOSURE:1,TRANSPORT_GOING_AWAY:2,TRANSPORT_UNKNOWN_ERROR:3,TRANSPORT_KEEPALIVE_TIMEOUT:4,TRANSPORT_UNAUTHORIZED:5,TRANSPORT_REJECTED:6,TRANSPORT_BAD_REQUEST:7,TRANSPORT_DGW_SERVER_ERROR:8,TRANSPORT_NORMAL_CLOSURE:9});function l(t){switch(t){case e.TRANSPORT_SERVER_INTERNAL_ERROR:return"TRANSPORT_SERVER_INTERNAL_ERROR";case e.TRANSPORT_ABNORMAL_CLOSURE:return"TRANSPORT_ABNORMAL_CLOSURE";case e.TRANSPORT_GOING_AWAY:return"TRANSPORT_GOING_AWAY";case e.TRANSPORT_UNKNOWN_ERROR:return"TRANSPORT_UNKNOWN_ERROR";case e.TRANSPORT_KEEPALIVE_TIMEOUT:return"TRANSPORT_KEEPALIVE_TIMEOUT";case e.TRANSPORT_UNAUTHORIZED:return"TRANSPORT_UNAUTHORIZED";case e.TRANSPORT_REJECTED:return"TRANSPORT_REJECTED";case e.TRANSPORT_BAD_REQUEST:return"TRANSPORT_BAD_REQUEST";case e.TRANSPORT_DGW_SERVER_ERROR:return"TRANSPORT_DGW_SERVER_ERROR";case e.TRANSPORT_NORMAL_CLOSURE:return"TRANSPORT_NORMAL_CLOSURE"}}function s(t){switch(t){case e.TRANSPORT_UNAUTHORIZED:return!1;default:return!0}}var u=(function(){function e(){}var t=e.prototype;return t.onStreamGroupError=function(){},t.onStreamGroupMustDrain=function(){},t.onStreamGroupTransportClose=function(){},e})();i.DGWStreamGroupError=e,i.dgwStreamGroupErrorToString=l,i.isRetryableError=s,i.NoOpDGWStreamGroupCallbacks=u}),66); __d("DGWTransportEvents",["IDGWLoggingContext"],(function(t,n,r,o,a,i,l){"use strict";var e=(function(){function e(e){this.$3=e}var t=e.prototype;return t.transportEstablished=function(t){this.$3.logEvent(o("IDGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"open",t),this.$2=Date.now(),this.$3.bumpODSKey(o("IDGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"stream_group_establishment_success")},t.transportPingSent=function(t){this.$3.logEvent(o("IDGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"Ping Frame Sent",t,!0)},t.transportPongReceived=function(t){this.$3.logEvent(o("IDGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"Pong Frame Received",t,!0)},t.transportEstablishmentPending=function(){this.$1=Date.now(),this.$3.logEvent(o("IDGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"transportPending",null,!0),this.$3.bumpODSKey(o("IDGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"stream_group_establishment_pending")},t.transportClosed=function(t,n,r){this.$4=Date.now(),t?(this.$3.bumpODSKey(o("IDGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"transport_close_graceful"),this.$3.logEvent(o("IDGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"Transport closed gracefully",null,!0)):(this.$3.bumpODSKey(o("IDGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"transport_close_with_error"),this.$3.logError(o("IDGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"Transport closed abnormally",n,r))},t.transportEstablishmentFailure=function(t){this.$3.logError(o("IDGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"WebSocket transport establishment failure","WebSocket close code: "+t.code+" reason: "+t.reason+" wasClean: "+String(t.wasClean)),this.$3.bumpODSKey(o("IDGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"stream_group_establishment_failure")},t.streamEstablishmentTimeout=function(t,n,r){this.$3.logError(o("IDGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"Grouped Stream establishment timeout",t,"streamId:"+n,!1,r,!0),this.$3.bumpODSKey(o("IDGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"stream_establishment_timeout")},t.streamEstablishmentPending=function(t,n){this.$3.logEvent(o("IDGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"Grouped Stream establishment pending","streamId:"+t,!0,n),this.$3.bumpODSKey(o("IDGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"stream_establishment_pending")},t.streamEstablishmentSuccess=function(t,n){this.$3.logEvent(o("IDGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"Grouped Stream establishment success","streamId:"+t,!0,n),this.$3.bumpODSKey(o("IDGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"stream_establishment_success")},t.transportError=function(t,n,r){this.$3.logError(o("IDGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,t,n,r)},t.receivedFrameForInactiveStream=function(t,n,r){this.$3.logWarn(o("IDGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"Frame received for inactive stream","frameType: "+t+", streamID: "+n,r)},t.ranOutOfStreamIds=function(t){this.$3.logWarn(o("IDGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"Hit max StreamId limit","Hit max StreamId limit",t)},e})();l.DGWTransportEvents=e}),98); __d("DGWWebSocketTransport",[],(function(t,n,r,o,a,i){"use strict";function e(e){var t=new WebSocket(e);return t.binaryType="arraybuffer",t.onopen=function(){},t.onclose=function(){},t.onerror=function(){},t}i.getWebSocketConnection=e}),66); __d("DGWStreamEvents",[],(function(t,n,r,o,a,i){"use strict";var e=(function(){function e(e,t,n){this.$4=new Map,this.$5=new Map,this.$6=e,this.$1=t,n!=null&&(this.$8="streamId:"+n+"::")}var t=e.prototype;return t.dataSent=function(t,n,r){var e,o=n?"sendWithAckRequested":"sendWithoutAckRequested";this.$6.logEvent(this.$1,o,((e=this.$8)!=null?e:"")+"sendId:"+r+", payloadSize:"+t,!0),this.$4.set(r,{ackRequested:n,payloadSize:t,sendTimestamp:Date.now()})},t.ackReceived=function(t){var e;this.$6.logEvent(this.$1,"AckReceived",((e=this.$8)!=null?e:"")+"sendId:"+t,!0),this.$6.bumpODSKey(this.$1,"ack_received");var n=this.$4.get(t);n!=null&&(n.ackReceivedTimestamp=Date.now())},t.ackSent=function(t){var e;this.$6.bumpODSKey(this.$1,"ack_sent"),this.$6.logEvent(this.$1,"ACK sent",((e=this.$8)!=null?e:"")+"ackId:"+t,!0)},t.drainSent=function(t){var e;this.$6.logEvent(this.$1,"Drain sent",((e=this.$8)!=null?e:"")+"drainReason: "+t)},t.dataReceived=function(t,n,r){var e;this.$6.bumpODSKey(this.$1,"data_received"),this.$6.logEvent(this.$1,"Data received",((e=this.$8)!=null?e:"")+"sendId:"+(r!=null?r:"null")+", ackRequested:"+n.toString()+", payloadSize:"+t,!0),r!=null&&this.$5.set(r,{ackRequested:n,payloadSize:t,receiveTimestamp:Date.now()})},t.endOfDataReceived=function(){this.$6.bumpODSKey(this.$1,"end_of_data_received"),this.$6.logEvent(this.$1,"EndOfDataReceived",this.$8,!0)},t.endOfDataSent=function(){this.$6.bumpODSKey(this.$1,"end_of_data_sent"),this.$6.logEvent(this.$1,"EndOfDataSent",this.$8,!0)},t.streamClosed=function(t,n){this.$7=Date.now();var e=this.$9();if(t){var r;this.$6.bumpODSKey(this.$1,"stream_closed_gracefully"),this.$6.logEvent(this.$1,"Stream closed gracefully",""+((r=this.$8)!=null?r:"")+e)}else{var o;this.$6.bumpODSKey(this.$1,"stream_closed_with_error"),this.$6.logError(this.$1,"Stream closed abnormally",n,""+((o=this.$8)!=null?o:"")+e)}},t.connectionEstablishmentFailure=function(t){this.$6.logEvent(this.$1,"WebSocket connection establishment failure","WebSocket close code: "+t)},t.streamEstablishmentFailure=function(t,n){var e;this.$6.logError(this.$1,"Failed to establish DGW Stream","Last seen error: "+t.toString(),""+((e=this.$8)!=null?e:"")+n),this.$6.bumpODSKey(this.$1,"stream_establishment_failure")},t.error=function(t,n){var e={msg:n,state:this.$9()};this.$6.logError(this.$1,t,JSON.stringify(e),this.$8)},t.$9=function(){var e={currentNetworkCondition:window.navigator&&window.navigator.onLine===!0,establishRequestTimestamp:this.$2,establishedTimestamp:this.$3,streamClosedTimestamp:this.$7,sendHistory:JSON.stringify(Array.from(this.$4.entries())),receiveHistory:JSON.stringify(Array.from(this.$5.entries()))};return JSON.stringify(e)},e})();i.DGWStreamEvents=e}),66); __d("GroupedStream",["DGWAckManager","DGWConstants","DGWStream","DGWStreamEvents","IDGWLoggingContext","Promise","Random","asyncToGeneratorRuntime"],(function(t,n,r,o,a,i,l){"use strict";var e,s=(function(){function t(e,t,n,r,a,i,l){this.$1=e,this.$3=!1,this.$4=!1,this.$5=!1,this.$6=t,this.$7=n,this.$8=r,this.$2=i,this.$9=a,this.$10=new(o("DGWAckManager")).DGWAckManager(this.$9),this.$12=new(o("DGWStreamEvents")).DGWStreamEvents(this.$9,o("IDGWLoggingContext").DGWLoggingComponent.GROUPED_STREAM_COMPONENT,this.$1),this.$11=0,this.$13=l,this.$14=Date.now()+(Math.round(o("Random").random()*1e4)+1e4),this.$9.qplMarkerStart(o("IDGWLoggingContext").QPLEvent.STREAM_LIFECYCLE,this.$14)}var r=t.prototype;return r.send=(function(){var e=n("asyncToGeneratorRuntime").asyncToGenerator(function*(e,t){var n=this.$11++%o("DGWConstants").MAX_ACK_ID,r=this.$15(e,!0,n);if(!this.$16(r,!0,n))return!1;var a=yield this.$10.waitForAck(n,t!=null?t:o("DGWConstants").DEFAULT_ACK_TIMEOUT_MS);return a});function t(t,n){return e.apply(this,arguments)}return t})(),r.sendFrame=(function(){var t=n("asyncToGeneratorRuntime").asyncToGenerator(function*(t,r,a){var i=this.$11++%o("DGWConstants").MAX_ACK_ID,l=this.$15(r,!0,i);if(l==null)return!1;var s=new Uint8Array(t.length+l.length);if(s.set(t),s.set(l,t.length),!this.$16(s,!0,i))return!1;var u=yield this.$10.waitForAck(i,a!=null?a:o("DGWConstants").DEFAULT_ACK_TIMEOUT_MS);return this.__markerPoint(u?"ack_recevied":"ack_timeout"),u||(this.__endMarker(o("IDGWLoggingContext").QPLResult.FAIL),(e||(e=n("Promise"))).reject(o("DGWStream").StreamError.ACK_TIMEOUT))});function r(e,n,r){return t.apply(this,arguments)}return r})(),r.sendAndForget=function(t){var e=this.$15(t,!1,0);return this.$16(e,!1,0)},r.sendFrameAndForget=function(t,n){var e=this.$15(n,!1,0);if(e==null)return!1;var r=new Uint8Array(t.length+e.length);return r.set(t),r.set(e,t.length),this.$16(r,!1,0)},r.close=function(){var e=this.$2.encodeEndOfData(this.$1);if(e==null){this.$9.logError(o("IDGWLoggingContext").DGWLoggingComponent.GROUPED_STREAM_COMPONENT,"Failed to encode EndOfData","streamId: "+this.$1);return}var t=this.$8.send(e);if(!t){this.$9.logError(o("IDGWLoggingContext").DGWLoggingComponent.GROUPED_STREAM_COMPONENT,"Failed to send EndOfData","streamId: "+this.$1+". StreamGroupTransport not open during send");return}this.$12.endOfDataSent(),this.$5=!0,this.$4&&this.$17()},r.loggingContext=function(){return this.$9},r.__sendDrain=function(t){var e=o("DGWConstants").drainReasonToDrainReasonString(t);if(this.$5)return!1;var n=this.$2.encodeDrain(t);if(n==null)return!1;this.$12.drainSent(e);var r=this.$8.send(n);return r},r.__transportCloseHook=function(t){this.$13(),this.$10.clearPendingAcks(),t?(this.$12.error("Received StreamError","StreamErrorType: "+t),this.$6.onError(t)):this.$5&&this.$4?this.$17():(this.$12.streamClosed(!1,"Stream closed: ClosedLocally: "+this.$5.toString()+", EndOfDataReceived: "+this.$4.toString()),this.$6.onError(o("DGWStream").StreamError.PREMATURE_CLOSE))},r.$17=function(){this.$13(),this.$12.streamClosed(!0,"Graceful close"),this.$6.onClose(this)},r.__dataReceivedHook=function(t,n){this.$12.dataReceived(t.length,n!=null,n),n!=null&&this.$18(n),this.$6.onDataReceived(t)},r.__ackReceivedHook=function(t){this.$12.ackReceived(t),this.$10.handleAckReceived(t)},r.__drainReceivedHook=function(t){this.$3===!1&&(this.$6.onStreamMustDrain(this,t),this.$3=!0)},r.__endOfDataHook=function(){this.$12.endOfDataReceived(),this.$4=!0,this.$5?this.$17():this.$6.onServerHasFinishedSendingData(this)},r.__markerPoint=function(t){this.$9.qplMarkerPoint(o("IDGWLoggingContext").QPLEvent.STREAM_LIFECYCLE,t,this.$14)},r.__markerAnnotate=function(t){this.$9.qplMarkerAnnotate(o("IDGWLoggingContext").QPLEvent.STREAM_LIFECYCLE,t,this.$14)},r.__endMarker=function(t){this.$9.qplMarkerEnd(o("IDGWLoggingContext").QPLEvent.STREAM_LIFECYCLE,t,this.$14)},r.$15=function(t,n,r){return this.$2.encodeData(t,n,r,this.$1)},r.$16=function(t,n,r){if(this.__markerPoint("send_data_start"),this.$5)return this.$9.logError(o("IDGWLoggingContext").DGWLoggingComponent.GROUPED_STREAM_COMPONENT,"Failed to send data","Stream closed locally"),!1;if(t==null)return!1;var e=this.$8.send(t);return e?(this.__markerPoint("send_data_end"),this.$12.dataSent(t.length,n,r),!0):(this.$9.logError(o("IDGWLoggingContext").DGWLoggingComponent.GROUPED_STREAM_COMPONENT,"Failed to send data","ClosedLocally: "+this.$5.toString()),!1)},r.$18=function(t){var e=this.$2.encodeAck(t,this.$1);if(e==null)return this.$9.logError(o("IDGWLoggingContext").DGWLoggingComponent.GROUPED_STREAM_COMPONENT,"Failed to encode ACK","ackId: "+t),!1;var n=this.$8.send(e);return n?(this.$12.ackSent(t),!0):(this.$9.logError(o("IDGWLoggingContext").DGWLoggingComponent.GROUPED_STREAM_COMPONENT,"Failed to send ACK","ackId: "+t),!1)},t})();l.GroupedStream=s}),98); __d("NoOpDGWLoggingContext",["IDGWLoggingContext"],(function(t,n,r,o,a,i,l){"use strict";var e=(function(){function e(){}var t=e.prototype;return t.streamRequested=function(t){},t.streamClosed=function(t){},t.tabClosed=function(){},t.getGlobalState=function(){return{realtime:0,lightspeed:0}},e})(),s=new e,u=(function(){function e(){this.sgTransportId=null}var t=e.prototype;return t.getGlobalLogger=function(){return s},t.bumpODSKey=function(t,n,r){},t.logEvent=function(t,n,r,o,a){},t.logError=function(t,n,r,o,a,i,l){},t.logWarn=function(t,n,r,o,a){},t.qplMarkerStart=function(t,n){},t.qplMarkerEnd=function(t,n,r){},t.qplMarkerPoint=function(t,n,r){},t.qplMarkerAnnotate=function(t,n,r){},e})();l.DGWLoggingComponent=o("IDGWLoggingContext").DGWLoggingComponent,l.QPLEvent=o("IDGWLoggingContext").QPLEvent,l.QPLResult=o("IDGWLoggingContext").QPLResult,l.NoOpDGWLoggingContext=u}),98); __d("StreamIdGenerator",["err"],(function(t,n,r,o,a,i,l){"use strict";var e=65535,s=(function(){function t(){this.$1=new Set,this.$2=0}var n=t.prototype;return n.getNextStreamId=function(){var t;if(!this.streamIdAvailable())throw r("err")("Max number of stream IDs reached");if(this.$2<=e)return this.$2++;var n=(t=this.$1.values().next().value)!=null?t:0;return this.$1.delete(n),n},n.putBackStreamId=function(t){this.$1.add(t)},n.streamIdAvailable=function(){return this.$1.size>0||this.$2<=e},t})();l.MAX_STREAM_ID=e,l.StreamIdGeneratorImpl=s}),98); __d("StreamGroupWebSocketTransport",["DGWConstants","DGWExponentialBackoff","DGWPinger","DGWStream","DGWStreamGroupCallbacks","DGWTransportEvents","DGWUtils","DGWWebSocketTransport","GroupedStream","IDGWLoggingContext","NoOpDGWLoggingContext","Promise","Random","Run","StreamIdGenerator","asyncToGeneratorRuntime","err","getErrorSafe"],(function(t,n,r,o,a,i,l){"use strict";var e,s=!1,u=function(t,n,r,a,i){var e=this;this.groupedStream=t,this.$1=window.setTimeout(function(){r(o("DGWStream").StreamError.ESTABLISHMENT_TIMEOUT)},a),this.handleEstablishFrameReceived=function(){window.clearTimeout(e.$1),n(e.groupedStream)},this.abortStream=function(e){i(),r(e)}},c=(function(){function t(e,n,a,i,l,s,u,c,d){var m=this,p;this.$18=-1,this.$15=l,this.$17=this.__getStreamIdGenerator(),this.$5=new Map,this.$6=new Map,this.$7=i.keepAliveMs,this.$8=!1,this.$9=!1,this.$3=!0,this.$4=!1,this.$20=!1,this.$21=!1,this.$13=a,this.$11=new TextEncoder,this.$12=new TextDecoder,this.$14=i;var _={onDataReceived:function(){},handleAckReceived:function(){},receivedDrainSignal:function(t){m.$9||(m.$9=!0,m.$15(),m.$13.transportClosed(!0,""),m.$14.streamGroupCallbacks.onStreamGroupMustDrain(t),m.$5.forEach(function(e){e.__drainReceivedHook(t)}),m.onClose(o("DGWConstants").WebsocketCloseCodes.GRACEFUL_CLOSE))},onGroupedStreamDataReceived:function(t,n,r){if(m.$5.has(t)){var e=m.$5.get(t);e==null||e.__dataReceivedHook(n,r)}else m.$13.receivedFrameForInactiveStream("Data",t,"sendAckID: "+(r!=null?r:"null"))},onGroupedStreamAckReceived:function(t,n){if(m.$5.has(t)){var e=m.$5.get(t);e==null||e.__ackReceivedHook(n)}else m.$13.receivedFrameForInactiveStream("ACK",t,"ackId: "+(n!=null?n:"null"))},onGroupedStreamEndOfDataReceived:function(t){if(m.$5.has(t)){var e=m.$5.get(t);e==null||e.__endOfDataHook()}else m.$13.receivedFrameForInactiveStream("EndOfData",t)},onGroupedStreamEstablishStreamReceived:function(t,n){if(m.$6.has(t)){var e=m.$6.get(t);m.$6.delete(t);var r=JSON.parse(m.$12.decode(n));(r.code===void 0||r.code!==200)&&(e==null||e.abortStream(o("DGWStream").StreamError.ABNORMAL_CLOSURE)),e==null||e.handleEstablishFrameReceived()}else m.$13.receivedFrameForInactiveStream("EstablishStream",t,"EstablishStream received for non-inflight stream")},onPingReceived:function(){var e=m.$2.encodePing();e!=null&&m.send(e)},onPongReceived:function(){m.$3=!1,m.$21||(m.$21=!0,m.__markerPoint("auth_success")),m.$13.transportPongReceived("readyState:"+m.$1.readyState+", bufferedAmount:"+m.$1.bufferedAmount)}};this.$2=new(o("DGWUtils")).DGWCodec(s,_,i.dgwVersion),this.$19=Date.now()+(Math.round(o("Random").random()*1e4)+1e4),this.$22=s.getGlobalLogger(),this.$23=(p=i.connectTimeoutMs)!=null?p:2e4,this.$24=s,this.$25=d;var f=o("Run").onUnload(function(){m.$22.tabClosed()});if(i.enableFirstStreamOnWsHandshake){var g,h,y,C;if(u===void 0)throw r("err")("Missing grouped stream options");if(c===void 0)throw r("err")("Missing grouped stream callbacks");var b=this.$17.getNextStreamId(),v=this.createEstablishStreamFrame(b,u),S=o("DGWUtils").DGWUtils.constructConnectUrl({appId:i.appId,appVersion:i.appVersion,authType:i.authType,deviceId:(g=i.deviceId)!=null?g:void 0,dgwVersion:i.dgwVersion,fbId:i.fbId,tier:i.tier,loggingId:(h=i.loggingId)!=null?h:void 0,headers:t.__prefixAppHeaders(i.headers),endpoint:i.connectEndpoint,serviceId:i.serviceId,regionHint:(y=i.regionHint)!=null?y:void 0,establishStreamFrame:v,authToken:(C=i.authToken)!=null?C:void 0});if(this.$1=n(S),!S.includes(o("DGWConstants").HEADER_CONSTANTS.HEADER_ESTABLISH_STREAM_FRAME_BASE64))return;var R=this.$25!=null?this.$25(u.loggingId,u.disableFalcoLogging):new(o("NoOpDGWLoggingContext")).NoOpDGWLoggingContext,L=this.__createGroupedStream(b,c,u,R);this.$16=this.waitForEstablishStream(b,L,u,function(e){m.$5.set(b,e)},function(){m.$17.putBackStreamId(b)})}else this.$1=n(e);this.$22.streamRequested(i.serviceId),this.$24.qplMarkerStart(o("IDGWLoggingContext").QPLEvent.STREAM_GROUP_TRANSPORT,this.$19),this.__markerAnnotate({string:{serviceId:this.$14.serviceId,streamGroupId:this.$14.loggingId}})}var a=t.prototype;return a.send=function(t){try{return this.$1.send(t),!0}catch(e){return this.$13.transportError("Failed to send over transport","readyState: "+this.$1.readyState,r("getErrorSafe")(e).message),!1}},a.close=function(){var e;this.$22.streamClosed(this.$14.serviceId),this.__markerPoint("teardown"),this.$8=!0,(e=this.$10)==null||e.cancel(),this.$1.onopen=function(e){},this.$1.onmessage=function(e){},this.$1.onerror=function(e){},this.$1.onclose=function(e){},this.$15(),this.$1.close()},a.onClose=function(t){var e;this.$22.streamClosed(this.$14.serviceId),this.__markerPoint("abort"),this.__markerAnnotate({int:{abort_code:t}}),this.$8=!0,(e=this.$10)==null||e.cancel(),this.$1.close(t)},a.abort=function(t,n,r,o,a){this.$8||(this.$22.streamClosed(this.$14.serviceId),this.$8=!0,this.$13.transportClosed(!1,o,a),this.$5.forEach(function(e){e.__transportCloseHook(n)}),this.$6.forEach(function(e){e.abortStream(n)}),this.$14.streamGroupCallbacks.onStreamGroupError(t),this.$5.clear(),this.$6.clear(),this.$15(),this.onClose(r))},t.getTransportWithInitialStream=(function(){var e=n("asyncToGeneratorRuntime").asyncToGenerator(function*(e,n,r,a,i,l,s){yield o("DGWUtils").DGWCodec.initialize();var u=new(o("DGWTransportEvents")).DGWTransportEvents(a);u.transportEstablishmentPending();var c=function(){return t.$26("",r,u,i,a,e,n,s)};try{var d=yield o("DGWExponentialBackoff").callWithExponentialBackoff(c,l),m=s!=null?s(e.loggingId,e.disableFalcoLogging):new(o("NoOpDGWLoggingContext")).NoOpDGWLoggingContext,p=d.$16!=null?d.$16:d.establishGroupedStream(n,e,m);return{transport:d,streamPromise:p}}catch(e){throw e}});function r(t,n,r,o,a,i,l){return e.apply(this,arguments)}return r})(),t.getTransport_DEPRECATED=(function(){var e=n("asyncToGeneratorRuntime").asyncToGenerator(function*(e,n,r,a,i,l){yield o("DGWUtils").DGWCodec.initialize();var s=new(o("DGWTransportEvents")).DGWTransportEvents(r);s.transportEstablishmentPending();var u=function(){return t.$26(e,n,s,a,r,void 0,void 0,l)};try{return yield o("DGWExponentialBackoff").callWithExponentialBackoff(u,i)}catch(e){throw e}});function r(t,n,r,o,a,i){return e.apply(this,arguments)}return r})(),a.establishGroupedStream=(function(){var t=n("asyncToGeneratorRuntime").asyncToGenerator(function*(t,a,i,l,s,u){var c=this;s===void 0&&(s=!0);var d=this.getStreamId(),m=this.createEstablishStreamFrame(d,a),p=this.__createGroupedStream(d,t,a,i);p.__markerAnnotate({string:{serviceId:this.$14.serviceId,streamGroupId:this.$14.loggingId,streamId:a.streamTraceId}}),u!=null&&p.__markerAnnotate(u);var _=this.waitForEstablishStream(d,p,a,function(e){c.$5.set(d,e)},function(){c.$17.putBackStreamId(d)});if(l!=null){var f;p.__markerPoint("send_payload_start"),p.__markerAnnotate({int:{establishStreamPayloadSize:l.byteLength}});var g=(f=a.ackTimeoutMs)!=null?f:3e4,h=s?yield p.sendFrame(m,l,g):p.sendFrameAndForget(m,l);return h?(p.__markerPoint("send_payload_end"),p.__endMarker(o("IDGWLoggingContext").QPLResult.SUCCESS),(e||(e=n("Promise"))).resolve(p)):(p.__endMarker(o("IDGWLoggingContext").QPLResult.FAIL),(e||(e=n("Promise"))).reject("Failed to send data when establishing stream"))}if(p.__markerPoint("send_establish_stream_start"),!this.send(m))throw p.__endMarker(o("IDGWLoggingContext").QPLResult.FAIL),r("err")("Websocket connection closed before stream established");p.__markerPoint("send_establish_stream_end");var y=yield _;return p.__endMarker(o("IDGWLoggingContext").QPLResult.SUCCESS),y});function a(e,n,r,o,a,i){return t.apply(this,arguments)}return a})(),t.__prefixAppHeaders=function(t){return Object.keys(t).reduce(function(e,n){return e[""+o("DGWConstants").HEADER_CONSTANTS.APPHEADER_PREFIX+n]=t[n],e},{})},a.waitForEstablishStream=(function(){var t=n("asyncToGeneratorRuntime").asyncToGenerator(function*(t,r,o,a,i){var l=this;this.$13.streamEstablishmentPending(t,o.loggingId);try{var s=yield new(e||(e=n("Promise")))(function(e,n){l.$6.set(t,new u(r,e,n,3e4,function(){l.streamEndCallback(t)}))});return a(r),this.$13.streamEstablishmentSuccess(t,o.loggingId),s}catch(e){throw i(),this.$13.streamEstablishmentTimeout("Stream establishment timeout. readyState: "+this.$1.readyState,t,o.loggingId),e}});function r(e,n,r,o,a){return t.apply(this,arguments)}return r})(),t.$26=(function(){var e=n("asyncToGeneratorRuntime").asyncToGenerator(function*(e,n,r,a,i,l,s,u){var c=new t(e,o("DGWWebSocketTransport").getWebSocketConnection,r,n,a,i,l,s,u);c.$1.onmessage=t.$27(c),c.$1.onopen=function(){c.__markerPoint("onopen"),r.transportEstablished(e),c.$10!=null&&c.$10.cancel(),c.$7!=null&&(c.$10=new(o("DGWPinger")).DGWPinger(c.$7,function(){c.$28()},function(){c.abort(o("DGWStreamGroupCallbacks").DGWStreamGroupError.TRANSPORT_KEEPALIVE_TIMEOUT,o("DGWStream").StreamError.KEEPALIVE_TIMEOUT,o("DGWConstants").WebsocketCloseCodes.KEEPALIVE_TIMEOUT,"Aborting transport because of keepalive timeout","readyState:"+c.$1.readyState+", bufferedAmount:"+c.$1.bufferedAmount)},i))},c.$1.onerror=function(){c.__markerPoint("onerror"),c.$13.transportError("onerror","readyState: "+c.$1.readyState)},c.$1.onclose=t.$29(c);var d=yield t.getTransportPromise(c);return d});function r(t,n,r,o,a,i,l,s){return e.apply(this,arguments)}return r})(),t.getTransportPromise=(function(){var t=n("asyncToGeneratorRuntime").asyncToGenerator(function*(t){var r,a=new(e||(e=n("Promise")))(function(e,n){r=window.setTimeout(function(){t.$15(),t.$13.transportClosed(!1,"TIMEOUT"),t.__markerPoint("connect_timeout"),t.close(),n(o("DGWStream").StreamError.TRANSPORT_ESTABLISHMENT_TIMEOUT)},t.$23)}),i=new e(function(e,n){var r=t.$1.onerror,a=t.$1.onmessage,i=t.$1.onclose;t.$1.onerror=function(){r(),t.close(),n(o("DGWStream").StreamError.ESTABLISHMENT_ERROR)},t.$1.onclose=function(e){i(e),e.code===o("DGWConstants").WebsocketCloseCodes.UNAUTHORIZED?n(o("DGWStream").StreamError.UNAUTHORIZED):n(e.code+":"+e.reason)},t.$1.onmessage=function(n){a(n),t.$3||(t.__markerPoint("connect_success"),e(t))}});try{return yield(e||(e=n("Promise"))).race([i,a])}finally{r!=null&&window.clearTimeout(r)}});function r(e){return t.apply(this,arguments)}return r})(),t.$27=function(t){return function(e){var n;if(t.$2==null){var r;(r=t.$13)==null||r.transportError("Codec Not Ready","Received message before codec was initialized or after close");return}if(t.$20||(t.$20=!0,t.__markerPoint("onmessage")),(n=t.$10)==null||n.reset(),!(e.data instanceof ArrayBuffer)){var o;(o=t.$13)==null||o.transportError("Incorrect Data Protocol","Received "+typeof e.data+" instead of ArrayBuffer");return}t.$2.append(new Uint8Array(e.data)),t.$2.processData()}},t.$29=function(t){return function(e){var n,r=t.$22.getGlobalState();if(t.__markerPoint("onclose"),t.__markerAnnotate({string:{reason:e.reason},int:{code:e.code,realtimeWebSockets:r.realtime,lightspeedWebSockets:r.lightspeed}}),t.__endMarker(e.code===o("DGWConstants").WebsocketCloseCodes.GRACEFUL_CLOSE?o("IDGWLoggingContext").QPLResult.SUCCESS:o("IDGWLoggingContext").QPLResult.FAIL),(n=t.$10)==null||n.cancel(),!(t.$8===!0||t.$4)){if(t.$22.streamClosed(t.$14.serviceId),t.$8=!0,t.$3===!0){t.$13.transportEstablishmentFailure(e),t.$5.clear(),t.$15();return}if(t.$15(),t.$3=!0,e.code!==o("DGWConstants").WebsocketCloseCodes.GRACEFUL_CLOSE){t.$13.transportClosed(!1,"Websocket connection failure with code: "+e.code+" reason: "+e.reason+" wasClean: "+String(e.wasClean));var a=o("DGWStreamGroupCallbacks").DGWStreamGroupError.TRANSPORT_UNKNOWN_ERROR,i=o("DGWStream").StreamError.UNKNOWN_ERROR;switch(e.code){case o("DGWConstants").WebsocketCloseCodes.NORMAL_CLOSURE:a=o("DGWStreamGroupCallbacks").DGWStreamGroupError.TRANSPORT_NORMAL_CLOSURE,i=o("DGWStream").StreamError.ABNORMAL_CLOSURE;break;case o("DGWConstants").WebsocketCloseCodes.ABNORMAL_CLOSURE:a=o("DGWStreamGroupCallbacks").DGWStreamGroupError.TRANSPORT_ABNORMAL_CLOSURE,i=o("DGWStream").StreamError.ABNORMAL_CLOSURE;break;case o("DGWConstants").WebsocketCloseCodes.SERVER_INTERNAL_ERROR:a=o("DGWStreamGroupCallbacks").DGWStreamGroupError.TRANSPORT_SERVER_INTERNAL_ERROR,i=o("DGWStream").StreamError.SERVER_INTERNAL_ERROR;break;case o("DGWConstants").WebsocketCloseCodes.GOING_AWAY:a=o("DGWStreamGroupCallbacks").DGWStreamGroupError.TRANSPORT_GOING_AWAY,i=o("DGWStream").StreamError.GOING_AWAY;break;case o("DGWConstants").WebsocketCloseCodes.UNAUTHORIZED:a=o("DGWStreamGroupCallbacks").DGWStreamGroupError.TRANSPORT_UNAUTHORIZED,i=o("DGWStream").StreamError.UNAUTHORIZED;break;case o("DGWConstants").WebsocketCloseCodes.REJECTED:a=o("DGWStreamGroupCallbacks").DGWStreamGroupError.TRANSPORT_REJECTED,i=o("DGWStream").StreamError.REJECTED;break;case o("DGWConstants").WebsocketCloseCodes.BAD_REQUEST:a=o("DGWStreamGroupCallbacks").DGWStreamGroupError.TRANSPORT_BAD_REQUEST,i=o("DGWStream").StreamError.BAD_REQUEST;break;case o("DGWConstants").WebsocketCloseCodes.DGW_SERVER_ERROR:a=o("DGWStreamGroupCallbacks").DGWStreamGroupError.TRANSPORT_SERVER_INTERNAL_ERROR,i=o("DGWStream").StreamError.DGW_SERVER_ERROR,a=o("DGWStreamGroupCallbacks").DGWStreamGroupError.TRANSPORT_DGW_SERVER_ERROR;break;default:a=o("DGWStreamGroupCallbacks").DGWStreamGroupError.TRANSPORT_UNKNOWN_ERROR,i=o("DGWStream").StreamError.UNKNOWN_ERROR;break}t.$14.streamGroupCallbacks.onStreamGroupError(a),t.$5.forEach(function(e){e.__transportCloseHook(i)}),t.$6.forEach(function(e){e.abortStream(i)})}else t.$13.transportClosed(!0,""),t.$14.streamGroupCallbacks.onStreamGroupTransportClose(),t.$5.forEach(function(e){e.__transportCloseHook()}),t.$6.forEach(function(e){e.abortStream(o("DGWStream").StreamError.TRANSPORT_CLOSED_BEFORE_STREAM_INIT)});t.$5.clear(),t.$6.clear()}}},a.$28=function(){var e=this.$2.encodePing();if(e==null)throw r("err")("Failed to encode Ping Frame");var t=this.send(e);this.$18=this.$1.bufferedAmount,this.$13.transportPingSent("readyState:"+this.$1.readyState+", bufferedAmount:"+this.$18+", payloadSize:"+(e==null?void 0:e.byteLength)+", sent:"+String(t))},a.isClosedLocally=function(){return this.$3||this.$8||this.$4},a.streamEndCallback=function(t){this.$5.delete(t),this.$6.delete(t),this.$17.putBackStreamId(t)},a.canCreateGroupedStream=function(){return this.$17.streamIdAvailable()},a.createEstablishStreamFrame=function(n,a){var e=t.__prefixAppHeaders(a.groupedStreamHeaders);a.streamTraceId!=null&&(e[o("DGWConstants").HEADER_CONSTANTS.HEADER_STREAM_TRACE_ID]=a.streamTraceId);var i=this.$2.encodeEstablishStream(n,new Uint8Array(this.$11.encode(JSON.stringify(e))));if(i==null)throw this.$17.putBackStreamId(n),r("err")("Failed to encode EstablishStreamFrame");return i},a.getStreamId=function(){try{return this.$17.getNextStreamId()}catch(e){throw this.$13.ranOutOfStreamIds("inFlightGroupedStreamSize: "+this.$6.size+" groupedStreamSize: "+this.$5.size),e}},a.__createGroupedStream=function(t,n,r,a){var e=this;return new(o("GroupedStream")).GroupedStream(t,n,r,this,a,this.$2,function(){e.streamEndCallback(t)})},a.__getStreamIdGenerator=function(){return new(o("StreamIdGenerator")).StreamIdGeneratorImpl},a.__markerPoint=function(t){this.$24.qplMarkerPoint(o("IDGWLoggingContext").QPLEvent.STREAM_GROUP_TRANSPORT,t,this.$19)},a.__markerAnnotate=function(t){this.$24.qplMarkerAnnotate(o("IDGWLoggingContext").QPLEvent.STREAM_GROUP_TRANSPORT,t,this.$19)},a.__endMarker=function(t){this.$24.qplMarkerEnd(o("IDGWLoggingContext").QPLEvent.STREAM_GROUP_TRANSPORT,t,this.$19)},t})();l.StreamGroupWebSocketTransport=c}),98); __d("StreamGroup",["DGWConstants","DGWLoggingContext","DGWUtils","StreamGroupWebSocketTransport","asyncToGeneratorRuntime"],(function(t,n,r,o,a,i,l){"use strict";var e={maxRetries:0,baseRetryInterval:1e3,backoffFactor:Math.sqrt(2)},s=(function(){function t(e,t,n,r,a,i,l,s,u,c){var d,m,p,_,f,g,h,y,C;this.$2=u,this.$1=u.getNewStreamGroupId();var b=(d=l.overrideUrl)!=null?d:a;this.$6=null,this.$3={appId:e,appVersion:t,authType:(m=l.authType)!=null?m:n,deviceId:l.deviceId,dgwVersion:r,headers:l.streamGroupAppHeaders,tier:(p=l.serviceTier)!=null?p:o("DGWConstants").DEFAULT_SERVICE_TIER,connectEndpoint:b,fbId:i,loggingId:l.loggingId,serviceId:l.serviceId,streamGroupCallbacks:s,keepAliveMs:l.keepAliveMs,regionHint:l.regionHint,enableFirstStreamOnWsHandshake:!1,authToken:l.authToken,connectTimeoutMs:l.connectTimeoutMs},this.$4=l,this.$5=c,this.streamGroupLoggingContext=this.$5(null,!1,(_=l.verboseLoggingEnabled)!=null?_:!1),this.$7=o("DGWUtils").DGWUtils.constructConnectUrl({appId:this.$3.appId,appVersion:this.$3.appVersion,authType:this.$3.authType,deviceId:(f=this.$3.deviceId)!=null?f:void 0,dgwVersion:this.$3.dgwVersion,fbId:this.$3.fbId,headers:babelHelpers.extends({},this.$3.headers),loggingId:(g=this.$3.loggingId)!=null?g:void 0,tier:this.$3.tier,serviceId:this.$3.serviceId,endpoint:this.$3.connectEndpoint,regionHint:(h=this.$3.regionHint)!=null?h:void 0,trafficTracing:(y=this.$4.trafficTracing)!=null?y:void 0,authToken:(C=this.$4.authToken)!=null?C:void 0})}var r=t.prototype;return r.initTransport=(function(){var e=n("asyncToGeneratorRuntime").asyncToGenerator(function*(){var e=this,t={maxRetries:0,baseRetryInterval:1e3,backoffFactor:Math.sqrt(2)};this.$6=this.$6||o("StreamGroupWebSocketTransport").StreamGroupWebSocketTransport.getTransport_DEPRECATED(this.$7,this.$3,this.streamGroupLoggingContext,function(){e.$2.removeStreamGroupAndTransport(e.$1)},t,this.$5);var n;try{n=yield this.$6,this.$6=null}catch(e){throw this.$6=null,e}return this.$2.containsStreamGroup(this.$1)||this.$2.setStreamGroupAndTransport(this.$1,n),n});function t(){return e.apply(this,arguments)}return t})(),r.establishStream=(function(){var t=n("asyncToGeneratorRuntime").asyncToGenerator(function*(t,n,r,a,i){var l=this;if(this.$2.containsStreamGroup(this.$1)===!1)if(this.streamGroupLoggingContext.logEvent(o("DGWLoggingContext").DGWLoggingComponent.STREAM_GROUP_COMPONENT,"createTransportWhenEstablishStream"),this.$3.enableFirstStreamOnWsHandshake){var u=yield o("StreamGroupWebSocketTransport").StreamGroupWebSocketTransport.getTransportWithInitialStream(t,n,this.$3,this.streamGroupLoggingContext,function(){l.$2.removeStreamGroupAndTransport(l.$1)},e,this.$5);return this.$2.setStreamGroupAndTransport(this.$1,u.transport),u.streamPromise}else{this.$6=this.$6||o("StreamGroupWebSocketTransport").StreamGroupWebSocketTransport.getTransport_DEPRECATED(this.$7,this.$3,this.streamGroupLoggingContext,function(){l.$2.removeStreamGroupAndTransport(l.$1)},e,this.$5);var s;try{s=yield this.$6,this.$6=null}catch(e){throw this.$6=null,e}this.$2.containsStreamGroup(this.$1)||this.$2.setStreamGroupAndTransport(this.$1,s)}return this.establishStreamWithTransport(t,n,r,a,i)});function r(e,n,r,o,a){return t.apply(this,arguments)}return r})(),r.establishStreamWithTransport=(function(){var e=n("asyncToGeneratorRuntime").asyncToGenerator(function*(e,t,n,r,a){var i,l=e.loggingId;this.streamGroupLoggingContext.logEvent(o("DGWLoggingContext").DGWLoggingComponent.STREAM_GROUP_COMPONENT,"Establishing Grouped Stream","initialData:"+String(n!=null),!0,l);var s=this.$5(l,e.disableFalcoLogging,(i=e.verboseLoggingEnabled)!=null?i:!1),u=yield this.$2.getStreamGroupTransport(this.$1).establishGroupedStream(t,e,s,n,r,a);return u});function t(t,n,r,o,a){return e.apply(this,arguments)}return t})(),r.canCreateGroupedStream=function(){var e=!0;if(this.$2.containsStreamGroup(this.$1)!==!1){var t=this.$2.getStreamGroupTransport(this.$1);e=t.canCreateGroupedStream()}return o("DGWLoggingContext").DGWLoggingContext.bumpODSKey(o("DGWLoggingContext").DGWLoggingComponent.STREAM_GROUP_COMPONENT,e?"can_create":"cannot_create"),e},r.close=function(){if(this.$2.containsStreamGroup(this.$1)){var e=this.$2.getStreamGroupTransport(this.$1);e.close()}},t})();l.StreamGroup=s}),98); __d("StreamGroupRegistry",["Random","err"],(function(t,n,r,o,a,i,l){"use strict";var e=(function(){function e(){this.$1=new Map,this.$2=new Set}var t=e.prototype;return t.setStreamGroupAndTransport=function(t,n){this.$1.set(t,n)},t.containsStreamGroup=function(t){return this.$1.has(t)},t.removeStreamGroupAndTransport=function(t){this.$1.delete(t)},t.getStreamGroupTransport=function(t){var e=this.$1.get(t);if(e==null)throw r("err")("No stream group transport");return e},t.getNewStreamGroupId=function(){for(var e=o("Random").uint32();this.$2.has(e);)e=o("Random").uint32();return this.$2.add(e),e},e})();l.StreamGroupRegistry=e}),98); __d("RawDGWClient",["CurrentUser","DGWAuth","DGWLoggingContext","DGWStream","StreamGroup","StreamGroupRegistry","isFastRefreshEnabledForCurrentDomain"],(function(t,n,r,o,a,i,l){"use strict";var e=(function(){function e(e){var t=e.appId,n=e.appVersion,r=e.authToken,a=e.authType,i=e.dgwVersion,l=e.endpoint,s=e.fbId,u=e.isUserLoggedIn;this.$1=t,this.$2=n,this.$3=a,this.$5=i,this.$6=l,this.$7=s,this.$8=new(o("StreamGroupRegistry")).StreamGroupRegistry,this.$4=r,this.$9=u}var t=e.prototype;return t.$10=function(t){var e=this.$5,n=this.$7;return function(r,a,i){return new(o("DGWLoggingContext")).DGWLoggingContext(e,r,t,n,null,a!=null?a:!1,i!=null?i:!1)}},t.createStreamGroup=function(t,n){var e,r;this.handleUserChecks((e=n.authType)!=null?e:this.$3);var a=(r=n.authToken)!=null?r:this.$4;a!=null&&this.$3===o("DGWAuth").DGWAuth.GUEST&&(n.authToken=a);var i=this.$10(n.serviceId);return new(o("StreamGroup")).StreamGroup(this.$1,this.$2,this.$3,this.$5,this.$6,this.$7,n,t,this.$8,i)},t.handleUserChecks=function(t){var e=this.$9!=null?this.$9:r("CurrentUser").isLoggedInNow();if(!e&&o("DGWAuth").fromDGWAuthToString(t)!=="GUEST"&&!r("isFastRefreshEnabledForCurrentDomain")())throw o("DGWLoggingContext").DGWLoggingContext.bumpODSKey(o("DGWLoggingContext").DGWLoggingComponent.RAW_CLIENT,"unauthenticated"),o("DGWStream").StreamError.UNAUTHENTICATED},e})();l.RawDGWClient=e}),98); __d("DGWClient",["DGWAuth","DGWEnvUtil","DGWWebConfig","RawDGWClient","err"],(function(t,n,r,o,a,i,l){"use strict";var e,s=new(o("RawDGWClient")).RawDGWClient({appId:r("DGWWebConfig").appId,appVersion:r("DGWWebConfig").appVersion,authType:o("DGWAuth").fromStringToDGWAuth((e=r("DGWEnvUtil")).getDGWAuthType()),dgwVersion:e.getDGWVersion(),endpoint:e.getDGWEndpoint(),fbId:r("DGWWebConfig").fbId,authToken:e.getDGWAuthToken()});function u(){if(r("DGWEnvUtil").isDGWEnvCompatible())return s;throw r("err")("unsupported_environment_retry_with_mqtt")}l.default=u}),98); __d("DGWRequestStreamUtils",["Base64","WebDriverConfig","cr:3024","gkx"],(function(t,n,r,o,a,i,l){"use strict";function e(e,t,o,a){var i={};for(var l of Object.entries(e)){var s=l[0],u=l[1];typeof u=="string"?i["XRSS-"+s]=u:typeof u=="number"?i["XRSN-"+s]=u.toString():typeof u=="boolean"?i["XRSB-"+s]=u.toString():typeof u=="object"&&u!=null&&(i["XRSO-"+s]=r("Base64").encode(JSON.stringify(u)))}if(t&&(i["xrs-body"]="true"),o!=null&&o.length>0&&(i["xrs-instrumentation"]=r("Base64").encode(o)),i["XRS-Accept-Ack"]="RSAck",a!=null&&a.ackTimeoutSec!=null&&(i["XRS-SRAck-Timeout"]=a.ackTimeoutSec.toString()),i["XRSS-http_referer"]=window.location.href,r("WebDriverConfig").isTestRunning&&r("gkx")("20919")){var c=n("cr:3024")==null?void 0:n("cr:3024").get();c!=null&&(i["XRSB-is_test"]="true",i["XRSS-original_request_id"]=c)}return i}function s(e){return Object.keys(e).reduce(function(t,n){return(typeof e[n]=="string"||typeof e[n]=="boolean"||typeof e[n]=="number"||typeof e[n]=="object")&&(t[n]=e[n]),t},{})}function u(e){if(e.response&&e.response.instrumentation_data!=null&&e.response.instrumentation_data.length>0)try{var t,n=JSON.parse(new TextDecoder("utf-8").decode(e.response.instrumentation_data));return{auxId:n.auxId,dfTraceId:(t=n.dataFlowTracingData)==null?void 0:t.traceId}}catch(e){}return null}function c(e,t){var n=e.headers,r=e.body;if(t.kill_body===!0&&(r=null),t.new_body!=null&&(r=t.new_body),t.new_headers!=null)try{n=s(JSON.parse(t.new_headers))}catch(e){}if(t.patch_headers!=null)try{n=babelHelpers.extends({},n,s(JSON.parse(t.patch_headers)))}catch(e){}return{headers:n,body:r}}l.convertHeaders=e,l.cleanHeaders=s,l.getInstrumentationDataFieldsFromPayload=u,l.transformContextWithRewriteDelta=c}),98); __d("DGWStreamHandler",[],(function(t,n,r,o,a,i){"use strict";var e=(function(){function e(e,t,n,r,o){this.$2=e,this.$3=t,this.$4=n,this.$5=r,this.$6=o,this.$1=!0}var t=e.prototype;return t.onClose=function(t){this.$1&&this.$2(t)},t.onDataReceived=function(t){this.$1&&this.$3(t)},t.onError=function(t){this.$1&&this.$4(t)},t.onStreamMustDrain=function(t,n){this.$1&&this.$5(t,n)},t.onServerHasFinishedSendingData=function(t){this.$1&&this.$6(t)},t.stop=function(){this.$1=!1},t.isStopped=function(){return!this.$1},e})();i.default=e}),66); __d("InflightAmends",["Deferred","err"],(function(t,n,r,o,a,i,l){"use strict";var e="inflight_amends_timeout",s="inflight_amends_duplicate_id",u=(function(){function t(e,t,n){this.$1=e,this.$3=t,this.$4=n,this.$2=new Map}var n=t.prototype;return n.add=function(n){var t=this;if(this.$2.has(n))throw r("err")(s);var o=new(r("Deferred")),a=Date.now(),i=setTimeout(function(){t.$2.has(n)&&t.reject(n,r("err")(e))},this.$1);return this.$2.set(n,{id:n,deferred:o,createdTimestampMs:a,timeoutId:i}),o.getPromise()},n.getPromise=function(t){var e;return(e=this.$5(t))==null?void 0:e.deferred.getPromise()},n.resolve=function(t,n){var e=this.$5(t);e&&(e.deferred.resolve==null||e.deferred.resolve(n),this.$3(e.id,Date.now()-e.createdTimestampMs),this.$6(e))},n.reject=function(t,n){var e=this.$5(t);e&&(e.deferred.reject==null||e.deferred.reject(n),this.$4(e.id,n),this.$6(e))},n.rejectAll=function(t){for(var e of this.$2.entries()){var n=e[0],r=e[1];this.reject(n,t)}},n.getSize=function(){return this.$2.size},n.getAllPromises=function(){var e=[];for(var t of this.$2.values())e.push(t.deferred.getPromise());return e},n.$6=function(t){clearTimeout(t.timeoutId),this.$2.delete(t.id)},n.$5=function(t){return this.$2.get(t)},t})();l.default=u}),98); __d("RequestStreamCloseReason",["$InternalEnum"],(function(t,n,r,o,a,i){"use strict";var e=n("$InternalEnum").Mirrored(["UserIntention","StartStreamFailure","StreamError","RemoteTermination","ServerDataEnd","ServerDrain","ReestablishError","ClientError"]);i.RequestStreamCloseReason=e}),66); __d("RequestStreamCommonRequestStreamCommonSerializers",["RequestStreamCommonRequestStreamCommonTypes","ThriftTypes","jsbi"],(function(t,n,r,o,a,i,l){"use strict";var e;function s(){return{}}function u(){return{expected_existing_headers:"",patch_headers_if_match:""}}function c(){return{bytes:Uint8Array.of()}}function d(){return{message:""}}function m(){return{reason:o("RequestStreamCommonRequestStreamCommonTypes").TerminationReason.cast(0)}}function p(){return{}}function _(){return{stream_id:"0",last_sequencer:0,amendment_count:0,last_status:o("RequestStreamCommonRequestStreamCommonTypes").FlowStatus.cast(0)}}function f(){return{caller_timestamp_ms:"0"}}function g(){return{original_ping_timestamp_ms:"0"}}function h(){return{}}function y(t,n){n.writeStructBegin("ResponseRewriteRequest"),t.new_headers!=null&&(n.writeFieldBegin({fname:"new_headers",ftype:(e||(e=r("ThriftTypes"))).STRING,fid:1}),n.writeString(t.new_headers),n.writeFieldEnd()),t.new_body!=null&&(n.writeFieldBegin({fname:"new_body",ftype:(e||(e=r("ThriftTypes"))).STRING,fid:2}),n.writeBinary(t.new_body),n.writeFieldEnd()),t.patch_headers!=null&&(n.writeFieldBegin({fname:"patch_headers",ftype:(e||(e=r("ThriftTypes"))).STRING,fid:3}),n.writeString(t.patch_headers),n.writeFieldEnd()),t.kill_body!=null&&(n.writeFieldBegin({fname:"kill_body",ftype:(e||(e=r("ThriftTypes"))).BOOL,fid:4}),n.writeBool(t.kill_body),n.writeFieldEnd()),t.temporary!=null&&(n.writeFieldBegin({fname:"temporary",ftype:(e||(e=r("ThriftTypes"))).BOOL,fid:5}),n.writeBool(t.temporary),n.writeFieldEnd()),t.conditional_patch_headers!=null&&(n.writeFieldBegin({fname:"conditional_patch_headers",ftype:(e||(e=r("ThriftTypes"))).STRUCT,fid:6}),C(t.conditional_patch_headers,n),n.writeFieldEnd()),n.writeFieldStop(),n.writeStructEnd()}function C(t,n){if(n.writeStructBegin("ResponseRewriteConditionalPatchHeaders"),n.writeFieldBegin({fname:"expected_existing_headers",ftype:(e||(e=r("ThriftTypes"))).STRING,fid:1}),t.expected_existing_headers!=null)n.writeString(t.expected_existing_headers);else{var o="";n.writeString(o)}if(n.writeFieldEnd(),n.writeFieldBegin({fname:"patch_headers_if_match",ftype:e.STRING,fid:2}),t.patch_headers_if_match!=null)n.writeString(t.patch_headers_if_match);else{var a="";n.writeString(a)}n.writeFieldEnd(),t.patch_headers_otherwise!=null&&(n.writeFieldBegin({fname:"patch_headers_otherwise",ftype:(e||(e=r("ThriftTypes"))).STRING,fid:3}),n.writeString(t.patch_headers_otherwise),n.writeFieldEnd()),n.writeFieldStop(),n.writeStructEnd()}function b(t,n){if(n.writeStructBegin("ResponseData"),n.writeFieldBegin({fname:"bytes",ftype:(e||(e=r("ThriftTypes"))).STRING,fid:1}),t.bytes!=null)n.writeBinary(t.bytes);else{var o=Uint8Array.of();n.writeBinary(o)}n.writeFieldEnd(),t.metadata!=null&&(n.writeFieldBegin({fname:"metadata",ftype:(e||(e=r("ThriftTypes"))).STRING,fid:2}),n.writeString(t.metadata),n.writeFieldEnd()),n.writeFieldStop(),n.writeStructEnd()}function v(t,n){if(n.writeStructBegin("LogMessage"),n.writeFieldBegin({fname:"message",ftype:(e||(e=r("ThriftTypes"))).STRING,fid:1}),t.message!=null)n.writeString(t.message);else{var o="";n.writeString(o)}n.writeFieldEnd(),n.writeFieldStop(),n.writeStructEnd()}function S(t,n){if(n.writeStructBegin("Termination"),n.writeFieldBegin({fname:"reason",ftype:(e||(e=r("ThriftTypes"))).I32,fid:1}),t.reason!=null){var a;n.writeI32((a=t.reason)!=null?a:0)}else{var i=o("RequestStreamCommonRequestStreamCommonTypes").TerminationReason.cast(0);n.writeI32(i!=null?i:0)}n.writeFieldEnd(),t.message!=null&&(n.writeFieldBegin({fname:"message",ftype:(e||(e=r("ThriftTypes"))).STRING,fid:2}),n.writeString(t.message),n.writeFieldEnd()),t.retry_delay_ms!=null&&(n.writeFieldBegin({fname:"retry_delay_ms",ftype:(e||(e=r("ThriftTypes"))).I64,fid:3}),n.writeI64(r("jsbi").BigInt(t.retry_delay_ms)),n.writeFieldEnd()),n.writeFieldStop(),n.writeStructEnd()}function R(t,n){n.writeStructBegin("AmendStreamAck"),t.amendment_id!=null&&(n.writeFieldBegin({fname:"amendment_id",ftype:(e||(e=r("ThriftTypes"))).I64,fid:1}),n.writeI64(r("jsbi").BigInt(t.amendment_id)),n.writeFieldEnd()),t.accepted!=null&&(n.writeFieldBegin({fname:"accepted",ftype:(e||(e=r("ThriftTypes"))).BOOL,fid:2}),n.writeBool(t.accepted),n.writeFieldEnd()),t.result!=null&&(n.writeFieldBegin({fname:"result",ftype:(e||(e=r("ThriftTypes"))).STRING,fid:3}),n.writeBinary(t.result),n.writeFieldEnd()),n.writeFieldStop(),n.writeStructEnd()}function L(t,n){if(n.writeStructBegin("StreamCheck"),n.writeFieldBegin({fname:"stream_id",ftype:(e||(e=r("ThriftTypes"))).I64,fid:1}),t.stream_id!=null)n.writeI64(r("jsbi").BigInt(t.stream_id));else{var a="0";n.writeI64(r("jsbi").BigInt(a))}if(n.writeFieldEnd(),n.writeFieldBegin({fname:"last_sequencer",ftype:e.I32,fid:2}),t.last_sequencer!=null)n.writeI32(t.last_sequencer);else{var i=0;n.writeI32(i)}if(n.writeFieldEnd(),n.writeFieldBegin({fname:"amendment_count",ftype:e.I32,fid:4}),t.amendment_count!=null)n.writeI32(t.amendment_count);else{var l=0;n.writeI32(l)}if(n.writeFieldEnd(),n.writeFieldBegin({fname:"last_status",ftype:e.I32,fid:3}),t.last_status!=null){var s;n.writeI32((s=t.last_status)!=null?s:0)}else{var u=o("RequestStreamCommonRequestStreamCommonTypes").FlowStatus.cast(0);n.writeI32(u!=null?u:0)}n.writeFieldEnd(),n.writeFieldStop(),n.writeStructEnd()}function E(t,n){if(n.writeStructBegin("Ping"),n.writeFieldBegin({fname:"caller_timestamp_ms",ftype:(e||(e=r("ThriftTypes"))).I64,fid:1}),t.caller_timestamp_ms!=null)n.writeI64(r("jsbi").BigInt(t.caller_timestamp_ms));else{var o="0";n.writeI64(r("jsbi").BigInt(o))}if(n.writeFieldEnd(),t.streams_to_check!=null){n.writeFieldBegin({fname:"streams_to_check",ftype:(e||(e=r("ThriftTypes"))).LIST,fid:2}),n.writeListBegin({etype:e.STRUCT,size:t.streams_to_check.length});for(var a of t.streams_to_check)L(a,n);n.writeListEnd(),n.writeFieldEnd()}n.writeFieldStop(),n.writeStructEnd()}function k(t,n){if(n.writeStructBegin("Pong"),n.writeFieldBegin({fname:"original_ping_timestamp_ms",ftype:(e||(e=r("ThriftTypes"))).I64,fid:1}),t.original_ping_timestamp_ms!=null)n.writeI64(r("jsbi").BigInt(t.original_ping_timestamp_ms));else{var o="0";n.writeI64(r("jsbi").BigInt(o))}if(n.writeFieldEnd(),t.stream_ids_missing!=null){n.writeFieldBegin({fname:"stream_ids_missing",ftype:(e||(e=r("ThriftTypes"))).LIST,fid:2}),n.writeListBegin({etype:e.I64,size:t.stream_ids_missing.length});for(var a of t.stream_ids_missing)n.writeI64(r("jsbi").BigInt(a));n.writeListEnd(),n.writeFieldEnd()}if(t.stream_ids_behind!=null){n.writeFieldBegin({fname:"stream_ids_behind",ftype:(e||(e=r("ThriftTypes"))).LIST,fid:3}),n.writeListBegin({etype:e.I64,size:t.stream_ids_behind.length});for(var i of t.stream_ids_behind)n.writeI64(r("jsbi").BigInt(i));n.writeListEnd(),n.writeFieldEnd()}if(t.stream_ids_with_lost_amendments!=null){n.writeFieldBegin({fname:"stream_ids_with_lost_amendments",ftype:(e||(e=r("ThriftTypes"))).LIST,fid:4}),n.writeListBegin({etype:e.I64,size:t.stream_ids_with_lost_amendments.length});for(var l of t.stream_ids_with_lost_amendments)n.writeI64(r("jsbi").BigInt(l));n.writeListEnd(),n.writeFieldEnd()}if(t.stream_ids_with_wrong_status!=null){n.writeFieldBegin({fname:"stream_ids_with_wrong_status",ftype:(e||(e=r("ThriftTypes"))).LIST,fid:5}),n.writeListBegin({etype:e.I64,size:t.stream_ids_with_wrong_status.length});for(var s of t.stream_ids_with_wrong_status)n.writeI64(r("jsbi").BigInt(s));n.writeListEnd(),n.writeFieldEnd()}n.writeFieldStop(),n.writeStructEnd()}function I(t,n){if(n.writeStructBegin("StreamResponseDelta"),t.flow_status!=null){var o;n.writeFieldBegin({fname:"flow_status",ftype:(e||(e=r("ThriftTypes"))).I32,fid:1}),n.writeI32((o=t.flow_status)!=null?o:0),n.writeFieldEnd(),n.writeFieldStop(),n.writeStructEnd();return}if(t.log!=null){n.writeFieldBegin({fname:"log",ftype:(e||(e=r("ThriftTypes"))).STRUCT,fid:2}),v(t.log,n),n.writeFieldEnd(),n.writeFieldStop(),n.writeStructEnd();return}if(t.rewrite!=null){n.writeFieldBegin({fname:"rewrite",ftype:(e||(e=r("ThriftTypes"))).STRUCT,fid:3}),y(t.rewrite,n),n.writeFieldEnd(),n.writeFieldStop(),n.writeStructEnd();return}if(t.data!=null){n.writeFieldBegin({fname:"data",ftype:(e||(e=r("ThriftTypes"))).STRUCT,fid:4}),b(t.data,n),n.writeFieldEnd(),n.writeFieldStop(),n.writeStructEnd();return}if(t.termination!=null){n.writeFieldBegin({fname:"termination",ftype:(e||(e=r("ThriftTypes"))).STRUCT,fid:5}),S(t.termination,n),n.writeFieldEnd(),n.writeFieldStop(),n.writeStructEnd();return}if(t.amend_ack!=null){n.writeFieldBegin({fname:"amend_ack",ftype:(e||(e=r("ThriftTypes"))).STRUCT,fid:6}),R(t.amend_ack,n),n.writeFieldEnd(),n.writeFieldStop(),n.writeStructEnd();return}n.writeFieldStop(),n.writeStructEnd()}function T(t){var n={};for(t.readStructBegin();;){var o=t.readFieldBegin(),a=o.ftype,i=o.fid;if(a===(e||(e=r("ThriftTypes"))).STOP)break;switch(i){case 1:a===(e||(e=r("ThriftTypes"))).STRING?n.new_headers=t.readString():t.skip(a);break;case 2:a===(e||(e=r("ThriftTypes"))).STRING?n.new_body=t.readBinary():t.skip(a);break;case 3:a===(e||(e=r("ThriftTypes"))).STRING?n.patch_headers=t.readString():t.skip(a);break;case 4:a===(e||(e=r("ThriftTypes"))).BOOL?n.kill_body=t.readBool():t.skip(a);break;case 5:a===(e||(e=r("ThriftTypes"))).BOOL?n.temporary=t.readBool():t.skip(a);break;case 6:a===(e||(e=r("ThriftTypes"))).STRUCT?n.conditional_patch_headers=D(t):t.skip(a);break;default:t.skip(a)}t.readFieldEnd()}return t.readStructEnd(),n}function D(t){var n={};for(t.readStructBegin();;){var o=t.readFieldBegin(),a=o.ftype,i=o.fid;if(a===(e||(e=r("ThriftTypes"))).STOP)break;switch(i){case 1:a===(e||(e=r("ThriftTypes"))).STRING?n.expected_existing_headers=t.readString():t.skip(a);break;case 2:a===(e||(e=r("ThriftTypes"))).STRING?n.patch_headers_if_match=t.readString():t.skip(a);break;case 3:a===(e||(e=r("ThriftTypes"))).STRING?n.patch_headers_otherwise=t.readString():t.skip(a);break;default:t.skip(a)}t.readFieldEnd()}return t.readStructEnd(),n.expected_existing_headers===void 0&&(n.expected_existing_headers=""),n.patch_headers_if_match===void 0&&(n.patch_headers_if_match=""),n}function x(t){var n={};for(t.readStructBegin();;){var o=t.readFieldBegin(),a=o.ftype,i=o.fid;if(a===(e||(e=r("ThriftTypes"))).STOP)break;switch(i){case 1:a===(e||(e=r("ThriftTypes"))).STRING?n.bytes=t.readBinary():t.skip(a);break;case 2:a===(e||(e=r("ThriftTypes"))).STRING?n.metadata=t.readString():t.skip(a);break;default:t.skip(a)}t.readFieldEnd()}return t.readStructEnd(),n.bytes===void 0&&(n.bytes=Uint8Array.of()),n}function $(t){var n={};for(t.readStructBegin();;){var o=t.readFieldBegin(),a=o.ftype,i=o.fid;if(a===(e||(e=r("ThriftTypes"))).STOP)break;switch(i){case 1:a===(e||(e=r("ThriftTypes"))).STRING?n.message=t.readString():t.skip(a);break;default:t.skip(a)}t.readFieldEnd()}return t.readStructEnd(),n.message===void 0&&(n.message=""),n}function P(t){var n={};for(t.readStructBegin();;){var a=t.readFieldBegin(),i=a.ftype,l=a.fid;if(i===(e||(e=r("ThriftTypes"))).STOP)break;switch(l){case 1:i===(e||(e=r("ThriftTypes"))).I32?n.reason=o("RequestStreamCommonRequestStreamCommonTypes").TerminationReason.cast(t.readI32()):t.skip(i);break;case 2:i===(e||(e=r("ThriftTypes"))).STRING?n.message=t.readString():t.skip(i);break;case 3:i===(e||(e=r("ThriftTypes"))).I64?n.retry_delay_ms=t.readI64().toString():t.skip(i);break;default:t.skip(i)}t.readFieldEnd()}return t.readStructEnd(),n.reason===void 0&&(n.reason=o("RequestStreamCommonRequestStreamCommonTypes").TerminationReason.cast(0)),n}function N(t){var n={};for(t.readStructBegin();;){var o=t.readFieldBegin(),a=o.ftype,i=o.fid;if(a===(e||(e=r("ThriftTypes"))).STOP)break;switch(i){case 1:a===(e||(e=r("ThriftTypes"))).I64?n.amendment_id=t.readI64().toString():t.skip(a);break;case 2:a===(e||(e=r("ThriftTypes"))).BOOL?n.accepted=t.readBool():t.skip(a);break;case 3:a===(e||(e=r("ThriftTypes"))).STRING?n.result=t.readBinary():t.skip(a);break;default:t.skip(a)}t.readFieldEnd()}return t.readStructEnd(),n}function M(t){var n={};for(t.readStructBegin();;){var a=t.readFieldBegin(),i=a.ftype,l=a.fid;if(i===(e||(e=r("ThriftTypes"))).STOP)break;switch(l){case 1:i===(e||(e=r("ThriftTypes"))).I64?n.stream_id=t.readI64().toString():t.skip(i);break;case 2:i===(e||(e=r("ThriftTypes"))).I32?n.last_sequencer=t.readI32():t.skip(i);break;case 4:i===(e||(e=r("ThriftTypes"))).I32?n.amendment_count=t.readI32():t.skip(i);break;case 3:i===(e||(e=r("ThriftTypes"))).I32?n.last_status=o("RequestStreamCommonRequestStreamCommonTypes").FlowStatus.cast(t.readI32()):t.skip(i);break;default:t.skip(i)}t.readFieldEnd()}return t.readStructEnd(),n.stream_id===void 0&&(n.stream_id="0"),n.last_sequencer===void 0&&(n.last_sequencer=0),n.amendment_count===void 0&&(n.amendment_count=0),n.last_status===void 0&&(n.last_status=o("RequestStreamCommonRequestStreamCommonTypes").FlowStatus.cast(0)),n}function w(t){var n={};for(t.readStructBegin();;){var o=t.readFieldBegin(),a=o.ftype,i=o.fid;if(a===(e||(e=r("ThriftTypes"))).STOP)break;switch(i){case 1:a===(e||(e=r("ThriftTypes"))).I64?n.caller_timestamp_ms=t.readI64().toString():t.skip(a);break;case 2:if(a===(e||(e=r("ThriftTypes"))).LIST){n.streams_to_check=[];for(var l=t.readListBegin(),s=0;s0:n,a=h?m*p:void 0;this.shouldTerminateOrRetry(o("RequestStreamCloseReason").RequestStreamCloseReason.StreamError,e,r,a)},t.$38=function(t,n){this.shouldTerminateOrRetry(o("RequestStreamCloseReason").RequestStreamCloseReason.ServerDrain,n,!0)},t.$31=function(){return r("RtiWebRequestStreamClient").overrideHeaders},t.$23=function(){var e={};return r("gkx")("20918")&&(e.pending_amendments_size=this.$19.getSize().toString()),e},e})();l.default=v}),98); __d("DGWStreamGroupHandler",[],(function(t,n,r,o,a,i){"use strict";var e=(function(){function e(e,t,n){this.$1=e,this.$2=t,this.$3=n}var t=e.prototype;return t.onStreamGroupError=function(t){this.$1(t)},t.onStreamGroupMustDrain=function(t){this.$2(t)},t.onStreamGroupTransportClose=function(){this.$3()},e})();i.default=e}),66); __d("DGWStreamFactory",["DGWClient","DGWStreamGroupHandler","Promise","gkx","uuidv4"],(function(t,n,r,o,a,i,l){"use strict";var e,s="realtime",u=1e4,c=null,d=(function(){function t(){this.$1={}}t.get=function(){return c==null&&(c=new t),c};var o=t.prototype;return o.$2=function(t){this.$1[t]={dgwStreamGroup:null,multiStreamGroupLoggingId:null,multiStreamGroupPriorStreamCountGuess:0,authType:null}},o.getStreamGroupLoggingId=function(t){var e;return t===void 0&&(t=null),(e=this.$1[t!=null?t:s])==null?void 0:e.multiStreamGroupLoggingId},o.guessStreamGroupPriorStreamCount=function(t){var e;return t===void 0&&(t=null),((e=this.$1[t!=null?t:s])==null?void 0:e.multiStreamGroupPriorStreamCountGuess)||0},o.establishStream=function(o,a,i){var t=this,l=i.serviceId==null?s:i.serviceId,c=this.$1[l],d=c==null?void 0:c.dgwStreamGroup,m=c==null?void 0:c.authType,p=i.authType,_=d!=null&&m!==p;if(d==null||!d.canCreateGroupedStream()||_){var f={deviceId:i.deviceId,serviceId:l,disableFalcoLogging:i.disableFalcoLogging,streamGroupAppHeaders:{"stream-group":"group1"},authToken:i.authToken,authType:i.authType};i.overrideUrl!=null&&(f.overrideUrl=i.overrideUrl),f.keepAliveMs=u,r("gkx")("20920")&&(f.loggingId=r("uuidv4")());try{d=r("DGWClient")().createStreamGroup(new(r("DGWStreamGroupHandler"))(function(){t.$2(l)},function(){t.$2(l)},function(){t.$2(l)}),f),this.$1[l]={dgwStreamGroup:d,multiStreamGroupLoggingId:f.loggingId,multiStreamGroupPriorStreamCountGuess:0,authType:i.authType}}catch(t){return(e||(e=n("Promise"))).reject(t)}}return this.$1[l].multiStreamGroupPriorStreamCountGuess++,d.establishStream({loggingId:i.loggingId,disableFalcoLogging:i.disableFalcoLogging,groupedStreamHeaders:o},a)},t})();l.default=d}),98); __d("DGWRequestStreamClient",["DGWRequestStreamRef","DGWStreamFactory","Promise","uuidv4"],(function(t,n,r,o,a,i,l){"use strict";var e,s=(function(){function t(e){this.$1=e!=null?e:r("DGWStreamFactory").get()}var o=t.prototype;return o.createStream=function(o,a,i,l,s){var t=i;return(e||(e=n("Promise"))).resolve(new(r("DGWRequestStreamRef"))(o,a,l,s,t,this.$1))},t})();l.default=s}),98); __d("PromiseResult",["Promise"],(function(t,n,r,o,a,i){"use strict";var e,l=(function(){function t(){var t=this;this.promise=new(e||(e=n("Promise")))(function(e,n){t.$1=e,t.$2=n})}var r=t.prototype;return r.resolve=function(t){this.$1(t)},r.reject=function(t){this.$2(t)},t})();i.default=l}),66); __d("MqttFetchClient",["MqttEnv","MqttProtocolCodec","MqttUserName","MqttUtils","Promise","PromiseResult","getErrorSafe"],(function(t,n,r,o,a,i,l){"use strict";var e,s="fetch_pull",u="fetch_pull_finish",c="fetch_",d=6e4,m="action",p="chunked",_="send",f="true",g=5,h=20,y=10,C=5e3,b=typeof window!="undefined"?window:self,v=(function(){function t(){this.$1="",this.$2=o("MqttEnv").Env.getLoggerInstance(),this.$3=0,this.$4="",this.$5=new(r("MqttUserName"))("",0,1,"",0,!0),this.$6=function(){},this.$7=function(e){},this.$8=function(){},this.$9=function(e){},this.$10=0,this.$11=0,this.$12=0,this.$13=0,this.$14="Ready",this.$15=[],this.$16=[],this.$17=null,this.$18=!1,this.$19=0}t.isSupported=function(){return typeof b.fetch=="function"};var a=t.prototype;return a.run=function(t,n,r,a,i,l,s,u){var e=this;this.$1=o("MqttUtils").endpointWithSessionId(t,n),this.$3=n,this.$4=r,this.$5=a,this.$6=i,this.$7=l,this.$8=s,this.$9=u,o("MqttEnv").Env.setTimeout(function(){return e.$20()},0)},a.isTopicSupported=function(t){return!0},a.publish=function(t,n){return this.$21(t,n)},a.publishBinary=function(t,n){return this.$21(t,n)},a.$21=function(o,a){if(this.$14!=="ReceivingData")return this.$2.bumpCounter(c+"publish."+o+".invalidstate"),(e||(e=n("Promise"))).reject("not connected");this.$2.bumpCounter(c+"publish."+o+".publish");var t=new(r("PromiseResult")),i={topic:o,payload:a,promiseResult:t};return this.$15.push(i),this.$22(),t.promise},a.abort=function(){this.$6=function(){},this.$7=function(e){},this.$8=function(){},this.$9=function(e){}},a.$23=function(t){var e=this;t.forEach(function(t){e.$2.bumpCounter(c+"publish."+t.topic+".resolved"),t.promiseResult.resolve()}),this.$12+=t.length},a.$24=function(t,n){var e=this;t.forEach(function(t){e.$2.bumpCounter(c+"publish."+t.topic+".rejected"),t.promiseResult.reject(n)})},a.$25=function(t,n,r,o){var e=t.map(function(e){return e.topic}).join(",");this.$2.debugTrace("FetchClient","Fetch publish request failed. Publishes:"+e+", retry:"+r),this.$2.bumpCounter(c+"publish_request_failed"),this.$14!=="ReceivingData"||r===g?(this.$24(t,o),this.$18=!1,this.$2.bumpCounter(c+"publish_request_failed_final"),this.$22()):this.$26(t,n,r+1)},a.$27=function(t,n,r,o){if(!o.ok){if(this.$2.bumpCounter(c+"publish_request_failed.http."+o.status),o.status===409&&(this.$19++,this.$19>=y)){this.$2.bumpCounter(c+"409_reset"),this.$28(new Error("Too many 409 errors"));return}this.$25(t,n,r,this.$29(o));return}this.$2.bumpCounter(c+"publish_request_success");var e=t.map(function(e){return e.topic}).join(",");this.$2.debugTrace("FetchClient","Fetch publish request success. Publishes:"+e+", retry:"+r),this.$23(t),this.$18=!1,this.$22()},a.$22=function(){if(this.$14==="ReceivingData"&&!this.$18&&!(this.$15.length===0&&this.$16.length===0)){this.$18=!0;var e=this.$15.slice(0,h);this.$15=this.$15.slice(h,this.$15.length),this.$17!=null&&o("MqttEnv").Env.clearTimeout(this.$17),this.$17=null;var t=this.$16.slice(0,h);this.$16=this.$16.slice(h,this.$16.length),this.$26(e,t,0)}},a.$26=function(t,n,r){var e=this,a=t.map(function(e){return e.topic}).join(",");this.$2.debugTrace("FetchClient","Fetch publish request sent. Publishes:"+a+", retry:"+r);var i=o("MqttUtils").endpointWithExtraParameter(this.$1,m,_),l=t.map(function(e){return{topic:e.topic,payload:e.payload,qos:0,messageId:o("MqttEnv").Env.random()}}),s=this.$5.gen(this.$3,[],l,n);this.$2.bumpCounter(c+"publish_request"),o("MqttUtils").promiseDoneWithTimeout(b.fetch(i,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",referrer:"no-referrer",body:s,keepalive:!1}),function(o){return e.$27(t,n,r,o)},function(o){return e.$25(t,n,r,o)},d)},a.$30=function(t){var e=t.message;this.$2.debugTrace("FetchClient","Fetch request failed with error:"+e),this.$9(e),this.$31(!1,e),this.$2.bumpCounter(c+"error"),this.$14="Error"},a.$32=function(t){var e=this;this.$2.debugTrace("FetchClient","Fetch response data received");var n=o("MqttProtocolCodec").decodeByteMessages(new Uint8Array(t)),r=n.messages,a=r.filter(function(e){return e.messageType===o("MqttProtocolCodec").MESSAGE_TYPE.PINGREQ}),i=r.filter(function(e){return e.messageType===o("MqttProtocolCodec").MESSAGE_TYPE.PUBLISH}).map(function(t){if(!(t instanceof o("MqttProtocolCodec").WireMessage.Publish))return{};var n=t;return n.qos===1&&n.messageIdentifier!=null&&(e.$16.push(n.messageIdentifier),e.$17==null&&(e.$17=o("MqttEnv").Env.setTimeout(function(){e.$22()},C))),{topic:n.topic,payload:n.payloadMessage,qos:n.qos}});for(var l of i){var s;this.$2.bumpCounter(c+"response_"+((s=l.topic)!=null?s:"void"))}i&&i.length>0&&(this.$13+=i.length,this.$7(i)),a&&a.length>0&&this.$33()},a.$33=function(){this.$2.debugTrace("FetchClient","Got server ping request"),this.$2.bumpCounter(c+"ping")},a.$28=function(t){this.$2.debugTrace("FetchClient","Fetch request ended: "+t.toString()),this.$2.bumpCounter(c+"done"),this.$34(t.message),this.$8(),this.$14="Done"},a.$35=function(t,n,a){var e=this;if(a!=null)try{this.$32(a)}catch(e){this.$28(r("getErrorSafe")(e)),this.$2.bumpCounter(c+"dataDecodeException");return}if(n){this.$28(new Error("EOF"));return}o("MqttUtils").promiseDone(t.read(),function(n){var r=n.done,o=n.value;return e.$35(t,r,o)},function(t){return e.$28(t)})},a.$36=function(t){if(!t.ok){this.$2.bumpCounter(c+"error.http."+t.status),this.$30(this.$29(t));return}var e=t.body;if(!e){this.$30(new Error("Empty body"));return}var n=e.getReader();this.$6(),this.$2.bumpCounter(c+"success"),this.$31(!0,null),this.$11=Date.now(),this.$14="ReceivingData",this.$2.debugTrace("FetchClient","Fetch request success"),this.$35(n,!1,null)},a.$34=function(t){this.$2.eventLogPullFinish({pullEventName:u,sessionID:this.$3,duration:Date.now()-this.$11,errorMessage:t,publishReceived:this.$13,publishSent:this.$12})},a.$31=function(t,n){this.$2.eventLogPull({pullEventName:s,sessionID:this.$3,status:t,duration:Date.now()-this.$10,hostname:this.$1,errorMessage:n})},a.$20=function(){var e=this;if(this.$14==="Ready"){this.$2.debugTrace("FetchClient","Sending fetch request"),this.$2.bumpCounter(c+"request"),this.$10=Date.now();var t=o("MqttUtils").endpointWithExtraParameter(this.$1,p,f);o("MqttUtils").promiseDoneWithTimeout(b.fetch(t,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",referrer:"no-referrer",body:this.$4,keepalive:!1}),function(t){return e.$36(t)},function(t){return e.$30(t)},d)}},a.$29=function(t){return new Error("Http error, status="+t.status)},t})();l.default=v}),98); __d("MqttLongPollingClient",["MqttEnv","MqttProtocolCodec","MqttUserName","Promise","XHRRequest","getCrossOriginTransport","getErrorSafe"],(function(t,n,r,o,a,i,l){"use strict";var e,s=12e4,u="simple_pull",c="longpolling_",d=(function(){function t(){this.$3="",this.$4=0,this.$2=o("MqttEnv").Env.getLoggerInstance(),this.$1="Ready",this.$5="",this.$6=new(r("MqttUserName"))("",0,1,"",0,!0),this.$7=function(){},this.$8=function(e){},this.$9=function(){},this.$10=function(e){},this.$11=0,this.$12=null,this.$13=new Set(["/t_ms","/messenger_sync_get_diffs","/messenger_sync_create_queue","/webrtc","/rtc_multi"])}var a=t.prototype;return a.run=function(t,n,r,o,a,i,l,s){this.$3=t,this.$4=n,this.$5=r,this.$6=o,this.$7=a,this.$8=i,this.$9=l,this.$10=s,this.$14(this.$5)},a.isTopicSupported=function(t){return this.$13.has(t)},a.publish=function(r,o){return(e||(e=n("Promise"))).reject("not supported")},a.publishBinary=function(r,o){return(e||(e=n("Promise"))).reject("not supported")},a.abort=function(){this.$12!=null&&this.$12.abort("Disconnected")},a.$15=function(t,n){this.$1!==t&&(this.$1=t,t==="Error"&&n!=null&&this.$10(n),this.$2.debugTrace("LongPollingClient","_changeStatus : "+t))},a.$16=function(t){if(this.$1==="RequestSend"){if(!t){this.$17("EmptyResponse",null);return}this.$7(),this.$2.bumpCounter(c+"success"),this.$18(!0,null),this.$15("ResponseReceived");var e=o("MqttProtocolCodec").decodeByteMessages(new Uint8Array(t)),n=e.messages.filter(function(e){return e instanceof o("MqttProtocolCodec").WireMessage.Publish}).map(function(e){if(e instanceof o("MqttProtocolCodec").WireMessage.Publish){var t=e;return{topic:t.topic,payload:t.payloadMessage,qos:t.qos}}else return{}});this.$8(n),this.$9()}},a.$17=function(t,n){var e=n!=null?n.message:"null";this.$2.debugTrace("LongPollingClient Error","Poll failed with error:"+t+", errorMsg:"+e),this.$18(!1,t+":"+e),this.$2.bumpCounter(c+"error."+t),this.$15("Error",t)},a.$18=function(t,n){this.$2.eventLogPull({pullEventName:u,sessionID:this.$4,status:t,duration:Date.now()-this.$11,hostname:this.$3,errorMessage:n})},a.$14=function(t){var e=this;if(!(this.$1!=="Ready"||this.$12)){this.$2.bumpCounter(c+"request");try{this.$11=Date.now(),this.$12=new(r("XHRRequest"))(this.$3).setResponseType("arraybuffer").setRawData(t).setTransportBuilder(r("getCrossOriginTransport").withCredentials).setResponseHandler(function(t){return e.$16(t)}).setNetworkFailureHandler(function(t){e.$17("Network",t)}).setErrorHandler(function(t){e.$17("Error",t)}).setAbortHandler(function(t){e.$17("Abort",null)}).setTimeoutHandler(function(){e.$17("Timeout",null)}).setTimeout(s).send(),this.$15("RequestSend")}catch(e){this.$17("Error",r("getErrorSafe")(e))}}},t})();l.default=d}),98); __d("MqttLongPollingHookCollection",[],(function(t,n,r,o,a,i){"use strict";var e=(function(){function e(){this.$1=new Set}var t=e.prototype;return t.addHook=function(t){this.$1.add(t)},t.removeHook=function(t){this.$1.delete(t)},t.onPollRequestSent=function(){this.$1.forEach(function(e){e.onPollRequestSent()})},t.onPollRequestSuccess=function(){this.$1.forEach(function(e){e.onPollRequestSuccess()})},t.onPollResponse=function(t){this.$1.forEach(function(e){e.onPollResponse(t)})},t.onPollFinish=function(){this.$1.forEach(function(e){e.onPollFinish()})},t.onPollRequestFailed=function(t){this.$1.forEach(function(e){e.onPollRequestFailed(t)})},t.onPollShutdownAbort=function(){this.$1.forEach(function(e){e.onPollShutdownAbort()})},e})();i.default=e}),66); __d("exponentialBackoff",["MqttEnv"],(function(t,n,r,o,a,i,l){function e(e,t){t===void 0&&(t=null);var n=null,r=0;function a(){for(var a=arguments.length,i=new Array(a),l=0;l=s&&this.$25("LPError")},a.$29=function(){var e,t=(e=o("MqttEnv")).Env.genGk(e.MqttGkNames.mqtt_lp_no_delay),n=e.Env.genGk(e.MqttGkNames.mqtt_ws_polling_enabled),r=e.Env.genGk(e.MqttGkNames.mqtt_fast_lp);if(this.$5.debugTrace("LongPollingRunner","_shouldPoll? pollNow:"+String(t)+" enabled:"+String(n)+" fastPoll:"+String(r)+" hasWSSupport:"+String(this.$4)+" hasWsSuccessBefore:"+String(this.$1)+" failureCount:"+this.$2+" wsFatal:"+String(this.$3)),!n)return!1;if(t)return this.$5.bumpCounter(d+".nd"),!0;if(!this.$4)return this.$5.bumpCounter(d+".na"),!0;if(this.$3)return this.$5.bumpCounter(d+".fatal"),!0;if(this.$1)return!1;if(r){var a=Date.now()-this.$20;if(this.$21===p){if(this.$2>=1)return!0;if(a>u)return this.$5.bumpCounter(d+".fastdelay"),!0}else if(a>c)return this.$5.bumpCounter(d+".regulardelay"),!0}return this.$2>=3?(this.$5.bumpCounter(d+".failure"),!0):!1},a.$30=function(){if(this.$14!=null)return!1;var e=this.$29();return!this.$13&&e&&(this.$5.bumpCounter("polling_kickin"),this.$13=!0,this.$25("LPActive"),this.$27()),this.$13&&!e&&(this.$5.bumpCounter("polling_stopped"),this.$13=!1,this.$25("LPInactive"),this.$27()),e},a.$31=function(){return this.$22?(this.$5.debugTrace("LongPollingRunner","Creating polling client using Fetch API"),new(r("MqttFetchClient"))):(this.$5.debugTrace("LongPollingRunner","Creating regular Polling client"),new(r("MqttLongPollingClient")))},a.$32=function(){this.$5.debugTrace("LongPollingRunner","Poll success"),this.$19.onPollRequestSuccess(),this.$18.reset(),this.$25("LPActive"),this.$27(),o("MqttEnv").Env.configWrite(m,p),this.$26("ReceivingData")},a.$33=function(t){var e=t.map(function(e){return e.topic}).join(",");this.$5.debugTrace("LongPollingRunner","Poll response received, message received:"+e);for(var n of t)this.$19.onPollResponse(n.topic),this.$8(n.topic,n.payload,n.qos)},a.$34=function(){this.$5.debugTrace("LongPollingRunner","Poll finish"),this.$19.onPollFinish(),this.$14&&this.$14.abort(),this.$14=null,this.$23(),this.$26("NotSent")},a.$35=function(t){this.$19.onPollRequestFailed(t),this.$14&&this.$14.abort(),this.$14=null,this.$18(),this.$28(),this.$26("NotSent")},t})();l.default=f}),98); __d("PluginConnectButton",["Arbiter","CSS","DOM","DOMEvent","DOMEventListener","Focus","FormSubmit","PlatformWidgetEndpoint","Plugin","PluginOptin","URI"],(function(t,n,r,o,a,i){var e,l="new",s=n("Arbiter").subscribe,u=function(t,r){return n("DOMEventListener").add(t,"click",r)};function c(e){var t=this;this.config=e,this.busy=!1;var r=n("DOM").find(e.form,".pluginConnectButton");this.buttons=r,this.node_connected=n("DOM").find(r,".pluginConnectButtonConnected"),this.node_disconnected=n("DOM").find(r,".pluginConnectButtonDisconnected");var o=function(r){new(n("DOMEvent"))(r).kill(),t.busy||(t.submit(),t.busy=t.canpersonalize)};u(this.node_disconnected,o),e.buttontype===1?u(n("DOM").find(r,".pluginButtonX button"),o):e.buttontype===2&&u(this.node_connected,o),u(this.node_connected,function(e){return n("Arbiter").inform(n("Plugin").DIALOG,e)});var a=this.update.bind(this);s(n("Plugin").CONNECT,a,l),s(n("Plugin").DISCONNECT,a,l),s(n("Plugin").ERROR,this.error.bind(this),l)}Object.assign(c.prototype,{update:function(t,r){this.busy=!1;var e=this.config;if(r.identifier===e.identifier){var o=t===n("Plugin").CONNECT,a=n("PlatformWidgetEndpoint").plugins(e.plugin);a+="/"+(o?"disconnect":"connect"),n("CSS")[o?"show":"hide"](this.node_connected),n("CSS")[o?"hide":"show"](this.node_disconnected);try{if(document.activeElement.nodeName.toLowerCase()==="button"){var i=o?this.node_connected:this.node_disconnected,l=n("DOM").find(i,"button");l.disabled=!1,n("Focus").set(l)}}catch(e){}e.connected=o,e.form.setAttribute("action",a),e.form.setAttribute("ajaxify",a)}},error:function(t,r){if(this.busy=!1,r.action in{connect:1,disconnect:1}){n("DOM").setContent(this.buttons,r.content);var e=n("DOM").scry(this.buttons,".confirmButton");e.length===1&&n("Focus").set(e[0])}},submit:function(){if(!this.config.canpersonalize)return this.login();n("FormSubmit").send(this.config.form),this.fireStateToggle()},fireStateToggle:function(){var e=this.config;e.connected?n("Plugin").disconnect(e.identifier):n("Plugin").connect(e.identifier)},login:function(){var t=this.config.plugin;new(n("PluginOptin"))(t,(e||(e=n("URI"))).getRequestURI().getQueryData().api_key).addReturnParams({act:"connect"}).addLoginParams({social_plugin_action:this.config.pluginaction,kid_directed_site:this.config.kidDirectedSite}).start()}}),a.exports=c}),null);