;/*FB_PKG_DELIM*/ __d("CometEventListener",["unrecoverableViolation"],(function(a,b,c,d,e,f,g){"use strict";function h(a,b,d,e){if(a.addEventListener){a.addEventListener(b,d,e);return{remove:function(){a.removeEventListener(b,d,e)}}}else throw c("unrecoverableViolation")('Attempted to listen to eventType "'+b+'" on a target that does not have addEventListener.',"comet_ui")}a={bubbleWithPassiveFlag:function(a,b,c,d){return h(a,b,c,{capture:!1,passive:d})},capture:function(a,b,c){return h(a,b,c,!0)},captureWithPassiveFlag:function(a,b,c,d){return h(a,b,c,{capture:!0,passive:d})},listen:function(a,b,c){return h(a,b,c,!1)},registerDefault:function(a,b){throw c("unrecoverableViolation")("EventListener.registerDefault is not implemented.","comet_ui")},suppress:function(a){a.preventDefault(),a.stopPropagation()}};g["default"]=a}),98); __d("EventListenerImplForCacheStorage",["CometEventListener"],(function(a,b,c,d,e,f){"use strict";f["default"]=b("CometEventListener")}),66); __d("BladeRunnerConfig",["RTISubscriptionManagerConfig","WebDriverConfig","cr:3024","gkx","isEmpty"],(function(a,b,c,d,e,f,g){var h="javascript-sandbox",i="OverrideServer",j="www_sandbox",k="www_tier";a=function(){function a(){}var d=a.prototype;d.patchRequestHeaders=function(a){var d={},e=c("RTISubscriptionManagerConfig").bladerunner_www_sandbox,f=c("RTISubscriptionManagerConfig").is_intern;if(!c("isEmpty")(c("WebDriverConfig").auxiliaryServiceInfo)){var g;g=(g=c("WebDriverConfig").auxiliaryServiceInfo.BladeRunner)!=null?g:c("WebDriverConfig").auxiliaryServiceInfo["BladeRunner-sandcastle"];g!=null?(typeof g.ip_address==="string"?d[i]=g.ip_address+":18295":typeof g.hostname==="string"&&(d[i]=g.hostname+":18295"),typeof c("WebDriverConfig").originHost==="string"&&(d[j]="www."+c("WebDriverConfig").originHost)):e!=null&&(d[h]=e)}else e!=null&&(d[h]=e);f===!0&&(d[k]="intern");if(c("WebDriverConfig").isTestRunning&&c("gkx")("5639")){g=b("cr:3024")==null?void 0:b("cr:3024").get();g!=null&&(d.is_test="1",d.original_request_id=g)}c("gkx")("307")&&(d["Accept-Ack"]="RSAck");for(e in a)d[e]=a[e];d.http_referer=window.location.href;return d};return a}();d=new a();e=d;g["default"]=e}),98); __d("BladeRunnerLogger",["FBLogger","ODS"],(function(a,b,c,d,e,f,g){var h="bladerunner_js_client",i={info:"info",warning:"warning",exception:"exception"};a=function(){function a(){this.setFBLoggerLevel(1)}var b=a.prototype;b.info=function(a){this.$2>=2&&c("FBLogger")(h).info("BladeRunner info: %s",a),this.$3(i.info,a)};b.warn=function(a){this.$2>=1&&c("FBLogger")(h).warn("BladeRunner warn: %s",a),this.$3(i.warning,a)};b.exception=function(a,b){b===void 0&&(b="");var d=b+" "+a.toString();this.$2>=0&&c("FBLogger")(h).warn("BladeRunner exception: %s, %s",b,a.toString());this.$3(i.exception,d)};b.trimForLogging=function(a){var b=1024;return typeof a==="string"&&a.length>b?"[trimmed]:"+a.substring(0,b)+"...":a};b.bumpCounter=function(a,b){b===void 0&&(b=1),d("ODS").bumpEntityKey(2966,"BladeRunnerClient",a,b)};b.setClientSessionId=function(a){this.$1=a};b.setFBLoggerLevel=function(a){this.$2=a};b.$3=function(a,b){};return a}();b=new a();e=b;g["default"]=e}),98); __d("BladeRunnerStreamStatus",[],(function(a,b,c,d,e,f){"use strict";a={CREATED:0,ACCEPTED:1,REJECTED:2,STARTED:3,STOPPED:4,CLOSED:5};f.StreamStatus=a}),66); __d("BladeRunnerTypes",[],(function(a,b,c,d,e,f,g){a={REQUEST:1,DATA:2,DATA_ACK:3,STATUS_UPDATE:4,REWRITE_REQUEST:5,LOG:6};b={BLADE_RUNNER:1,GATEWAY:2};g.StreamFrameType=a;g.StreamRequestType=b}),98); __d("BladeRunnerTypesInternal",["Base64","BladeRunnerLogger","BladeRunnerTypes"],(function(a,b,c,d,e,f,g){var h=function(){function a(){}var b=a.prototype;b.getHeaders=function(){if(this.headers!=null)return this.headers;throw new Error("Expected headers")};b.getInstrumentationData=function(){if(this.instrumentationData!=null&&this.instrumentationData.length>0)try{return JSON.parse(this.instrumentationData)}catch(a){return null}else return null};b.updateRetryRequestPayload=function(a){a!=null?this.payload=c("Base64").encode(a):this.payload=null};a.readObject=function(b){var c=new a();c.streamId=o(b.streamId);c.requestType=o(b.requestType);c.payload=r(b.payload);c.headers=u(b.headers);c.extraHeader=r(b.extraHeader);c.requestTarget=r(b.requestTarget);c.instrumentationData=r(b.instrumentationData);return c};return a}(),i=function(){function a(){}a.readObject=function(b){var c=new a();c.streamId=o(b.streamId);c.dataId=p(b.dataId);c.data=r(b.data);c.shouldAck=w(b.shouldAck);return c};var b=a.prototype;b.rawData=function(){if(this.data==null)throw new Error("Expected data");return this.data};b.rawDataSize=function(){return this.data==null?0:this.data.length};b.decodeData=function(){if(this.data==null)throw new Error("Expected data");return c("Base64").decode(this.data)};b.setData=function(a){this.data=c("Base64").encode(a)};b.getInstrumentationData=function(){if(this.instrumentationData!=null)return JSON.parse(this.instrumentationData);else return null};return a}(),j=function(){function a(){}a.readObject=function(b){var c=new a();c.streamId=o(b.streamId);c.dataId=o(b.dataId);c.success=v(b.success);c.message=r(b.message);c.code=p(b.code);return c};return a}();j.ACK_CODE_LANDED_AND_ACCEPTED=20;j.ACK_CODE_LANDED_BUT_NOT_ACCEPTED=21;j.ACK_CODE_FAILED_TO_LAND=50;var k=function(){function a(){}a.readObject=function(b){var c=new a();c.streamId=p(b.streamId);c.message=r(b.message);return c};return a}(),l=function(){function a(){}a.readObject=function(b){var c=new a();c.streamId=o(b.streamId);c.status=o(b.status);c.message=r(b.message);c.code=p(b.code);c.shouldRetry=w(b.shouldRetry);c.retryDelayMs=p(b.retryDelayMs);return c};return a}(),m=function(){function a(){}a.readObject=function(b){var c=new a();c.streamId=o(b.streamId);c.newBody=r(b.newBody);c.newExtraHeader=r(b.newExtraHeader);c.patchExtraHeader=r(b.patchExtraHeader);c.killBody=w(b.killBody);c.temporary=w(b.temporary);return c};return a}(),n=function(){function a(){}var b=a.prototype;b.getRequest=function(){if(this.type==d("BladeRunnerTypes").StreamFrameType.REQUEST&&this.request!=null)return this.request;throw new Error("Expected request")};b.getData=function(){if(this.type==d("BladeRunnerTypes").StreamFrameType.DATA&&this.data!=null)return this.data;throw new Error("Expected data")};b.getDataAck=function(){if(this.type==d("BladeRunnerTypes").StreamFrameType.DATA_ACK&&this.dataAck!=null)return this.dataAck;throw new Error("Expected dataAck")};b.getStatusUpdate=function(){if(this.type==d("BladeRunnerTypes").StreamFrameType.STATUS_UPDATE&&this.statusUpdate!=null)return this.statusUpdate;throw new Error("Expected status update")};b.getLog=function(){if(this.type==d("BladeRunnerTypes").StreamFrameType.LOG&&this.log!=null)return this.log;throw new Error("Expected log")};b.getRewriteRequest=function(){if(this.type==d("BladeRunnerTypes").StreamFrameType.REWRITE_REQUEST&&this.rewriteRequest!=null)return this.rewriteRequest;throw new Error("Expected rewrite request")};b.getStreamId=function(){if(this.type==d("BladeRunnerTypes").StreamFrameType.REQUEST&&this.request!=null)return this.request.streamId;if(this.type==d("BladeRunnerTypes").StreamFrameType.DATA&&this.data!=null)return this.data.streamId;if(this.type==d("BladeRunnerTypes").StreamFrameType.STATUS_UPDATE&&this.statusUpdate!=null)return this.statusUpdate.streamId;if(this.type==d("BladeRunnerTypes").StreamFrameType.LOG&&this.log!=null)return this.log.streamId;if(this.type==d("BladeRunnerTypes").StreamFrameType.REWRITE_REQUEST&&this.rewriteRequest!=null)return this.rewriteRequest.streamId;if(this.type==d("BladeRunnerTypes").StreamFrameType.DATA_ACK&&this.dataAck!=null)return this.dataAck.streamId;throw new Error("Frame with unexpected type")};b.isInstrumented=function(){if(this.type===d("BladeRunnerTypes").StreamFrameType.REQUEST)return this.getRequest().instrumentationData!=null;else if(this.type===d("BladeRunnerTypes").StreamFrameType.DATA)return this.getData().instrumentationData!=null;else return!1};a.readObject=function(b){var e=new a();e.type=o(b.type);switch(e.type){case d("BladeRunnerTypes").StreamFrameType.REQUEST:e.request=h.readObject(s(b.request));break;case d("BladeRunnerTypes").StreamFrameType.DATA:e.data=i.readObject(s(b.data));break;case d("BladeRunnerTypes").StreamFrameType.DATA_ACK:e.dataAck=j.readObject(s(b.dataAck));break;case d("BladeRunnerTypes").StreamFrameType.STATUS_UPDATE:e.statusUpdate=l.readObject(s(b.statusUpdate));break;case d("BladeRunnerTypes").StreamFrameType.LOG:e.log=k.readObject(s(b.log));break;case d("BladeRunnerTypes").StreamFrameType.REWRITE_REQUEST:e.rewriteRequest=m.readObject(s(b.rewriteRequest));break;default:c("BladeRunnerLogger").warn("Frame with unexpected type: "+e.type);return null}return e};a.newRequestFrame=function(b){var c=new a();c.type=d("BladeRunnerTypes").StreamFrameType.REQUEST;c.request=b;return c};a.newDataFrame=function(b){var c=new a();c.type=d("BladeRunnerTypes").StreamFrameType.DATA;c.data=b;return c};a.newDataAckFrame=function(b){var c=new a();c.type=d("BladeRunnerTypes").StreamFrameType.DATA_ACK;c.dataAck=b;return c};a.newStatusUpdateFrame=function(b){var c=new a();c.type=d("BladeRunnerTypes").StreamFrameType.STATUS_UPDATE;c.statusUpdate=b;return c};a.newLogFrame=function(b){var c=new a();c.type=d("BladeRunnerTypes").StreamFrameType.LOG;c.log=b;return c};a.newRewriteRequestFrame=function(b){var c=new a();c.type=d("BladeRunnerTypes").StreamFrameType.REWRITE_REQUEST;c.rewriteRequest=b;return c};return a}();a=function(){function a(a,b,c){this.batchId=a,this.frames=b,this.instrumentationData=c}var b=a.prototype;b.getFrames=function(){if(this.frames!=null)return this.frames;throw new Error("Expected frames")};b.getInstrumentationData=function(){if(this.instrumentationData!=null)try{return JSON.parse(this.instrumentationData)}catch(a){return null}else return null};b.getInstrumentationDataDfTraceId=function(){if(this.instrumentationData!=null)try{var a=JSON.parse(this.instrumentationData);return(a=a.dataFlowTracingData)==null?void 0:a.traceId}catch(a){return null}else return null};b.write=function(){return JSON.stringify(this)};b.isInstrumented=function(){return this.getFrames().some(function(a){return a.isInstrumented()})};a.read=function(b){b=JSON.parse(b);var c=b.batchId||0,d=[];for(var e=b.frames,f=Array.isArray(e),g=0,e=f?e:e[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var h;if(f){if(g>=e.length)break;h=e[g++]}else{g=e.next();if(g.done)break;h=g.value}h=h;h=n.readObject(h);h!=null&&d.push(h)}h=b.instrumentationData||null;return new a(c,d,h)};return a}();function o(a){if(typeof a==="number")return a;throw new Error("Expected number")}function p(a){return a==null?null:o(a)}function q(a){if(typeof a==="string")return a;throw new Error("Expected string")}function r(a){return a==null?null:q(a)}function s(a){if(typeof a==="object"&&a!=null)return a;throw new Error("Expected object")}function t(a){if(typeof a==="object"&&a!=null){var b=a,c={};Object.keys(b).forEach(function(a){var d=b[a];typeof d==="string"&&d!=null&&(c[a]=d)});return c}throw new Error("Expected string map")}function u(a){return a==null?null:t(a)}function v(a){if(typeof a==="boolean"&&a!=null)return a;throw new Error("Expected boolean")}function w(a){return a==null?null:v(a)}g.GatewayStreamRequest=h;g.GatewayStreamData=i;g.GatewayStreamDataAck=j;g.GatewayStreamLog=k;g.GatewayStreamStatusUpdate=l;g.GatewayStreamRewriteRequest=m;g.GatewayStreamFrame=n;g.GatewayStreamBatch=a}),98); __d("RequestStreamE2EClientLoggerEvent",[],(function(a,b,c,d,e,f){a=Object.freeze({RECEIVED:"received",SENT:"sent",FAILURE:"failure",PUBACK:"puback"});f["default"]=a}),66); __d("RequestStreamE2EClientLoggerMessageType",[],(function(a,b,c,d,e,f){a=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"});f["default"]=a}),66); __d("BladeRunnerEventHandler",["BladeRunnerLogger","BladeRunnerStreamStatus","BladeRunnerTypes","BladeRunnerTypesInternal","RequestStreamE2EClientLoggerEvent","RequestStreamE2EClientLoggerMessageType","setTimeoutAcrossTransitions"],(function(a,b,c,d,e,f,g){var h=1e3;a=function(){function a(a,b,c){this.$2=a,this.$1=b,this.$3=c}var b=a.prototype;b.onProxyResponse=function(a){this.$4(a);var b=[];for(var e=a.getFrames(),f=Array.isArray(e),g=0,e=f?e:e[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var h;if(f){if(g>=e.length)break;h=e[g++]}else{g=e.next();if(g.done)break;h=g.value}h=h;this.$2.witnessFrame(h)&&b.push(h)}h=this.$2.getRequest();(g=h.e2eLogger)==null?void 0:g.logE2EEvent(c("RequestStreamE2EClientLoggerMessageType").RESPONSE,c("RequestStreamE2EClientLoggerEvent").SENT,{},(f=a.getInstrumentationData())==null?void 0:f.auxId,null,a.getInstrumentationDataDfTraceId());b.length>0&&this.$5(new(d("BladeRunnerTypesInternal").GatewayStreamBatch)(a.batchId,b,a.instrumentationData))};b.onDisconnect=function(){this.$2.resetErrors();var a=new(d("BladeRunnerTypesInternal").GatewayStreamStatusUpdate)();a.streamId=this.$2.getRequest().streamId;a.status=d("BladeRunnerStreamStatus").StreamStatus.CLOSED;a.shouldRetry=!0;a.retryDelayMs=0;a=new(d("BladeRunnerTypesInternal").GatewayStreamBatch)(null,[d("BladeRunnerTypesInternal").GatewayStreamFrame.newStatusUpdateFrame(a)]);this.onProxyResponse(a)};b.$4=function(a){var b=this;a=a.getFrames().filter(function(a){return a.type==d("BladeRunnerTypes").StreamFrameType.STATUS_UPDATE});for(var a=a,e=Array.isArray(a),f=0,a=e?a:a[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var g;if(e){if(f>=a.length)break;g=a[f++]}else{f=a.next();if(f.done)break;g=f.value}g=g;g=g.getStatusUpdate();if(g.status==d("BladeRunnerStreamStatus").StreamStatus.CLOSED||g.status==d("BladeRunnerStreamStatus").StreamStatus.REJECTED){this.$2.onError();var i=g.shouldRetry!=null&&g.shouldRetry,j=g.message!=null?g.message:"null";if(i&&this.$2.getErrorCount()<=this.$2.getRetriesAllowed()){g.status=d("BladeRunnerStreamStatus").StreamStatus.STOPPED;var k=h;g.retryDelayMs!=null&&(k=g.retryDelayMs);c("BladeRunnerLogger").info("Can retry: stream "+g.streamId+" closed with status "+g.status+", message "+j+". Error count: "+this.$2.getErrorCount()+", retryDelay "+k+"ms. Already retrying: "+this.$2.getRetryRequestScheduled().toString());this.$2.getRetryRequestScheduled()?c("BladeRunnerLogger").bumpCounter("stream_closed_already_retrying"):(c("BladeRunnerLogger").bumpCounter("stream_closed_will_retry"),this.$2.setRetryRequestScheduled(!0),k>0?c("setTimeoutAcrossTransitions")(function(){return b.$6()},k):this.$6())}else c("BladeRunnerLogger").info("Will not retry: stream "+g.streamId+" closed with status "+g.status+", message "+j+". Error count: "+this.$2.getErrorCount()+", shouldRetry "+i.toString()+". Already retrying: "+this.$2.getRetryRequestScheduled().toString()),i?c("BladeRunnerLogger").bumpCounter("stream_closed_retry_exceeded"):c("BladeRunnerLogger").bumpCounter("stream_closed_no_retry"),this.$3.removeStream(g.streamId)}}};b.$6=function(){this.$2.setRetryRequestScheduled(!1);if(this.$2.isAlive()){var a=this.$1.getUpdatedRequestBody();a!=null&&this.$2.updateRetryRequestPayload(a);this.$3.sendRetryStreamRequest(this.$2)}};b.$5=function(a){c("BladeRunnerLogger").bumpCounter("send_to_handler");var b=[];this.$1.onBatch(a);for(var a=a.getFrames(),e=Array.isArray(a),f=0,a=e?a:a[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var g;if(e){if(f>=a.length)break;g=a[f++]}else{f=a.next();if(f.done)break;g=f.value}g=g;try{switch(g.type){case d("BladeRunnerTypes").StreamFrameType.DATA:this.$1.onData(g.getData());b.push(g.getData());break;case d("BladeRunnerTypes").StreamFrameType.STATUS_UPDATE:this.$1.onStatusUpdate(g.getStatusUpdate().status);break;case d("BladeRunnerTypes").StreamFrameType.LOG:g=g.getLog().message;g!=null&&this.$1.onLog(g);break;case d("BladeRunnerTypes").StreamFrameType.DATA_ACK:break;default:throw new Error("Frame with unexpected type")}}catch(a){c("BladeRunnerLogger").bumpCounter("send_to_handler_error"),c("BladeRunnerLogger").exception(a,"Failed sending frame to stream handler")}}this.$7(b)};b.$7=function(a){var b=[];for(var c=0;c2?c-2:0),e=2;e1?d-1:0),f=1;f1?b-1:0),d=1;d0&&(this.thisTab.totalConnectionStreams--,this.$1())};b.tabClosed=function(){if(this.isTabClosed)return;this.isTabClosed=!0;var a={key:this.tabID,event:"DELETE"};this.broadcastChannel.emitRemote("count-updated",JSON.stringify(a))};b.getGlobalState=function(){var a={totalConnectionStreams:this.thisTab.totalConnectionStreams};this.otherTabs.forEach(function(b){a.totalConnectionStreams+=b.totalConnectionStreams});return a};b.$1=function(){var a={key:this.tabID,event:"UPDATE",value:this.thisTab};this.broadcastChannel.emitRemote("count-updated",JSON.stringify(a))};b.isEnabled=function(){return!0};return a}();var h=d("MqttEnv").Env.genGk(d("MqttEnv").MqttGkNames.mqttweb_global_connection_counter)?new a():{streamRequested:function(){},streamClosed:function(){},tabClosed:function(){},getGlobalState:function(){return{totalConnectionStreams:-1}},isEnabled:function(){return!1}};b=function(){return h};g.getInstance=b}),98); __d("MqttAnalyticsHook",["MqttEnv","MqttGlobalStreamCounter"],(function(a,b,c,d,e,f,g){"use strict";a=function(){function a(){this.$1=d("MqttEnv").Env.getLoggerInstance(),this.$2=d("MqttGlobalStreamCounter").getInstance(),this.$3=0,this.$4=0,this.$5=0,this.$6=0,this.$1.bumpCounter("session_start"),d("MqttEnv").Env.isUserLoggedInNow()||this.$1.bumpCounter("session_start.logout")}var b=a.prototype;b.onConnectAttempt=function(){this.$1.bumpCounter("ws_connect_attempt"),this.$2.streamRequested()};b.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()};b.onConnected=function(){this.$1.bumpCounter("ws_connect_connected")};b.onConnectSuccess=function(){this.$3===0&&this.$1.bumpCounter("ws_connect_first_success"),this.$3++,this.$1.bumpCounter("ws_connect_success")};b.onConnectionLost=function(){this.$1.bumpCounter("ws_disconnect")};b.onConnectionDisconnect=function(){this.$2.streamClosed()};b.onSubscribe=function(a){};b.onUnsubscribe=function(a){};b.onPublish=function(a){this.$1.bumpCounter("ws_publish."+a)};b.onMessage=function(a){this.$1.bumpCounter("message_arrived."+a)};b.onWSFatal=function(){this.$1.bumpCounter("ws_fatal")};b.onPollRequestSent=function(){this.$1.bumpCounter("polling_request_send"),this.$2.streamRequested()};b.onPollRequestSuccess=function(){this.$1.bumpCounter("polling_request_succeed"),this.$5===0&&this.$1.bumpCounter("polling_first_success"),this.$5++};b.onPollResponse=function(a){this.$1.bumpCounter("lp.message_arrived."+a)};b.onPollFinish=function(){this.$1.bumpCounter("polling_request_finish"),this.$2.streamRequested()};b.onPollRequestFailed=function(a){this.$1.bumpCounter("polling_request_failed"),this.$1.bumpCounter("polling_request_failed_"+a),this.$6++,this.$1.debugTrace("PollRequest","Request failed existing streams count "+this.$2.getGlobalState().totalConnectionStreams),this.$2.streamClosed()};b.onPollShutdownAbort=function(){this.$2.streamClosed()};b.onTabClose=function(){this.$2.tabClosed()};return a}();g["default"]=a}),98); __d("MqttConnectionHookCollection",[],(function(a,b,c,d,e,f){"use strict";a=function(){function a(){this.$1=new Set()}var b=a.prototype;b.addHook=function(a){this.$1.add(a)};b.removeHook=function(a){this.$1["delete"](a)};b.onConnectAttempt=function(){this.$1.forEach(function(a){a.onConnectAttempt()})};b.onConnectFailure=function(){this.$1.forEach(function(a){a.onConnectFailure()})};b.onConnected=function(){this.$1.forEach(function(a){a.onConnected()})};b.onConnectSuccess=function(){this.$1.forEach(function(a){a.onConnectSuccess()})};b.onConnectionLost=function(){this.$1.forEach(function(a){a.onConnectionLost()})};b.onConnectionDisconnect=function(){this.$1.forEach(function(a){a.onConnectionDisconnect()})};b.onSubscribe=function(a){this.$1.forEach(function(b){b.onSubscribe(a)})};b.onUnsubscribe=function(a){this.$1.forEach(function(b){b.onUnsubscribe(a)})};b.onPublish=function(a){this.$1.forEach(function(b){b.onPublish(a)})};b.onMessage=function(a){this.$1.forEach(function(b){b.onMessage(a)})};b.onWSFatal=function(){this.$1.forEach(function(a){a.onWSFatal()})};return a}();f["default"]=a}),66); __d("MqttProtocolUtils",["MqttEnv"],(function(a,b,c,d,e,f,g){function a(a,b){if(a==null)return b;var c=new Uint8Array(a.length+b.length);c.set(a);c.set(b,a.length);return c}function b(a,b){b=b;var c=0,d=1,e;do{if(b===a.length)return null;e=a[b++];c+=(e&127)*d;d*=128}while((e&128)!==0);return{value:c,offset:b}}function c(a){a=a;var b=new Array(1);for(var c=0;c<4;c++){var d=a%128;a>>=7;if(a>0)b[c]=d|128;else{b[c]=d;break}}return b}function h(a,b,c){c=c;b[c++]=a>>8;b[c++]=a%256;return c}function e(a,b){return 256*a[b]+a[b+1]}function f(a){var b=0;for(var c=0,d=a.length;c=55296&&e<=56319?(b+=4,c++):b+=3}return b}function i(a,b,c,d){d=h(b,c,d);j(a,c,d);return d+b}function j(a,b,c){c=c;for(var d=0,e=a.length;d>6,b[c++]=128|f&63):f<55296||f>=57344?(b[c++]=224|f>>12,b[c++]=128|f>>6&63,b[c++]=128|f&63):(f=65536+((f&1023)<<10|a.charCodeAt(++d)&1023),b[c++]=240|f>>18,b[c++]=128|f>>12&63,b[c++]=128|f>>6&63,b[c++]=128|f&63)}}function k(a,b,c){var d=[],e=b,f=0;while(e191&&g<224){var h=a[e++];d[f++]=String.fromCharCode((g&31)<<6|h&63)}else if(g>239&&g<365){h=a[e++];var i=a[e++],j=a[e++];h=((g&7)<<18|(h&63)<<12|(i&63)<<6|j&63)-65536;d[f++]=String.fromCharCode(55296+(h>>10));d[f++]=String.fromCharCode(56320+(h&1023))}else{i=a[e++];j=a[e++];d[f++]=String.fromCharCode((g&15)<<12|(i&63)<<6|j&63)}}return d.join("")}var l=function(){function a(a,b,c,d){this.$1=a,this.$2=b,this.$5=c,this.$6=d,this.$4=!1}var b=a.prototype;b.$7=function(){var a=this;this.$4?(this.$4=!1,this.$5(),this.$3=d("MqttEnv").Env.setTimeout(function(){a.$7()},this.$2()*1e3)):this.$6()};b.reset=function(){var a=this;this.$4=!0;this.$3&&(d("MqttEnv").Env.clearTimeout(this.$3),this.$3=null);var b=this.$1()*1e3;b>0&&(this.$3=d("MqttEnv").Env.setTimeout(function(){a.$7()},b))};b.cancel=function(){this.$3&&(d("MqttEnv").Env.clearTimeout(this.$3),this.$3=null)};return a}();g.UTF8Length=f;g.convertStringToUTF8=j;g.concatBuffers=a;g.decodeMultiByteInt=b;g.convertUTF8ToString=k;g.encodeMultiByteInt=c;g.writeUInt16BE=h;g.readUInt16BE=e;g.writeString=i;g.Pinger=l}),98); __d("MqttUtils",["MqttEnv"],(function(a,b,c,d,e,f,g){"use strict";var h={endpointWithSessionId:function(a,b){return h.endpointWithExtraParameter(a,"sid",b.toString())},endpointWithExtraParameters:function(a,b){var c=a;b.forEach(function(a,b,d){c=h.endpointWithExtraParameter(c,b,a)});return c},endpointWithExtraParameter:function(a,b,c){if(a.indexOf("?")>0)return a+"&"+b+"="+c;else return a+"?"+b+"="+c},generateSessionId:function(){return Math.floor(d("MqttEnv").Env.random()*Number.MAX_SAFE_INTEGER)},promiseDone:function(a,b,c){var e=arguments.length>1?a.then(b,c):a;e.then(null,function(a){d("MqttEnv").Env.setTimeout(function(){if(a instanceof Error)throw a;else throw new Error("promiseDone")},0)})},promiseDoneWithTimeout:function(a,b,c,e){var f=!1;d("MqttEnv").Env.setTimeout(function(){f||(f=!0,c(new Error("promise timeout")))},e);h.promiseDone(a,function(a){f||(f=!0,b(a))},function(a){f||(f=!0,c(a))})},sprintf:function(a){for(var b=arguments.length,c=new Array(b>1?b-1:0),d=1;d>4;b+=1;var i=d("MqttProtocolUtils").decodeMultiByteInt(a,b);if(i==null)return{wireMessage:null,position:e};b=i.offset;i=b+i.value;if(i>a.length)return{wireMessage:null,position:e};var j;switch(g){case h.CONNACK:e=a[b++];e=!!(e&1);var o=a[b++];j=new m(e,o);break;case h.PUBLISH:e=f&15;o=e>>1&3;f=d("MqttProtocolUtils").readUInt16BE(a,b);b+=2;var r=d("MqttProtocolUtils").convertUTF8ToString(a,b,f);b+=f;f=null;o===1&&(f=d("MqttProtocolUtils").readUInt16BE(a,b),b+=2);var s=p.createWithBytes(a.subarray(b,i)),t=(e&1)===1;e=(e&8)===8;j=new q(r,s,o,f,t,e);break;case h.PINGREQ:j=new k("PINGREQ");break;case h.PINGRESP:j=new k("PINGRESP");break;case h.PUBACK:case h.UNSUBACK:r=d("MqttProtocolUtils").readUInt16BE(a,b);j=new n(g===h.PUBACK?"PUBACK":"UNSUBACK",r);break;case h.SUBACK:s=d("MqttProtocolUtils").readUInt16BE(a,b);b+=2;o=a.subarray(b,i);j=new l(s,o);break;default:throw c("err")(d("MqttUtils").sprintf("Invalid MQTT message type %s.",g))}return{wireMessage:j,position:i}}function a(a){var b=[],c=0;while(c1||e===1&&f==null)throw new TypeError(d("MqttUtils").sprintf("Argument Invalid. qos: %s messageType: %s.",e,a));g.qos=e;g.messageIdentifier=f;return g}var c=a.prototype;c.encode=function(){var a=(this.messageType&15)<<4;a|=2;var b=d("MqttProtocolUtils").UTF8Length(this.topic),c=2+b+2;this.messageType===h.SUBSCRIBE&&(c+=1);var e=d("MqttProtocolUtils").encodeMultiByteInt(c);c=new ArrayBuffer(1+e.length+c);var f=new Uint8Array(c);f[0]=a;a=1;f.set(e,1);a+=e.length;this.messageIdentifier!=null&&(a=d("MqttProtocolUtils").writeUInt16BE(this.messageIdentifier,f,a));a=d("MqttProtocolUtils").writeString(this.topic,b,f,a);this.messageType===h.SUBSCRIBE&&this.qos!=null&&(f[a++]=this.qos);return c};return a}(b),p=function(){function a(a,b){this.payloadString=a,this.payloadBytes=b}a.createWithString=function(b){var c=new Uint8Array(new ArrayBuffer(d("MqttProtocolUtils").UTF8Length(b)));d("MqttProtocolUtils").convertStringToUTF8(b,c,0);return new a(b,c)};a.createWithBytes=function(b){var c=d("MqttProtocolUtils").convertUTF8ToString(b,0,b.length);return new a(c,b)};var b=a.prototype;b.string=function(){return this.payloadString};b.bytes=function(){return this.payloadBytes};return a}(),q=function(b){babelHelpers.inheritsLoose(a,b);function a(a,c,d,e,f,g){var h;h=b.call(this,"PUBLISH")||this;h.topic=a;h.payloadMessage=c;h.qos=d;h.messageIdentifier=e;h.retained=f!=null?f:!1;h.duplicate=g!=null?g:!1;if(h.qos===1&&h.messageIdentifier==null)throw new TypeError("Argument Invalid. messageIdentifier: null and qos: 1");return h}var c=a.prototype;c.encode=function(){var a=(this.messageType&15)<<4;this.duplicate&&(a|=8);a=a|=this.qos<<1;this.retained&&a!=1;var b=d("MqttProtocolUtils").UTF8Length(this.topic),c=b+2,e=this.qos===0?0:2;c+=e;e=this.payloadMessage.bytes();c+=e.byteLength;var f=d("MqttProtocolUtils").encodeMultiByteInt(c);c=new ArrayBuffer(1+f.length+c);var g=new Uint8Array(c);g[0]=a;g.set(f,1);a=1+f.length;a=d("MqttProtocolUtils").writeString(this.topic,b,g,a);this.qos!==0&&this.messageIdentifier!=null&&(a=d("MqttProtocolUtils").writeUInt16BE(this.messageIdentifier,g,a));g.set(e,a);return c};return a}(b),r=p.createWithString;b={Base:b,PubAckUnsubAck:n,Ping:k,ConnAck:m,Connect:f,Disconnect:e,Subscription:o,Publish:q};g.MESSAGE_TYPE=h;g.decodeMessage=j;g.decodeByteMessages=a;g.Message=p;g.createMessageWithString=r;g.WireMessage=b}),98); __d("MqttTypes",[],(function(a,b,c,d,e,f){"use strict";a=function(a,b,c){this.errorCode=a,this.errorName=b,this.errorMessage=c};b=Object.freeze({SOCKET_ERROR:new a(1,"SOCKET_ERROR","Socket error"),SOCKET_MESSAGE:new a(2,"SOCKET_MESSAGE","Unable to parse invalid socket message"),INVALID_DATA_TYPE:new a(3,"INVALID_DATA_TYPE","Received non-arraybuffer from socket."),CONNECT_TIMEOUT:new a(4,"CONNECT_TIMEOUT","Connect timed out"),CONNACK_FAILURE:new a(5,"CONNACK_FAILURE","Connection failure due to connack"),PING_TIMEOUT:new a(6,"PING_TIMEOUT","Ping timeout"),APP_DISCONNECT:new a(7,"APP_DISCONNECT","Disconnect initiated by app"),SERVER_DISCONNECT:new a(8,"SERVER_DISCONNECT","Disconnect message sent my server"),SOCKET_CLOSE:new a(9,"SOCKET_CLOSE","Socket connection closed"),RECONNECT:new a(10,"RECONNECT","Reconnecting"),BROWSER_CLOSE:new a(11,"BROWSER_CLOSE","Browser closed")});c=function(a,b){this.mqttError=a,this.connAck=b};d=function(a){babelHelpers.inheritsLoose(b,a);function b(b,c,d){d===void 0&&(d=null);c=a.call(this,c)||this;c.isRecoverable=b;c.originalError=d;return c}return b}(babelHelpers.wrapNativeSuper(Error));f.MqttError=a;f.MqttErrors=b;f.ConnectFailure=c;f.MqttChannelError=d}),66); __d("MqttProtocolClient",["MqttEnv","MqttProtocolCodec","MqttProtocolUtils","MqttTypes","err","qex"],(function(a,b,c,d,e,f,g){"use strict";var h=30,i=6e4;a=function(){function a(a){var b=this;this.$12=function(a,c,e){c===void 0&&(c=null);b.$9.bumpCounter("protocol.debug.disconnect.internal."+a.errorName);b.$9.bumpCounter("protocol.debug.disconnect.internal");var f=b.$5,g=b.$2,h=g.onConnectionLost,i=g.onConnectFailure;b.setConnected(!1);b.$14();f?d("MqttEnv").Env.scheduleCallback(function(){h(a,c)}):d("MqttEnv").Env.scheduleCallback(function(){i(b.$11,new(d("MqttTypes").ConnectFailure)(a,e!=null?e:-1),c)})};this.$13=function(a){var c=b.$6;if(c==null){b.$9.bumpCounter("protocol.socket_send.failed.socket_null.");return 0}if(c.readyState!==c.OPEN){b.$9.bumpCounter("protocol.socket_send.failed.socket_not_open.");return 0}a=a.encode();var d=a.byteLength;c.send(a);return d};this.$3=a;this.$2={userName:"",mqttVersion:3,getKeepAliveIntervalSeconds:function(){return 10},getKeepAliveTimeoutSeconds:function(){return 10},ignoreSubProtocol:!1,onConnectSuccess:function(a){},onConnectFailure:function(a,b,c){},onConnection:function(){},onConnectionLost:function(a,b){},onMessageArrived:function(a,b,c){},onMessageDelivered:function(a,b){}};this.$1="mqttwsclient";this.$4=0;this.$5=!1;this.$9=d("MqttEnv").Env.getLoggerInstance();this.$11=0}var b=a.prototype;b.connect=function(a){var b,e=this;if(this.$5)throw c("err")("Invalid state: connect - already connected");this.$2=a;this.setConnected(!1);this.$7!=null&&(d("MqttEnv").Env.clearTimeout(this.$7),this.$7=null);b=(b=c("qex")._("660"))!=null?b:h;this.$7=d("MqttEnv").Env.setTimeout(function(){e.$9.bumpCounter("protocol.error.connect.timeout"),e.$12(d("MqttTypes").MqttErrors.CONNECT_TIMEOUT)},b*1e3);this.$6=d("MqttEnv").Env.createSocket(this.$3);this.$6.binaryType="arraybuffer";this.$6.onopen=function(){e.setConnected(!0),e.$9.debugTrace("Socket-Open","MQTTProtocolClient Socket Open"),e.$11=e.$13(new(d("MqttProtocolCodec").WireMessage.Connect)(e.$1,a)),a.onConnection()};this.$6.onmessage=function(a){a=a.data;if(!(a instanceof ArrayBuffer)){e.$9.bumpCounter("protocol.error.onmessage.type");e.$12(d("MqttTypes").MqttErrors.INVALID_DATA_TYPE);return}try{a=new Uint8Array(a);e.$10!=null&&(a=d("MqttProtocolUtils").concatBuffers(e.$10,a),e.$9.bumpCounter("protocol.debug.usingMessagesBuffer"),delete e.$10,e.$10=null);a=d("MqttProtocolCodec").decodeByteMessages(a);var b=a.messages;e.$10=a.remaining;for(a=0;aq,c=this.$12>r;(b||c)&&(this.$12=0);this.$16!==0&&a<=q&&this.$10.bumpCounter("short_lived_session");c&&this.$10.bumpCounter("connection_attempt_limit")};e.$45=function(a,b,c,d,e,f,g,h,i,j){a?this.$14++:this.$15++;var k=Date.now();this.$10.eventLogConnect({sessionID:this.$9,connectionStatus:a,connectionState:this.mqttStateFromConnectionState(this.$11),ackReceived:b,duration:k-c,total_duration:k-d,hostname:this.$5,attemptNumber:this.$13,successTotal:this.$14,failTotal:this.$15,subscribedTopics:e,publishes:f,errorCode:i,errorMessage:j,osConnectivity:g,messageSizeBytes:h,disconnectCount:this.$23});a&&(this.$13=0)};e.$39=function(a,b,c,d,e,f,g,h){var i=a.mqttError;h=h!=null?i.errorMessage+" - "+h:i.errorMessage;this.$10.debugTrace("connect","Connect failed "+h);this.$10.bumpCounter("protocol.onconnectfailure");this.$6.getIsGuestAuthStringPresent()&&this.$10.bumpCounter("guestAuthentication.onconnectfailure");this.$27.onConnectFailure();this.$45(!1,a.connAck!==-1,b,c,d,e,f,g,i.errorCode,h);if(a.connAck!=null){this.$10.bumpCounter("protocol.connect_failure."+a.connAck);if(a.connAck===s){this.$47(p);return}}this.$47()};e.$41=function(a,b){var c=this;this.$10.bumpCounter("protocol.onconnection");this.$10.debugTrace("Connect","Socket established");this.$27.onConnected();this.$6.getIsGuestAuthStringPresent()&&this.$10.bumpCounter("guestAuthentication.onconnection");b.forEach(function(a){c.$27.onSubscribe(a)});a.forEach(function(a){c.$27.onPublish(a.topic)});this.$34("TransportConnected")};e.$40=function(a,b,c,d,e,f){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.$34("Connected"),this.$45(!0,!0,a,b,c,d,e,f),this.$49(c),this.$16=Date.now()};e.$42=function(a,b){this.$10.bumpCounter("protocol.onconnectionlost");this.$23++;if(a.errorCode){b=b!=null?a.errorMessage+" - "+b:a.errorMessage;this.$10.eventLogDisconnect({sessionID:this.$9,errorCode:a.errorCode,errorMessage:b,duration:Date.now()-this.$16,disconnectCount:this.$23})}this.$10.debugTrace("connect","connection lost");this.$27.onConnectionLost();this.$6.getIsGuestAuthStringPresent()&&this.$10.bumpCounter("guestAuthentication.onconnectionlost");this.$47()};e.$43=function(a,b,c){this.$10.bumpCounter("protocol.onmessagearrived");this.$6.getIsGuestAuthStringPresent()&&this.$10.bumpCounter("guestAuthentication.onmessagearrived");this.$10.debugTrace("onMessageArrived","Message received on "+a);this.$27.onMessage(a);try{this.$3(a,b,c)}catch(b){this.$10.logError(b,"Listener threw error"),this.$10.bumpCounter("listener_error."+a)}};e.$44=function(a,b){this.$10.bumpCounter("protocol.onmessagedelivered");a=b!=null?b:"null";this.$10.debugTrace("onMessageDelivered","Delivered Message {ID: "+a+"}");if(b==null)return;a=this.$24.get(b);if(a==null){this.$10.bumpCounter("protocol.message_with_unknown_id");return}this.$24["delete"](b);(b=a.listener)==null?void 0:b.onEvent(d("MqttPublishListener").MqttPublishEvent.ACKED);a.resolve();this.$10.bumpCounter("publish.ack_received")};e.$30=function(a){this.$10.bumpCounter("protocol.fail_all_unacked_publishes."+a),this.$24.forEach(function(b,e,f){(e=b.listener)==null?void 0:e.onEvent(d("MqttPublishListener").MqttPublishEvent.NOT_ACKED);b.reject(c("err")(a))}),this.$24.clear()};e.$49=function(a){var b=this,c=new Set(a);c.forEach(function(a){b.$17.has(a)||b.unsubscribe(a)});a=new Set(this.$17);a.forEach(function(a){c.has(a)||b.subscribe(a)})};e.$46=function(a,b){try{this.$10.bumpCounter("js_error_in_init");this.$10.bumpCounter(b+".error");this.$25=!0;var c=a?a.message:"error";this.$10.debugTrace("onError",b+": "+c);this.$2(a)}catch(a){this.$10.bumpCounter("js_error_in_error_logging"),this.$10.logError(a,"JS error while trying to log previous error")}};return a}();g["default"]=a}),98); __d("isFastRefreshEnabledForCurrentDomain",[],(function(a,b,c,d,e,f){"use strict";function a(){return!1}f["default"]=a}),66); __d("MqttChannel",["ChannelClientID","IrisSubscribeChecker","MqttAnalyticsHook","MqttConnection","MqttEnv","MqttPublishListener","MqttPublishTimeoutConfig","MqttTypes","MqttUserName","MqttUtils","Promise","Run","err","isFastRefreshEnabledForCurrentDomain","promiseDone","qex","requireDeferred"],(function(a,b,c,d,e,f,g){"use strict";var h=c("MqttPublishTimeoutConfig").mqttPublishTimeoutMs||60*1e3;a=function(){function a(a){var b=this,e=a.endpoint,f=a.pollingEndpoint,g=a.userFbid,h=a.appId,i=a.initialSubscribedTopics,j=a.capabilities,k=a.clientCapabilities,l=a.chatVisibility;l=l===void 0?!0:l;var m=a.guestAuthString;m=m===void 0?null:m;var n=a.phpOverride;n=n===void 0?"":n;var o=a.clientType;o=o===void 0?"websocket":o;var p=a.deviceId;p=p===void 0?c("ChannelClientID").getID():p;var q=a.pageId;q=q===void 0?null:q;a=a.assetIds;a=a===void 0?null:a;this.$11=d("MqttEnv").Env.getLoggerInstance();this.$11.setAppId(h);this.$12=new(c("MqttUserName"))(g,j,k,p,h,l,m,n,o,q,a);this.$1=e;this.$2=f;this.$5="Disconnected";this.$7="LPInactive";this.$6="Disconnected";this.$3=[];this.$4=new Set();this.$8=new Map();this.$9=new Map();this.$10=new(c("MqttConnection"))();this.$13=null;this.$16=new(c("MqttAnalyticsHook"))();this.$15=new Map();this.$14=[];if(!d("MqttEnv").Env.isUserLoggedInNow()&&!c("isFastRefreshEnabledForCurrentDomain")()&&(m==null||m=="")){this.$11.bumpCounter("logged_out_init");return}this.$10.addHook(this.$16);this.$10.addHook(new(c("IrisSubscribeChecker"))(function(){return b.$4.size>0}));this.$17(i);this.$18()}var e=a.prototype;e.$17=function(a){var b=this;if(this.$10.isRunning()){this.$19("run","Connection started calling run again");return}if(d("MqttEnv").Env.genGk(d("MqttEnv").MqttGkNames.mqtt_ws_polling_enabled)){var e=d("MqttEnv").Env.killswitch("MQTT_WS_FORCE_LONG_POLLING");if(e){this.$19("MqttChannel","Websocket disabled, will do long polling only");return}else if(!c("MqttUtils").hasWSSupport()){this.$19("MqttChannel","Websocket Unavailable, will do long polling only");this.$11.bumpCounter("ws_unavailable_polling");return}}this.$10.run({onStateChange:function(a){b.$20(a)},onJSError:function(a){b.$21(a)},onMessageReceived:function(a,c,d){b.$22(a,c,d)},endpoint:this.$1,mqttUserName:this.$12,subscribedTopics:a,extraConnectMessageProvider:function(){return b.$23()}});this.$24()};e.$24=function(){var a=this;d("Run").onUnload(function(){a.$10.onWindowUnload(),a.$25(d("MqttTypes").MqttErrors.BROWSER_CLOSE)})};e.shutdown=function(){this.$25(d("MqttTypes").MqttErrors.APP_DISCONNECT)};e.$25=function(a){this.$10&&this.$10.shutdown(a),this.$13&&this.$13.shutdown(),this.$16.onTabClose()};e.publish=function(a,b,e){e===void 0&&(e={qos:1,skipBuffer:!1});var f;e.qos===0?f=this.$26(a,b,e.listener):f=this.$27(a,b,e);c("MqttUtils").promiseDone(f,function(){},function(a){(a=e.listener)==null?void 0:a.onEvent(d("MqttPublishListener").MqttPublishEvent.PUBLISH_ERROR)});return f};e.$26=function(a,b,c){return this.$28(a,b,0,c,1,null)};e.$27=function(a,c,e){var f={resolve:function(){},reject:function(a){}},g=new(b("Promise"))(function(a,b){f.resolve=a,f.reject=b}),h=d("MqttEnv").Env.random();a={topic:a,payload:c,options:e,ack:f,publishToken:h,timeoutId:null,attempt:0,startTime:Date.now()};if(e.skipBuffer)if(this.$10.connectionState()==="Connecting"){this.$14.push(a);(c=e.listener)==null?void 0:c.onEvent(d("MqttPublishListener").MqttPublishEvent.QUEUED)}else this.$29(a);else{a.timeoutId=this.$30(h);this.$15.set(h,a);(c=e.listener)==null?void 0:c.onEvent(d("MqttPublishListener").MqttPublishEvent.QUEUED);this.$31(a)}return g};e.$29=function(a){a.attempt+=1,c("MqttUtils").promiseDone(this.$28(a.topic,a.payload,a.options.qos,a.options.listener,a.attempt,a.startTime),function(){a.ack.resolve()},function(b){a.ack.reject(b)})};e.$31=function(a){var b=this;a.attempt+=1;c("MqttUtils").promiseDone(this.$28(a.topic,a.payload,a.options.qos,a.options.listener,a.attempt,a.startTime),function(){return b.$32(a)},function(a){})};e.$28=function(a,b,e,f,g,h){var i=this,j,k,l=this.getConnectionState(),m=Date.now();!this.$10.canPublish()&&this.$13&&this.$13.canPublish()?(j=this.$13.publish(a,b,e),k="lp",f!=null&&(j=j.then(function(){return f.onEvent(d("MqttPublishListener").MqttPublishEvent.SENT)})),this.$11.bumpCounter("try_publish_lp")):(j=this.$10.publish(a,b,e,f),k="ws",this.$11.bumpCounter("try_publish_ws"));c("promiseDone")(j,function(){i.$11.eventLogOutgoingPublish({sessionID:i.$10.getSessionId(),topic:a,qos:e,payloadSizeBytes:b.length*2,success:!0,protocol:k,errorMessage:null,connectionState:l,thisAttemptStartTime:m,firstAttemptStartTime:h,attempt:g,disconnectCount:i.$10.getDisconnectCount()})},function(c){i.$11.eventLogOutgoingPublish({sessionID:i.$10.getSessionId(),topic:a,qos:e,payloadSizeBytes:b.length*2,success:!1,protocol:k,errorMessage:c!=null?c.toString():null,connectionState:l,thisAttemptStartTime:m,firstAttemptStartTime:h,attempt:g,disconnectCount:i.$10.getDisconnectCount()})});return j};e.subscribe=function(a,b){var c=this;this.$10.subscribe(a);var d=this.$8.get(a);!d?(d=[b],this.$8.set(a,d)):d.push(b);return function(){var d=c.$8.get(a)||[];d=d.filter(function(a){return a!==b});c.$8.set(a,d);d.length===0&&c.unsubscribeAll(a)}};e.subscribeBinary=function(a,b){var c=this;this.$10.subscribe(a);var d=this.$9.get(a);!d?(d=[b],this.$9.set(a,d)):d.push(b);return function(){var d=c.$9.get(a)||[];d=d.filter(function(a){return a!==b});c.$9.set(a,d);d.length===0&&c.unsubscribeAll(a)}};e.subscribeChannelEvents=function(a){this.$3.push(a)};e.unsubscribeChannelEvents=function(a){a=this.$3.indexOf(a);a>-1&&this.$3.splice(a,1)};e.registerExtraConnectPayloadProvider=function(a){var b=this;this.$19("MqttChannel","registerExtraConnectPayloadProvider called");this.$4.add(a);if(this.$10.isRunning()){a=a.getPublishMessages();a.forEach(function(a){b.publish(a.topic,a.payload,{qos:a.qos,skipBuffer:!0})})}};e.unregisterExtraConnectPayloadProvider=function(a){this.$4["delete"](a)};e.unsubscribeAll=function(a){this.$10.unsubscribe(a),this.$8["delete"](a),this.$9["delete"](a)};e.getConnectionState=function(){return this.$5};e.getLongPollingStatus=function(){return this.$7};e.getEndpoint=function(){return this.$1};e.addHook=function(a){this.$10.addHook(a)};e.removeHook=function(a){this.$10.removeHook(a)};e.testOnlyMessageReceived=function(a,b){this.$22(a,b,-1)};e.$33=function(a){var b=this.$15.get(a);b!=null&&b.timeoutId!=null&&d("MqttEnv").Env.clearTimeout(b.timeoutId);this.$15["delete"](a)};e.$30=function(a){var b,e=this;b=(b=c("qex")._("37"))!=null?b:h;return d("MqttEnv").Env.setTimeout(function(a){var b=e.$15.get(a);if(!b)return;var d=b.topic;e.$11.bumpCounter("publish_timeout."+d);e.$11.debugTrace("publish_timeout","Timeout publishing topic: "+d+" publishToken: "+a);e.$33(a);b.ack.reject(c("err")("Publish Timed Out"))},b,a)};e.$32=function(a){var b=a.publishToken,c=this.$15.get(b);if(!c)return;this.$33(b);a.ack.resolve();this.$11.debugTrace("publish_success","Topic: "+a.topic+" publishToken: "+a.publishToken);this.$11.bumpCounter("publish_success."+a.topic)};e.$22=function(a,b,c){var d=this.$8.get(a);this.$11.eventLogIncomingPublish({sessionID:this.$10.getSessionId(),topic:a,connectionState:this.getConnectionState(),qos:c,payloadSizeBytes:b.payloadString.length*2,disconnectCount:this.$10.getDisconnectCount()});if(!d)this.$11.debugTrace("_onMessageReceived",a+" being dropped, no listeners");else for(var d=d,e=Array.isArray(d),f=0,d=e?d:d[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var g;if(e){if(f>=d.length)break;g=d[f++]}else{f=d.next();if(f.done)break;g=f.value}g=g;try{g(b.payloadString)}catch(a){this.$11.logError(a,"Listener exception"),this.$11.bumpCounter("listener_error")}}g=this.$9.get(a);this.$11.eventLogIncomingPublish({sessionID:this.$10.getSessionId(),topic:a,connectionState:this.getConnectionState(),qos:c,payloadSizeBytes:b.payloadBytes.length,disconnectCount:this.$10.getDisconnectCount()});if(!g)this.$11.debugTrace("_onMessageReceived",a+" being dropped, no binary listeners");else for(f=g,e=Array.isArray(f),d=0,f=e?f:f[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){if(e){if(d>=f.length)break;c=f[d++]}else{d=f.next();if(d.done)break;c=d.value}a=c;try{a(b.payloadBytes)}catch(a){this.$11.logError(a,"Binary Listener exception"),this.$11.bumpCounter("listener_error")}}};e.$21=function(a){if(d("MqttEnv").Env.genGk(d("MqttEnv").MqttGkNames.mqtt_ws_polling_enabled)){a.isRecoverable?this.$11.bumpCounter("recoverable_error_skipped"):this.$11.bumpCounter("unrecoverable_error_skipped");return}a.isRecoverable?this.$11.bumpCounter("recoverable_error_not_skipped"):this.$11.bumpCounter("unrecoverable_error_not_skipped");this.$34(a)};e.$35=function(a){this.$34(a)};e.$34=function(a){for(var b=this.$3,c=Array.isArray(b),d=0,b=c?b:b[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var e;if(c){if(d>=b.length)break;e=b[d++]}else{d=b.next();if(d.done)break;e=d.value}e=e;e.onJSError&&e.onJSError(a)}};e.$36=function(){var a=this;this.$14.forEach(function(b){a.$29(b),a.$11.bumpCounter("publish_from_temp_buffer."+b.topic)});this.$14=[];this.$15.forEach(function(b,c,d){a.$31(b),a.$11.bumpCounter("publish_from_buffer."+b.topic)})};e.$20=function(a){a==="Connecting"?(this.$14.forEach(function(a){a.ack.reject(c("err")("Client Reconnecting - "+a.topic))}),this.$14=[]):a==="TransportConnected"&&this.$36(),this.$19("_changeState","Connection state = "+a),this.$37(a,this.$7)};e.$38=function(a,b){this.$13&&this.$13.canPublish()&&this.$36(),this.$19("_changeLPStatus","LP status = "+a+", LP Request status = "+b),this.$37(this.$6,a)};e.$37=function(a,b){var c=this.$10.mqttStateFromConnectionState(a);this.$13&&this.$13.canPublish()&&(c="Connected");this.$6=a;(c!==this.$5||b!=this.$7)&&(this.$5=c,this.$7=b,this.$39(c))};e.$39=function(a){for(var b=this.$3,c=Array.isArray(b),d=0,b=c?b:b[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var e;if(c){if(d>=b.length)break;e=b[d++]}else{d=b.next();if(d.done)break;e=d.value}e=e;e.onMQTTStateChanged(a)}};e.$23=function(){var a=this,b=[];this.$4.forEach(function(c){try{c=c.getPublishMessages();Array.prototype.push.apply(b,c)}catch(b){a.$11.logError(b,"ConnectPayload provider exception"),a.$11.bumpCounter("connectPayloadProvider_error")}});return b};e.$18=function(){var a=this;d("MqttEnv").Env.genGk(d("MqttEnv").MqttGkNames.mqtt_ws_polling_enabled)&&this.$2&&this.$2!=""&&c("requireDeferred")("MqttLongPollingRunner").__setRef("MqttChannel").onReady(function(b){b=new b(a.$2,a.$12,a.$10.hasFatal(),a.$10.hasConnectSuccess(),function(b,c,d){return a.$22(b,c,d)},function(){var b=Array.from(a.$8.keys()),c=Array.from(a.$9.keys());return Array.from(new Set(b.concat(c)))},function(){return a.$23()},function(b){a.$35(b)},function(b,c){a.$38(b,c)});b.start();a.$10.addHook(b);b.addHook(a.$16);a.$13=b;a.$11.debugTrace("MqttChannel","longPollingRunner loaded")})};e.$19=function(a,b){this.$11.debugTrace(a,"Mqtt channel: "+b)};e.setForegroundState=function(a){this.$12&&this.$12.setForegroundState(a)};e.setChatVisibility=function(a){this.$12&&this.$12.setChatVisibility(a)};e.getEndpointCapabilities=function(){return this.$12.getEndpointCapabilities()};e.setEndpointCapabilities=function(a){this.$12.setEndpointCapabilities(a)};return a}();f.exports=a}),34); __d("MqttUnifiedClientConnectFalcoEvent",["FalcoLoggerInternal","getFalcoLogPolicy_DO_NOT_USE"],(function(a,b,c,d,e,f,g){"use strict";a=c("getFalcoLogPolicy_DO_NOT_USE")("1744057");b=d("FalcoLoggerInternal").create("mqtt_unified_client_connect",a);e=b;g["default"]=e}),98); __d("MqttUnifiedClientDisconnectFalcoEvent",["FalcoLoggerInternal","getFalcoLogPolicy_DO_NOT_USE"],(function(a,b,c,d,e,f,g){"use strict";a=c("getFalcoLogPolicy_DO_NOT_USE")("1744058");b=d("FalcoLoggerInternal").create("mqtt_unified_client_disconnect",a);e=b;g["default"]=e}),98); __d("MqttUnifiedClientIncomingPublishFalcoEvent",["FalcoLoggerInternal","getFalcoLogPolicy_DO_NOT_USE"],(function(a,b,c,d,e,f,g){"use strict";a=c("getFalcoLogPolicy_DO_NOT_USE")("1744059");b=d("FalcoLoggerInternal").create("mqtt_unified_client_incoming_publish",a);e=b;g["default"]=e}),98); __d("MqttUnifiedClientOutgoingPublishFalcoEvent",["FalcoLoggerInternal","getFalcoLogPolicy_DO_NOT_USE"],(function(a,b,c,d,e,f,g){"use strict";a=c("getFalcoLogPolicy_DO_NOT_USE")("1744060");b=d("FalcoLoggerInternal").create("mqtt_unified_client_outgoing_publish",a);e=b;g["default"]=e}),98); __d("generateLiteTypedLogger",["Banzai","JstlMigrationFalcoEvent","getDataWithLoggerOptions"],(function(a,b,c,d,e,f,g){"use strict";function h(a,b,d){var e=a.split(":")[0],f=a.split(":")[1];e=="logger"?c("JstlMigrationFalcoEvent").log(function(){return{logger_config_name:f,payload:b}}):c("Banzai").post(a,b,d)}function a(a){return{log:function(b,d){h(a,c("getDataWithLoggerOptions")(b,d),c("Banzai").BASIC)},logVital:function(b,d){h(a,c("getDataWithLoggerOptions")(b,d),c("Banzai").VITAL)},logImmediately:function(b,d){h(a,c("getDataWithLoggerOptions")(b,d),{signal:!0})}}}g["default"]=a}),98); __d("MqttWsClientTypedLoggerLite",["generateLiteTypedLogger"],(function(a,b,c,d,e,f){"use strict";e.exports=b("generateLiteTypedLogger")("logger:MqttWsClientLoggerConfig")}),null); __d("MqttLogger",["ChannelClientID","FBLogger","Log","LogHistory","MqttEnv","MqttGlobalStreamCounter","MqttUnifiedClientConnectFalcoEvent","MqttUnifiedClientDisconnectFalcoEvent","MqttUnifiedClientIncomingPublishFalcoEvent","MqttUnifiedClientOutgoingPublishFalcoEvent","MqttWsClientTypedLoggerLite","NetworkStatus","ODS","Random","gkx"],(function(a,b,c,d,e,f,g){"use strict";var h="mqtt_client",i=100,j="WEBSOCKET",k=typeof window!=="undefined"?window:self,l=null,m={CONNECT:"mqtt_client_connect",DISCONNECT:"mqtt_client_disconnect",PUBLISH:"mqtt_client_publish",CLIENT_ERROR:"mqtt_client_error",PUBLISH_TIMEOUT:"mqtt_qos1_publish_timeout",SOCKET_DISCONNECT:"mqtt_protocol_error"},n={CONNECT:"connect",DISCONNECT:"disconnect",OUTGOING_PUBLISH:"outgoing_publish",INCOMING_PUBLISH:"incoming_publish"};a=function(){a.getInstance=function(){l||(l=new a());return l};function a(){this.$1=d("LogHistory").getInstance(h),this.$2=0,this.$3=c("gkx")("778292"),this.$4=Date.now(),this.$5=c("ChannelClientID").getID(),this.$7(),this.$6=d("MqttGlobalStreamCounter").getInstance(),this.$6.isEnabled()||(this.$6=null)}var b=a.prototype;b.setAppId=function(a){this.$2===0&&(this.$2=a)};b.eventLogConnect=function(a){var b=a.sessionID,d=a.connectionStatus,e=a.connectionState,f=a.ackReceived,g=a.duration,h=a.total_duration,i=a.hostname,k=a.attemptNumber,l=a.successTotal,o=a.failTotal;a.subscribedTopics;a.publishes;var p=a.osConnectivity;a.errorCode;var q=a.errorMessage,r=a.messageSizeBytes;a=a.disconnectCount;d=d?"success":"failed";this.bumpCounter(m.CONNECT+"."+d);d=l/(l+o);l=p&&this.getBrowserConnectivity();var s={event_type:n.CONNECT,acked:f,attempt_number:k.toString(),connection_state:e,client_type:j,duration:g.toString(),total_duration:h.toString(),error:q,session_id:b.toString(),os_connectivity:l,payload_size:r==null?void 0:r.toString(),extra_data:{device_id:this.$5,connect_success_rate:d.toString(),hostname:i},ws_count:(o=this.$6)==null?void 0:o.getGlobalState().totalConnectionStreams.toString(),disconnect_count:a.toString()};this.$8(function(){c("MqttUnifiedClientConnectFalcoEvent").log(function(){return s})})};b.eventLogPull=function(a){var b=a.pullEventName,c=a.sessionID,e=a.status,f=a.duration,g=a.hostname;a=a.errorMessage;c={device_id:this.$5,session_id:c,logged_in:d("MqttEnv").Env.isUserLoggedInNow(),href:k.location.hostname,connection_status:e,duration:f,hostname:g,error_message:a};this.$9(b,c)};b.eventLogPullFinish=function(a){var b=a.pullEventName,c=a.sessionID,e=a.duration,f=a.errorMessage,g=a.publishReceived;a=a.publishSent;c={device_id:this.$5,session_id:c,logged_in:d("MqttEnv").Env.isUserLoggedInNow(),href:k.location.hostname,duration:e,error_message:f,publish_received:g,publish_sent:a};this.$9(b,c)};b.eventLogDisconnect=function(a){var b=a.sessionID;a.errorCode;var d=a.errorMessage,e=a.duration;a=a.disconnectCount;this.bumpCounter(m.DISCONNECT);var f={event_type:n.DISCONNECT,connection_state:"Disconnected",client_type:j,duration:e.toString(),error:d,session_id:b.toString(),os_connectivity:this.getBrowserConnectivity(),extra_data:{device_id:this.$5},ws_count:(e=this.$6)==null?void 0:e.getGlobalState().totalConnectionStreams.toString(),disconnect_count:a.toString()};this.$8(function(){c("MqttUnifiedClientDisconnectFalcoEvent").log(function(){return f})})};b.eventLogOutgoingPublish=function(a){var b=a.sessionID,d=a.topic,e=a.qos,f=a.payloadSizeBytes,g=a.success,h=a.protocol,i=a.errorMessage,k=a.connectionState,l=a.thisAttemptStartTime,o=a.firstAttemptStartTime,p=a.attempt;a=a.disconnectCount;this.bumpCounter(m.PUBLISH+"."+d);var q=Date.now(),r={event_type:n.OUTGOING_PUBLISH,session_id:b.toString(),topic:d,client_type:j,connection_state:k,qos:e.toString(),acked:e===1?g:null,duration:(q-l).toString(),total_duration:o!=null?(q-o).toString():null,error:i,payload_size:f.toString(),attempt_number:p.toString(),os_connectivity:this.getBrowserConnectivity(),extra_data:{device_id:this.$5,protocol:h},disconnect_count:a.toString()};this.$8(function(){c("MqttUnifiedClientOutgoingPublishFalcoEvent").log(function(){return r})})};b.eventLogIncomingPublish=function(a){var b=a.sessionID,d=a.topic,e=a.connectionState,f=a.qos,g=a.payloadSizeBytes;a=a.disconnectCount;var h={event_type:n.INCOMING_PUBLISH,session_id:b.toString(),topic:d,client_type:j,connection_state:e,qos:f.toString(),payload_size:g.toString(),os_connectivity:this.getBrowserConnectivity(),extra_data:{device_id:this.$5},disconnect_count:a.toString()};b=d=="/webrtc"||d=="/rtc_multi";this.$10(function(){c("MqttUnifiedClientIncomingPublishFalcoEvent").log(function(){return h})},50,b)};b.logError=function(a,b){var e=this;d("MqttEnv").Env.scheduleLoggingCallback(function(){try{c("FBLogger")(h).catching(a).mustfix(b)}catch(a){}})};b.logErrorWarn=function(a,b){var e=this;d("MqttEnv").Env.scheduleLoggingCallback(function(){try{c("FBLogger")(h).catching(a).warn(b)}catch(a){}})};b.logWarn=function(a,b){var c=this;d("MqttEnv").Env.scheduleLoggingCallback(function(){try{c.$1.warn(a,b)}catch(a){}})};b.debugTrace=function(a,b){var c=this;d("MqttEnv").Env.scheduleLoggingCallback(function(){try{c.$1.debug(a,b)}catch(a){}})};b.bumpCounter=function(a){var b=this;if(!d("Random").coinflip(i))return;d("MqttEnv").Env.scheduleLoggingCallback(function(){b.$2!==0&&d("ODS").bumpEntityKey(2966,"mqtt_ws_client",b.$2+"."+a,i),d("ODS").bumpEntityKey(2966,"mqtt_ws_client",a,i)})};b.$9=function(a,b,e){var f=this;d("MqttEnv").Env.scheduleLoggingCallback(function(){b.event_type=a;b.app_id=f.$2;b.online=f.$11();var d=JSON.stringify(b);f.$1.log(a,d,{weight:e});a!==m.DISCONNECT&&c("MqttWsClientTypedLoggerLite").log(b)})};b.$10=function(a,b,e){c("gkx")("762")&&b!==0?e=e||d("Random").coinflip(b):e=!0;e&&d("MqttEnv").Env.scheduleCallback(a)};b.$8=function(a){this.$10(a,0,!1)};b.$11=function(){return k.navigator&&k.navigator.onLine!==void 0?k.navigator.onLine:!1};b.getBrowserConnectivity=function(){return c("NetworkStatus").isOnline()};b.$7=function(){var a=this;if(k.navigator&&k.navigator.onLine!==void 0){var b=function(b){b=b.online;b||a.bumpCounter("browser_disconnect")};c("NetworkStatus").onChange(b)}};return a}();g["default"]=a}),98); __d("MqttEnvInitializer",["CurrentUser","MqttEnv","MqttLogger","Random","WebStorage","clearTimeout","gkx","setTimeoutAcrossTransitions"],(function(a,b,c,d,e,f,g){"use strict";var h="mqtt:",i={genGk:function(a){switch(a){case d("MqttEnv").MqttGkNames.mqtt_waterfall_log_client_sampling:return c("gkx")("832242");case d("MqttEnv").MqttGkNames.mqtt_ws_polling_enabled:return!0;case d("MqttEnv").MqttGkNames.mqtt_lp_use_fetch:return c("gkx")("945829");case d("MqttEnv").MqttGkNames.mqtt_fast_lp:return c("gkx")("1001007");case d("MqttEnv").MqttGkNames.mqtt_lp_no_delay:return c("gkx")("1066746");case d("MqttEnv").MqttGkNames.mqtt_enable_publish_over_polling:return c("gkx")("968609");case d("MqttEnv").MqttGkNames.mqttweb_global_connection_counter:return c("gkx")("2795");default:c("MqttLogger").getInstance().logError(new Error("unknown gk"),"Unknown GK value "+a);return!1}},configRead:function(a,b){var d=c("WebStorage").getLocalStorage();if(d){d=d.getItem(h+a);if(d!=null)return d}return b},configWrite:function(a,b){var d=c("WebStorage").getLocalStorage();d&&(b==null?d.removeItem(h+a):c("WebStorage").setItemGuarded(d,h+a,b))},initialize:function(){d("MqttEnv").Env.initialize(c("Random").random,c("CurrentUser").isLoggedInNow,c("clearTimeout"),c("setTimeoutAcrossTransitions"),function(){return c("MqttLogger").getInstance()},i.genGk,null,null,null,i.configRead,i.configWrite)}};f.exports=i}),34); __d("FBMqttChannel",["MqttChannel","MqttEnvInitializer","MqttWebConfig"],(function(a,b,c,d,e,f,g){"use strict";c("MqttEnvInitializer").initialize();a=new(c("MqttChannel"))({endpoint:c("MqttWebConfig").endpoint,pollingEndpoint:c("MqttWebConfig").pollingEndpoint,userFbid:c("MqttWebConfig").fbid,appId:c("MqttWebConfig").appID,initialSubscribedTopics:c("MqttWebConfig").subscribedTopics,capabilities:c("MqttWebConfig").capabilities,clientCapabilities:c("MqttWebConfig").clientCapabilities,chatVisibility:!1,phpOverride:c("MqttWebConfig").hostNameOverride});g["default"]=a}),98); __d("RtiRequestStreamE2eClientBatchFalcoEvent",["FalcoLoggerInternal","getFalcoLogPolicy_DO_NOT_USE"],(function(a,b,c,d,e,f,g){"use strict";a=c("getFalcoLogPolicy_DO_NOT_USE")("819");b=d("FalcoLoggerInternal").create("rti_request_stream_e2e_client_batch",a);e=b;g["default"]=e}),98); __d("RtiRequestStreamE2eClientFalcoEvent",["FalcoLoggerInternal","getFalcoLogPolicy_DO_NOT_USE"],(function(a,b,c,d,e,f,g){"use strict";a=c("getFalcoLogPolicy_DO_NOT_USE")("1857112");b=d("FalcoLoggerInternal").create("rti_request_stream_e2e_client",a);e=b;g["default"]=e}),98); __d("RequestStreamE2ELogger",["ConstUriUtils","RequestStreamE2EClientLoggerEvent","RequestStreamE2EClientLoggerMessageType","RtiRequestStreamE2eClientBatchFalcoEvent","RtiRequestStreamE2eClientFalcoEvent"],(function(a,b,c,d,e,f,g){"use strict";var h=["FBGQLS:COMMENT_CREATE_SUBSCRIBE","FBGQLS:COMMENT_LIKE_SUBSCRIBE","FBGQLS:FEEDBACK_COMMENT_PERMISSION_TOGGLE_SUBSCRIBE","FBGQLS:FEEDBACK_TYPING_SUBSCRIBE","FBLQ:comet_notifications_live_query_experimental"],i=0;function j(){var a=Date.now();i>=a?i+=1:i=a;return i.toString()}var k=function(){function a(a,b,c,e,f,g,h,i,j,k){this.$10=[];this.$11=!1;this.$1=a;this.$2=b;this.$3=c;this.$4=e;this.$5=f;this.$6=g;this.$7=h;this.$8=i;this.$9=j;this.$12=(a=k)!=null?a:!1;b=d("ConstUriUtils").getUri(window.location.href);b&&(this.$13=b.getDomain())}var b=a.prototype;b.logE2EEvent=function(a,b,c,d,e,f){c===void 0&&(c=null);d===void 0&&(d=null);e===void 0&&(e=null);f===void 0&&(f=null);if(this.$3==="Falco")return;e={request_id:this.$1,resume_id:"0",retry_id:e,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:a,event:b,timestamp_ms:j(),aux_id:d,additional_data:c,dgw_stream_group_logging_id:this.$8,dgw_count_prior_streams_in_group:this.$9,domain:this.$13,df_trace_id:f};this.$14(e)};b.$14=function(a){if(!this.$12){c("RtiRequestStreamE2eClientFalcoEvent").log(function(){return a});return}this.$10.push(a);if(this.$11||a.event==c("RequestStreamE2EClientLoggerEvent").FAILURE||a.message_type==c("RequestStreamE2EClientLoggerMessageType").RESPONSE){var b={events:this.$10};c("RtiRequestStreamE2eClientBatchFalcoEvent").log(function(){return b});this.$10=[];this.$11=!0}};b.getRequestId=function(){return this.$1};return a}();function a(a,b,c){if(a==null||a.method==null)return null;var d=!1;h.includes(a.method)&&(d=!0);if(b==null||b.length==0)return null;b=JSON.parse(b);return b.requestId==null?null:new k(b.requestId,c,a.method,l(a.method,a),b.requestLogContext,b.forceLogContext,b.sampleRate,b.dgwStreamGroupLoggingId,b.dgwCountPriorStreamsInGroup,d)}function l(a,b){if(a==="FBLQ"&&b.config_id)return b.config_id;if(a==="SKY"){if(b.topic){var c=b.topic.lastIndexOf("/");return c>0?b.topic.substr(0,c):b.topic}return}return a}function b(a,b,d,e,f,g){f===void 0&&(f=null);g===void 0&&(g=null);if(a==null||a.requestId==null||a.clientLoggingDisabled!=null)return;var h={request_id:a.requestId,resume_id:"0",transport:b,e2e_sample_rate:a.sampleRate,message_type:d,event:e,timestamp_ms:j(),aux_id:a.auxId,additional_data:f,df_trace_id:g};c("RtiRequestStreamE2eClientFalcoEvent").log(function(){return h})}g.RequestStreamE2ELogger=k;g.createStreamLogger=a;g.logRequestStreamE2EEventStatic=b}),98); __d("RequestStreamTransport",["$InternalEnum"],(function(a,b,c,d,e,f){"use strict";a=b("$InternalEnum").Mirrored(["WEB_BR_MQTT","WEB_RS_MQTT","WEB_RS_STARGATE"]);f.RequestStreamTransport=a}),66); __d("BladeRunnerSocket",["BladeRunnerEventHandler","BladeRunnerLogger","BladeRunnerStreamStatus","BladeRunnerTypes","BladeRunnerTypesInternal","CurrentUser","FBMqttChannel","MqttPublishListener","Promise","RequestStreamE2EClientLoggerEvent","RequestStreamE2EClientLoggerMessageType","RequestStreamE2ELogger","RequestStreamTransport","justknobx","uuidv4"],(function(a,b,c,d,e,f,g){"use strict";var h="Connected",i="Disconnected",j="/br_sr",k="/sr_res",l=null;function m(a){var b;switch(a.type){case d("BladeRunnerTypes").StreamFrameType.REQUEST:return(b=a.request)==null?void 0:b.getInstrumentationData();case d("BladeRunnerTypes").StreamFrameType.DATA:return(b=a.data)==null?void 0:b.getInstrumentationData()}return null}function n(a){switch(a.type){case d("BladeRunnerTypes").StreamFrameType.REQUEST:return c("RequestStreamE2EClientLoggerMessageType").REQUEST_STREAM;case d("BladeRunnerTypes").StreamFrameType.DATA:return c("RequestStreamE2EClientLoggerMessageType").AMENDMENT}return null}function o(a){if(a===null)return null;switch(a){case d("BladeRunnerStreamStatus").StreamStatus.ACCEPTED:return"Accepted";case d("BladeRunnerStreamStatus").StreamStatus.REJECTED:return"Rejected";case d("BladeRunnerStreamStatus").StreamStatus.STARTED:return"Started";case d("BladeRunnerStreamStatus").StreamStatus.STOPPED:return"Stopped";case d("BladeRunnerStreamStatus").StreamStatus.CLOSED:return"Closed"}return null}function p(a){var b={};a==null?void 0:(a=a.frames)==null?void 0:a.forEach(function(a){if(a.type===d("BladeRunnerTypes").StreamFrameType.STATUS_UPDATE){a=(a=a.statusUpdate)==null?void 0:a.status;a=o(a);a!==null&&(b.flow_status=a)}});return b}function q(a,b){var c;switch(a.type){case d("BladeRunnerTypes").StreamFrameType.REQUEST:b.data_base64_size=(c=a.request)==null?void 0:(c=c.payload)==null?void 0:(c=c.length)==null?void 0:c.toString();break;case d("BladeRunnerTypes").StreamFrameType.DATA:b.data_base64_size=(c=a.data)==null?void 0:(b=c.rawDataSize())==null?void 0:b.toString();break}return null}function r(a,b,e){var f=m(a);if(f==null)return;var g=n(a);if(g==null)return;var h=null;switch(b){case d("MqttPublishListener").MqttPublishEvent.SENT:h=c("RequestStreamE2EClientLoggerEvent").SENT;break;case d("MqttPublishListener").MqttPublishEvent.ACKED:h=c("RequestStreamE2EClientLoggerEvent").PUBACK;break;case d("MqttPublishListener").MqttPublishEvent.NOT_ACKED:case d("MqttPublishListener").MqttPublishEvent.NOT_CONNECTED:case d("MqttPublishListener").MqttPublishEvent.PUBLISH_ERROR:h=c("RequestStreamE2EClientLoggerEvent").FAILURE;e.reason==null&&(e.reason=b);break}if(h==null)return;q(a,e);if(((b=a.request)==null?void 0:b.e2eLogger)!=null&&f.clientLoggingDisabled==null){(b=a.request)==null?void 0:b.e2eLogger.logE2EEvent(g,h,e,f.auxId)}else d("RequestStreamE2ELogger").logRequestStreamE2EEventStatic(f,d("RequestStreamTransport").RequestStreamTransport.WEB_BR_MQTT,g,h,e)}a=function(){function a(a){this.$1=[],this.$2=0,this.$3=0,this.$4=null,this.$5=0,this.$6=new Map(),this.$7=a!=null?a:c("FBMqttChannel"),this.$8=new Map(),c("BladeRunnerLogger").setClientSessionId(c("uuidv4")()),this.$9()}a.get=function(){l==null&&(l=new a(c("FBMqttChannel")));return l};var e=a.prototype;e.sendNewStreamRequest=function(b,d){d=new(c("BladeRunnerEventHandler"))(b,d,this);var e=b.getRequest();this.$6.set(e.streamId,d);if(!this.$10()){this.$11(d,e.streamId);return}this.getStreamCount()<=a.maxStreamCount?this.$12(e):(c("BladeRunnerLogger").bumpCounter("socket_request_throttled_max_streams"),c("BladeRunnerLogger").warn("Maximum stream count reached, will not send request: "+JSON.stringify(b.getRequest().getHeaders())),this.$11(d,e.streamId))};e.sendRetryStreamRequest=function(a){this.$12(a.getRequest())};e.sendCancel=function(a){c("BladeRunnerLogger").bumpCounter("socket_send_cancel");var b=new(d("BladeRunnerTypesInternal").GatewayStreamStatusUpdate)();b.streamId=a.streamId;b.status=d("BladeRunnerStreamStatus").StreamStatus.CLOSED;this.$13(b,a);this.removeStream(a.streamId)};e.sendAmendment=function(a,b,e){c("BladeRunnerLogger").bumpCounter("socket_send_amendment");var f=new(d("BladeRunnerTypesInternal").GatewayStreamData)();f.streamId=a;f.setData(b);e!=null&&(f.instrumentationData=e);this.$14(f)};e.sendAmendmentWithAck=function(a,e,f){var g=this;c("BladeRunnerLogger").bumpCounter("socket_send_amendment");var h=this.$15(),i=new(d("BladeRunnerTypesInternal").GatewayStreamData)();i.streamId=a;i.setData(e);i.shouldAck=!0;i.dataId=h;f!=null&&(i.instrumentationData=f);a=new(b("Promise"))(function(a,b){g.$8.set(h,{resolve:a,reject:b})});this.$14(i);return a};e.$14=function(a){this.$1.push(d("BladeRunnerTypesInternal").GatewayStreamFrame.newDataFrame(a)),this.$16()};e.sendDataAcks=function(a){c("BladeRunnerLogger").bumpCounter("socket_send_data_ack",a.length),this.$17(a)};e.removeStream=function(a){this.$6["delete"](a)};e.getStreamCount=function(){return this.$6.size};e.getNextStreamId=function(){this.$5++;return this.$5};e.onMQTTStateChanged=function(a){this.$16();if(a!=i&&a!=h||this.$4==a)return;this.$4=a;c("BladeRunnerLogger").info("MQTTStateChanged: "+a);a==i?(c("BladeRunnerLogger").bumpCounter("mqtt_state_disconnected"),this.$18()):a==h&&c("BladeRunnerLogger").bumpCounter("mqtt_state_connected")};e.$12=function(a){c("BladeRunnerLogger").bumpCounter("socket_send_request");this.$1.push(d("BladeRunnerTypesInternal").GatewayStreamFrame.newRequestFrame(a));if(!this.$16()){(a=a.e2eLogger)==null?void 0:a.logE2EEvent(c("RequestStreamE2EClientLoggerMessageType").REQUEST_STREAM,c("RequestStreamE2EClientLoggerEvent").FAILURE,{reason:"MQTT Not Connected"})}};e.$13=function(a,b){this.$1.push(d("BladeRunnerTypesInternal").GatewayStreamFrame.newStatusUpdateFrame(a));if(this.$16()){(a=b.e2eLogger)==null?void 0:a.logE2EEvent(c("RequestStreamE2EClientLoggerMessageType").CANCEL,c("RequestStreamE2EClientLoggerEvent").SENT)}};e.$17=function(a){for(var b=0;b0)try{this.$20(this.$1),a=!0}catch(a){}finally{this.$1=[]}return a};e.$20=function(a){var b=this,e=new(d("BladeRunnerTypesInternal").GatewayStreamBatch)(this.$19(),a),f=e.write();if(f.length>this.$21()){var g=Math.floor(a.length/2);if(g===0){a.forEach(function(a){return r(a,d("MqttPublishListener").MqttPublishEvent.PUBLISH_ERROR,{reason:"too long"})});var h=new Error("Publish is too long: "+f.length);h.stack;this.$22(e,h,"Publish is too long");throw h}this.$20(a.slice(0,g));this.$20(a.slice(g,a.length))}else try{c("BladeRunnerLogger").info("send message to "+j+" ("+f.length+" bytes)");h={qos:1,skipBuffer:!1};if(e.isInstrumented()){var i=Date.now();h.listener={onEvent:function(b){var c=(Date.now()-i).toString();a.forEach(function(a){r(a,b,{latency:c})})}}}this.$7.publish(j,f,h)["catch"](function(a){b.$22(e,a,"Failed publishing to MQTT")});c("BladeRunnerLogger").bumpCounter("mqtt_publish_success")}catch(a){this.$22(e,a,"Failed publishing to MQTT");throw a}};e.$9=function(){var a=this;c("BladeRunnerLogger").info("Starting socket with endpoint "+this.$7.getEndpoint()+" useragent "+navigator.userAgent);this.onMQTTStateChanged(this.$7.getConnectionState());this.$7.subscribeChannelEvents({onMQTTStateChanged:function(b){a.onMQTTStateChanged(b)},onJSError:function(a){var b=a!=null&&typeof a.isRecoverable==="boolean"?a.isRecoverable:!1;b?c("BladeRunnerLogger").bumpCounter("mqtt_channel_recoverable_error"):(c("BladeRunnerLogger").warn("JS error in MQTTChannel: "+(typeof a=="object"&&a!=null?a.toString():"unknown error")+", "+JSON.stringify(a)),c("BladeRunnerLogger").bumpCounter("mqtt_channel_error"))}});this.$7.subscribe(j,function(a){throw new Error("Unexpected response: "+j+" "+a.toString())});this.$7.subscribe(k,function(b){a.$23(b)})};e.$23=function(a){a=d("BladeRunnerTypesInternal").GatewayStreamBatch.read(a);this.processBatch(a)};e.$22=function(a,b,e){for(var a=a.getFrames(),f=Array.isArray(a),g=0,a=f?a:a[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var h;if(f){if(g>=a.length)break;h=a[g++]}else{g=a.next();if(g.done)break;h=g.value}h=h;if(h.type===d("BladeRunnerTypes").StreamFrameType.REQUEST){var i=h.getRequest(),j=this.$6.get(i.streamId);j!=null&&this.$24(j,i.streamId,d("BladeRunnerStreamStatus").StreamStatus.CLOSED,!0,null)}else if(h.type===d("BladeRunnerTypes").StreamFrameType.DATA){j=h.getData();i=j.dataId;if(j.shouldAck!=null&&j.shouldAck&&i!=null){h=new(d("BladeRunnerTypesInternal").GatewayStreamDataAck)();h.streamId=j.streamId;h.dataId=i;h.success=!1;h.code=d("BladeRunnerTypesInternal").GatewayStreamDataAck.ACK_CODE_FAILED_TO_LAND;h.message=e;this.$25(h)}}}c("BladeRunnerLogger").info("Failed publishing to MQTT: "+b.message);c("BladeRunnerLogger").bumpCounter("mqtt_publish_error")};e.$25=function(a){var b=this.$8.get(a.dataId);b!=null&&(this.$8["delete"](a.dataId),a.success?b.resolve(!0):a.code===d("BladeRunnerTypesInternal").GatewayStreamDataAck.ACK_CODE_LANDED_BUT_NOT_ACCEPTED?b.resolve(!1):b.reject(a.message))};e.processBatch=function(a){try{d("RequestStreamE2ELogger").logRequestStreamE2EEventStatic(a.getInstrumentationData(),d("RequestStreamTransport").RequestStreamTransport.WEB_BR_MQTT,c("RequestStreamE2EClientLoggerMessageType").RESPONSE,c("RequestStreamE2EClientLoggerEvent").RECEIVED,p(a),a.getInstrumentationDataDfTraceId());c("BladeRunnerLogger").bumpCounter("socket_process_batch");var b=JSON.stringify(a);c("BladeRunnerLogger").info("Received batch ("+b.length+" bytes)");b=null;for(var e=a.getFrames(),f=Array.isArray(e),g=0,e=f?e:e[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var h;if(f){if(g>=e.length)break;h=e[g++]}else{g=e.next();if(g.done)break;h=g.value}h=h;var i=h.getStreamId();b==null&&(b=i);if(i!=null&&b!=i)throw new Error("Received batch with frames for multiple streams");h.type==d("BladeRunnerTypes").StreamFrameType.DATA_ACK&&this.$25(h.getDataAck())}if(b!=null){i=this.$6.get(b);i!=null?i.onProxyResponse(a):c("BladeRunnerLogger").info("Received batch with frames for unknown stream id: "+b)}else c("BladeRunnerLogger").info("Received batch with no frames")}catch(a){c("BladeRunnerLogger").exception(a,"Failed processing batch from MQTT");c("BladeRunnerLogger").bumpCounter("socket_process_batch_error");throw a}};e.$18=function(){this.$6.forEach(function(a,b,c){a.onDisconnect()})};e.$11=function(a,b){this.$24(a,b,d("BladeRunnerStreamStatus").StreamStatus.REJECTED,!1,0)};e.$24=function(a,b,c,e,f){var g=new(d("BladeRunnerTypesInternal").GatewayStreamStatusUpdate)();g.streamId=b;g.status=c;g.shouldRetry=e;g.retryDelayMs=f;b=new(d("BladeRunnerTypesInternal").GatewayStreamBatch)(null,[d("BladeRunnerTypesInternal").GatewayStreamFrame.newStatusUpdateFrame(g)]);a.onProxyResponse(b)};e.$10=function(){if(!c("CurrentUser").isLoggedIn()){c("BladeRunnerLogger").bumpCounter("request_stream_user_logged_out");return!1}return!0};e.$21=function(){var a=1024*1024,b=512*1024;try{var d=c("justknobx")._("317");b=d*a}catch(a){}return Math.max(b-1024,0)};return a}();a.maxStreamCount=2e3;g["default"]=a}),98); __d("BladeRunnerStream",["Promise","regeneratorRuntime"],(function(a,b,c,d,e,f){a=function(){function a(a){this.$1=a}var c=a.prototype;c.getStreamHandler=function(){return this.$1};c.cancel=function(){};c.amendWithAck=function(a){return b("regeneratorRuntime").async(function(a){while(1)switch(a.prev=a.next){case 0:return a.abrupt("return",!1);case 1:case"end":return a.stop()}},null,this)};c.amendFireAndForget=function(a){};c.amendWithoutAck=function(a){};c.start=function(){return b("Promise").resolve()};c.isAlive=function(){return!1};c.canAmend=function(){return!1};c.getStatus=function(){return null};c.getStreamId=function(){return 0};return a}();f["default"]=a}),66); __d("BladeRunnerStreamState",["BladeRunnerLogger","BladeRunnerStreamStatus","BladeRunnerTypes"],(function(a,b,c,d,e,f,g){a=function(){function a(a){this.$1=a,this.$2=null,this.$3=0,this.$4=!1,this.$5=0,this.$6=!1}var b=a.prototype;b.getRequest=function(){return this.$1};b.updateRetryRequestPayload=function(a){this.$1.updateRetryRequestPayload(a)};b.isAlive=function(){return!(this.$2==d("BladeRunnerStreamStatus").StreamStatus.CLOSED||this.$2==d("BladeRunnerStreamStatus").StreamStatus.REJECTED)};b.canAmend=function(){return this.$2==d("BladeRunnerStreamStatus").StreamStatus.ACCEPTED||this.$2==d("BladeRunnerStreamStatus").StreamStatus.STARTED||this.$2==d("BladeRunnerStreamStatus").StreamStatus.STOPPED};b.getLastStatus=function(){return this.$2};b.setLastStatus=function(a){this.$2=a};b.onError=function(){this.$3+=1};b.getErrorCount=function(){return this.$3};b.resetErrors=function(){this.$3=0};b.getRetryRequestScheduled=function(){return this.$6};b.setRetryRequestScheduled=function(a){this.$6=a};b.witnessFrame=function(a){switch(a.type){case d("BladeRunnerTypes").StreamFrameType.STATUS_UPDATE:var b=a.getStatusUpdate(),c=!0;switch(b.status){case d("BladeRunnerStreamStatus").StreamStatus.ACCEPTED:c=!this.$4;this.$4||(this.$4=!0);break;case d("BladeRunnerStreamStatus").StreamStatus.STARTED:c=this.getLastStatus()!=d("BladeRunnerStreamStatus").StreamStatus.STARTED;break;case d("BladeRunnerStreamStatus").StreamStatus.STOPPED:c=this.getLastStatus()==d("BladeRunnerStreamStatus").StreamStatus.STARTED;break;case d("BladeRunnerStreamStatus").StreamStatus.CLOSED:case d("BladeRunnerStreamStatus").StreamStatus.REJECTED:default:c=!0}this.setLastStatus(b.status);return c;case d("BladeRunnerTypes").StreamFrameType.REWRITE_REQUEST:this.$7(a.getRewriteRequest());return!1;default:return!0}};b.setRetriesAllowed=function(a){this.$5=a};b.getRetriesAllowed=function(){return this.$5};b.$7=function(a){if(!(a.temporary!=null||a.temporary==!0)){a.newBody!=null&&(this.$1.payload=a.newBody);a.newExtraHeader!=null&&(this.$1.extraHeader=a.newExtraHeader,this.$1.headers=JSON.parse(a.newExtraHeader));if(a.patchExtraHeader!=null)try{var b=JSON.parse(a.patchExtraHeader),d=this.$1.extraHeader!=null?JSON.parse(this.$1.extraHeader):{};this.$1.headers==null&&(this.$1.headers={});var e=Object.keys(b);for(var f=0;f1&&a!=null){a=c("RequestStreamE2EClientSamplingConfig").methodToSamplingMultiplier[a];a==0?d=0:a!=null&&(d/=a)}return d==1?1:d/b}function k(a,b,d,e){var f=c("uuidv4")();(b.requestId==null||b.requestId===""||typeof b.requestId!="string")&&(a.requestId!=null&&typeof a.requestId=="string"?b.requestId=a.requestId:b.requestId=f);b.requestId+="/_"+f.substring(0,4);b.resumeId="0";d!=null?b.sampleRate=d:b.sampleRate=void 0;f="";e!=null&&e.length>0&&(f=e);f.length>0&&(b.requestLogContext!=null&&b.requestLogContext.length>0?b.requestLogContext+=":":b.requestLogContext="",b.requestLogContext+=f);(a==null?void 0:a.method)==="Falco"&&(b.clientLoggingDisabled="Falco");d={};for(e=Object.keys(b).sort(),f=Array.isArray(e),a=0,e=f?e:e[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var g;if(f){if(a>=e.length)break;g=e[a++]}else{a=e.next();if(a.done)break;g=a.value}g=g;d[g]=b[g]}return JSON.stringify(d)}function a(a,b,d,e){b&&(!b.requestId.includes("/")&&!b.requestId.includes("#")||h(0,41721));e=j(a.method,(e=e)!=null?e:1);if(c("Random").coinflip(e))return k(a,b||{requestId:""},e,d);return i(b)?k(a,b||{requestId:""},null,d):""}g.isForceLogged=i;g.getSampleRateForLogging=j;g.normalizeInstrumentationData=k;g.validateInstrumentationData=a}),98); __d("BladeRunnerClient",["Base64","BladeRunnerConfig","BladeRunnerLogger","BladeRunnerSocket","BladeRunnerSocketStream","BladeRunnerTypes","BladeRunnerTypesInternal","RequestStreamE2ELogger","RequestStreamE2ESampling","RequestStreamTransport","cr:2046346"],(function(a,b,c,d,e,f,g){a=function(){function a(a,b){this.$2=d("RequestStreamTransport").RequestStreamTransport.WEB_BR_MQTT,this.$1=a!=null?a:c("BladeRunnerSocket").get(),b&&(this.$2=b)}var e=a.prototype;e.createStream=function(a,b,c,d){return this.$3(a,b,c,d)};e.requestStream=function(a,c,d,e){a=this.$3(a,c,d,e);a.send();b("cr:2046346")!=null&&b("cr:2046346").startPulsarTest();return a};e.logInfo=function(a){c("BladeRunnerLogger").info(a)};e.bumpCounter=function(a){c("BladeRunnerLogger").bumpCounter(a)};e.$3=function(a,b,e,f){var g=new(d("BladeRunnerTypesInternal").GatewayStreamRequest)();g.streamId=this.$1.getNextStreamId();g.requestType=d("BladeRunnerTypes").StreamRequestType.BLADE_RUNNER;g.headers=c("BladeRunnerConfig").patchRequestHeaders(a);g.extraHeader=JSON.stringify(g.headers);g.payload=b!=null?c("Base64").encode(b):null;f!=null&&(f.transport="WEB_RS_MQTT");g.instrumentationData=d("RequestStreamE2ESampling").validateInstrumentationData(g.headers||{},f);g.e2eLogger=d("RequestStreamE2ELogger").createStreamLogger(g.headers,g.instrumentationData,this.$2);return new(c("BladeRunnerSocketStream"))(e,g,this.$1)};return a}();g["default"]=a}),98); __d("BladeRunnerDeferredClient",["Promise","nullthrows","requireDeferred"],(function(a,b,c,d,e,f,g){a=function(){function a(){this.$1=null}var d=a.prototype;d.requestStream=function(a,b,d,e){this.$2();return c("nullthrows")(this.$1).then(function(c){return c.requestStream(a,b,d,e)})};d.logInfo=function(a){this.$2();return c("nullthrows")(this.$1).then(function(b){b.logInfo(a)})};d.bumpCounter=function(a){this.$2();return c("nullthrows")(this.$1).then(function(b){b.bumpCounter(a)})};d.$2=function(){this.$1==null&&(this.$1=new(b("Promise"))(function(a){c("requireDeferred")("BladeRunnerClient").__setRef("BladeRunnerDeferredClient").onReady(function(b){a(new b())})}))};return a}();d=new a();g["default"]=d}),98); __d("BladeRunnerStreamHandler",[],(function(a,b,c,d,e,f){a=function(){function a(a,b,c,d,e,f){this.$1=a,this.$2=b,this.$3=c||function(a){},this.$4=d||function(a){},this.$5=e||function(a){},this.$6=f}var b=a.prototype;b.onData=function(a){var b=this.$1,c=this.$2;if(b!=null)b(a.decodeData());else if(c!=null){b=atob(a.rawData());a=new Uint8Array(b.length);for(var d=0;d=1e4?Math.round(Math.min(a/1e4,6))*10:Math.round(Math.min(a/1e3,10));c("BladeRunnerDeferredClient").bumpCounter("status_latency."+this.$BladeRunnerInstrumentedStreamHandler2+"."+b+".s")}clearTimeout(this.$BladeRunnerInstrumentedStreamHandler5)};return b}(c("BladeRunnerStreamHandler"));g["default"]=a}),98); __d("InflightAmends",["Deferred","err"],(function(a,b,c,d,e,f,g){"use strict";var h="inflight_amends_timeout",i="inflight_amends_duplicate_id";a=function(){function a(a,b,c){this.$1=a,this.$3=b,this.$4=c,this.$2=new Map()}var b=a.prototype;b.add=function(a){var b=this;if(this.$2.has(a))throw c("err")(i);var d=new(c("Deferred"))(),e=Date.now(),f=setTimeout(function(){b.$2.has(a)&&b.reject(a,c("err")(h))},this.$1);this.$2.set(a,{id:a,deferred:d,createdTimestampMs:e,timeoutId:f});return d.getPromise()};b.getPromise=function(a){return(a=this.$5(a))==null?void 0:a.deferred.getPromise()};b.resolve=function(a,b){a=this.$5(a);a&&(a.deferred.resolve==null?void 0:a.deferred.resolve(b),this.$3(a.id,Date.now()-a.createdTimestampMs),this.$6(a))};b.reject=function(a,b){a=this.$5(a);a&&(a.deferred.reject==null?void 0:a.deferred.reject(b),this.$4(a.id,b),this.$6(a))};b.rejectAll=function(a){for(var b=this.$2.entries(),c=Array.isArray(b),d=0,b=c?b:b[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var e;if(c){if(d>=b.length)break;e=b[d++]}else{d=b.next();if(d.done)break;e=d.value}e=e;var f=e[0];e[1];this.reject(f,a)}};b.getSize=function(){return this.$2.size};b.getAllPromises=function(){var a=[];for(var b=this.$2.values(),c=Array.isArray(b),d=0,b=c?b:b[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var e;if(c){if(d>=b.length)break;e=b[d++]}else{d=b.next();if(d.done)break;e=d.value}e=e;a.push(e.deferred.getPromise())}return a};b.$6=function(a){clearTimeout(a.timeoutId),this.$2["delete"](a.id)};b.$5=function(a){return this.$2.get(a)};return a}();g["default"]=a}),98); __d("RequestStreamCloseReason",["$InternalEnum"],(function(a,b,c,d,e,f){"use strict";a=b("$InternalEnum").Mirrored(["UserIntention","StartStreamFailure","StreamError","RemoteTermination","ServerDataEnd","ServerDrain","ReestablishError","ClientError"]);f.RequestStreamCloseReason=a}),66); __d("RequestStreamHandler",["err"],(function(a,b,c,d,e,f,g){"use strict";a=function(){function a(a){var b=a.onData,c=a.onTermination,d=a.onLog,e=a.onFlowStatus;a=a.onRetryUpdateRequestBody;this.$1=b||function(a){};this.$2=c||function(a){};this.$3=d||function(a){};this.$4=e;this.$5=a}var b=a.prototype;b.onFlowStatus=function(a){this.$4(a)};b.onData=function(a){this.$1(a)};b.onTermination=function(a){this.$2(c("err")(a))};b.onLog=function(a){this.$3(a)};b.onRetryUpdateRequestBody=function(){if(this.$5!=null)return this.$5()};return a}();g["default"]=a}),98); __d("DGWConstants",["$InternalEnum"],(function(a,b,c,d,e,f){"use strict";var g=3e4,h="prod",i=128,j=(b=b("$InternalEnum"))({NORMAL_CLOSURE:1e3,GOING_AWAY:1001,ABNORMAL_CLOSURE:1006,SERVER_INTERNAL_ERROR:1011,GRACEFUL_CLOSE:4e3,KEEPALIVE_TIMEOUT:4001,DGW_SERVER_ERROR:4002,UNAUTHORIZED:4003,REJECTED:4004,BAD_REQUEST:4005}),k=b({DrainReason_ELB:0,DrainReason_SLB:1,DrainReason_AppServerPush:2,DrainReason_GracePeriodExpired:3,DrainReason_Unknown:4});function a(a){switch(a){case k.DrainReason_ELB:return"DrainReason_ELB";case k.DrainReason_SLB:return"DrainReason_SLB";case k.DrainReason_AppServerPush:return"DrainReason_AppServerPush";case k.DrainReason_GracePeriodExpired:return"DrainReason_GracePeriodExpired";case k.DrainReason_Unknown:return"DrainReason_Unknown"}}var l=b({DGWVER_GENESIS:0,DGWVER_PREFIXED_APP_HEADERS:1,DGWVER_HANDLES_DGW_DRAIN_FRAME:2,DGWVER_HANDLES_DGW_DEAUTH_FRAME:3,DGWVER_HANDLES_STREAMGROUPS:4,DGWVER_BIG_IDS:5});function c(a){switch(a){case l.DGWVER_GENESIS:return"DGWVER_GENESIS";case l.DGWVER_PREFIXED_APP_HEADERS:return"DGWVER_PREFIXED_APP_HEADERS";case l.DGWVER_HANDLES_DGW_DRAIN_FRAME:return"DGWVER_HANDLES_DGW_DRAIN_FRAME";case l.DGWVER_HANDLES_DGW_DEAUTH_FRAME:return"DGWVER_HANDLES_DGW_DEAUTH_FRAME";case l.DGWVER_HANDLES_STREAMGROUPS:return"DGWVER_HANDLES_STREAMGROUPS";case l.DGWVER_BIG_IDS:return"DGWVER_BIG_IDS"}}var m=b({DgwCodecReturnCode_Success:0,DgwCodecReturnCode_Failure:1,DgwCodecReturnCode_NotEnoughData:2,DgwCodecReturnCode_OutOfMemory:3,DgwCodecReturnCode_AckIdOutOfBounds:4,DgwCodecReturnCode_InvalidParameter:5,DgwCodecReturnCode_InvalidFrameType:6,DgwCodecReturnCode_InvalidAckFrameLength:7,DgwCodecReturnCode_InvalidDrainReason:8,DgwCodecReturnCode_InvalidDataFrameLength:9,DgwCodecReturnCode_InvalidDrainFrameLength:10});function d(a){switch(a){case m.DgwCodecReturnCode_Success:return"DgwCodecReturnCode_Success";case m.DgwCodecReturnCode_Failure:return"DgwCodecReturnCode_Failure";case m.DgwCodecReturnCode_NotEnoughData:return"DgwCodecReturnCode_NotEnoughData";case m.DgwCodecReturnCode_OutOfMemory:return"DgwCodecReturnCode_OutOfMemory";case m.DgwCodecReturnCode_AckIdOutOfBounds:return"DgwCodecReturnCode_AckIdOutOfBounds";case m.DgwCodecReturnCode_InvalidParameter:return"DgwCodecReturnCode_InvalidParameter";case m.DgwCodecReturnCode_InvalidFrameType:return"DgwCodecReturnCode_InvalidFrameType";case m.DgwCodecReturnCode_InvalidAckFrameLength:return"DgwCodecReturnCode_InvalidAckFrameLength";case m.DgwCodecReturnCode_InvalidDrainReason:return"DgwCodecReturnCode_InvalidDrainReason";case m.DgwCodecReturnCode_InvalidDataFrameLength:return"DgwCodecReturnCode_InvalidDataFrameLength";case m.DgwCodecReturnCode_InvalidDrainFrameLength:return"DgwCodecReturnCode_InvalidDrainFrameLength"}}var n=b({DgwFrameType_Data:0,DgwFrameType_SmallAck:1,DgwFrameType_Empty:2,DgwFrameType_Drain:3,DgwFrameType_Deauth:4,DgwFrameType_StreamGroup_DeprecatedEstabStream:5,DgwFrameType_StreamGroup_DeprecatedData:6,DgwFrameType_StreamGroup_SmallAck:7,DgwFrameType_StreamGroup_DeprecatedEndOfData:8,DgwFrameType_Ping:9,DgwFrameType_Pong:10,DgwFrameType_StreamGroup_Ack:12,DgwFrameType_StreamGroup_Data:13,DgwFrameType_StreamGroup_EndOfData:14,DgwFrameType_StreamGroup_EstabStream:15});function e(a){switch(a){case n.DgwFrameType_Data:return"DgwFrameType_Data";case n.DgwFrameType_SmallAck:return"DgwFrameType_SmallAck";case n.DgwFrameType_Empty:return"DgwFrameType_Empty";case n.DgwFrameType_Drain:return"DgwFrameType_Drain";case n.DgwFrameType_Deauth:return"DgwFrameType_Deauth";case n.DgwFrameType_StreamGroup_DeprecatedEstabStream:return"DgwFrameType_StreamGroup_DeprecatedEstabStream";case n.DgwFrameType_StreamGroup_DeprecatedData:return"DgwFrameType_StreamGroup_DeprecatedData";case n.DgwFrameType_StreamGroup_SmallAck:return"DgwFrameType_StreamGroup_SmallAck";case n.DgwFrameType_StreamGroup_DeprecatedEndOfData:return"DgwFrameType_StreamGroup_DeprecatedEndOfData";case n.DgwFrameType_Ping:return"DgwFrameType_Ping";case n.DgwFrameType_Pong:return"DgwFrameType_Pong";case n.DgwFrameType_StreamGroup_Ack:return"DgwFrameType_StreamGroup_Ack";case n.DgwFrameType_StreamGroup_Data:return"DgwFrameType_StreamGroup_Data";case n.DgwFrameType_StreamGroup_EndOfData:return"DgwFrameType_StreamGroup_EndOfData";case n.DgwFrameType_StreamGroup_EstabStream:return"DgwFrameType_StreamGroup_EstabStream"}}b={HEADER_APPID:"x-dgw-appid",HEADER_APPVERSION:"x-dgw-appversion",HEADER_AUTHTYPE:"x-dgw-authtype",HEADER_AUTHTOKEN:"Authorization",HEADER_DGW_VERSION:"x-dgw-version",HEADER_LOGGING_ID:"x-dgw-loggingid",HEADER_REGIONHINT:"x-dgw-regionhint",HEADER_TARGET_TIER:"x-dgw-tier",HEADER_UUID:"x-dgw-uuid",HEADER_ESTABLISH_STREAM_FRAME_BASE64:"x-dgw-establish-stream-frame-base64",kShadowHeader:"x-dgw-shadow",APPHEADER_PREFIX:"x-dgw-app-"};f.DEFAULT_ACK_TIMEOUT_MS=g;f.DEFAULT_SERVICE_TIER=h;f.MAX_ACK_ID=i;f.WebsocketCloseCodes=j;f.DrainReason=k;f.drainReasonToDrainReasonString=a;f.DgwVersion=l;f.dgwVersionToString=c;f.DgwCodecReturnCode=m;f.DgwCodecReturnCodeToString=d;f.DgwFrameType=n;f.frameTypeToString=e;f.HEADER_CONSTANTS=b}),66); __d("DGWEnvUtil",["DGWConstants","URI"],(function(a,b,c,d,e,f,g){"use strict";a=function(){function a(){this.$1="";this.$2="";if(c("URI").isValidURI(window.location.href)){var a=new(c("URI"))(window.location.href);a=a.getDomain();i(a)?(this.$1="gateway.internalfb.com",this.$2="INTERNALFB"):j(a)?(this.$1="gateway.workplace.com",this.$2="FACEBOOK"):m(a)?(this.$1="gateway.facebookenterprise.com",this.$2="ENTERPRISEFB"):n(a)?(this.$1="gateway.metaenterprise.com",this.$2="ENTERPRISEFB"):o(a)?(this.$1="gateway.facebookrecruiting.com",this.$2="RECRUITINGFB"):q(a)?(this.$1="gateway.instagram.com",this.$2="INSTAGRAM"):p(a)?(this.$1="gateway.facebook.com",this.$2="FACEBOOK"):h(a)?(this.$1="gateway.messenger.com",this.$2="FACEBOOK"):r(a)?(this.$1="gateway.bulletin.com",this.$2="BULLETIN"):k(a)?(this.$1="gateway.work.meta.com",this.$2="FACEBOOK"):l(a)?(this.$1="gateway.horizon.meta.com",this.$2="HORIZON_WEB"):s(a)&&(this.$1="gateway.spark.meta.com",this.$2="SPARK_WEB");a=new(c("URI"))().setDomain(this.$1).setProtocol("wss").setPath("/ws");this.$1=a.toString()}}var b=a.prototype;b.isDGWEnvCompatible=function(){return this.$1.length!==0&&this.$2.length!==0};b.getDGWEndpoint=function(){return this.$1};b.getDGWAuthType=function(){return this.$2};b.getDGWVersion=function(){return d("DGWConstants").DgwVersion.DGWVER_BIG_IDS};return a}();function h(a){return a.includes("messenger.com")}function i(a){return a.includes("internalfb.com")}function j(a){return a.includes("workplace.com")}function k(a){return a.includes("work.meta.com")}function l(a){return a.includes("horizon.meta.com")}function m(a){return a.includes("facebookenterprise.com")}function n(a){return a.includes("metaenterprise.com")}function o(a){return a.includes("facebookrecruiting.com")}function p(a){return a.includes("facebook.com")}function q(a){return a.includes("instagram.com")}function r(a){return a.includes("bulletin.com")}function s(a){return a.includes("spark.meta.com")}b=new a();g["default"]=b}),98); __d("DGWRequestStreamDeferredClient",["Promise","nullthrows","requireDeferred"],(function(a,b,c,d,e,f,g){"use strict";a=function(){function a(){this.$1=null}var d=a.prototype;d.createStream=function(a,b,d,e,f){this.$2();return c("nullthrows")(this.$1).then(function(c){return c.createStream(a,b,d,e,f)})};d.$2=function(){this.$1==null&&(this.$1=new(b("Promise"))(function(a){c("requireDeferred")("DGWRequestStreamClient").__setRef("DGWRequestStreamDeferredClient").onReady(function(b){a(new b())})}))};return a}();d=new a();g["default"]=d}),98); __d("EmptyStream",["Promise"],(function(a,b,c,d,e,f){"use strict";a={amendWithoutAck:function(a){},amendWithAck:function(a){return new(b("Promise"))(function(){return!1})},cancel:function(){},start:function(){return new(b("Promise"))(function(){return null})}};c=a;f["default"]=c}),66); __d("RequestStreamCommonRequestStreamCommonTypes",["$InternalEnum"],(function(a,b,c,d,e,f){"use strict";c=(a=b("$InternalEnum"))({Accepted:1,Started:2,Stopped:3});d=a({Rejected:40,Error:50,TryAgain:80,Closed:99});f=a({BestEffort:0,Socket:10,Device:20});b=a({Flow_status:"flow_status",Log:"log",Rewrite:"rewrite",Data:"data",Termination:"termination",Amend_ack:"amend_ack"});e.exports={AckLevel:f,FlowStatus:c,StreamResponseDelta$Types:b,TerminationReason:d}}),null); __d("MQTTRequestStreamUtils",["BladeRunnerStreamHandler","BladeRunnerStreamStatus","RequestStreamCommonRequestStreamCommonTypes"],(function(a,b,c,d,e,f,g){"use strict";var h="Stream closed",i="Stream rejected";function a(a){var b=function(b){switch(b){case d("BladeRunnerStreamStatus").StreamStatus.ACCEPTED:a.onFlowStatus(d("RequestStreamCommonRequestStreamCommonTypes").FlowStatus.Accepted);break;case d("BladeRunnerStreamStatus").StreamStatus.STARTED:a.onFlowStatus(d("RequestStreamCommonRequestStreamCommonTypes").FlowStatus.Started);break;case d("BladeRunnerStreamStatus").StreamStatus.STOPPED:a.onFlowStatus(d("RequestStreamCommonRequestStreamCommonTypes").FlowStatus.Stopped);break;case d("BladeRunnerStreamStatus").StreamStatus.CLOSED:a.onTermination(h);break;case d("BladeRunnerStreamStatus").StreamStatus.REJECTED:a.onTermination(i);break}};return new(c("BladeRunnerStreamHandler"))(function(b){return a.onData(b)},null,b,function(b){return a.onLog(b)},null,function(){return a.onRetryUpdateRequestBody()})}g.TERMINATION_REASON_CLOSED=h;g.TERMINATION_REASON_REJECTED=i;g.convertToBRHandler=a}),98); __d("TransportSelectingClientCCResolver",["Promise","TransportSelectingClientContextualConfig","nullthrows","regeneratorRuntime","requireDeferred"],(function(a,b,c,d,e,f,g){a=function(){function a(){this.$1=null}var d=a.prototype;d.getCCGroupName=function(a){var d,e;return b("regeneratorRuntime").async(function(f){while(1)switch(f.prev=f.next){case 0:this.$2();f.next=3;return b("regeneratorRuntime").awrap(c("nullthrows")(this.$1));case 3:d=f.sent;e=new d(JSON.parse(c("TransportSelectingClientContextualConfig").rawConfig)).resolve({method:a});return f.abrupt("return",e.get("group","default_group"));case 6:case"end":return f.stop()}},null,this)};d.getCCDGWUpsampleMultiplier=function(a){var d,e;return b("regeneratorRuntime").async(function(f){while(1)switch(f.prev=f.next){case 0:this.$2();f.next=3;return b("regeneratorRuntime").awrap(c("nullthrows")(this.$1));case 3:d=f.sent;e=new d(JSON.parse(c("TransportSelectingClientContextualConfig").rawConfig)).resolve({method:a});return f.abrupt("return",e.get("dgwUpsampleMultiplier",1));case 6:case"end":return f.stop()}},null,this)};d.$2=function(){this.$1==null&&(this.$1=new(b("Promise"))(function(a){c("requireDeferred")("ContextualConfig").__setRef("TransportSelectingClientCCResolver").onReady(function(b){a(b)})}))};return a}();d=new a();g["default"]=d}),98); __d("TransportSelectingClientUtils",["BladeRunnerInstrumentedStreamHandler","DGWEnvUtil","MQTTRequestStreamUtils","TransportSelectingClientCCResolver","gkx","justknobx","regeneratorRuntime"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b){a=d("MQTTRequestStreamUtils").convertToBRHandler(a);if(b.startsWith("FBGQLS")||b.startsWith("SKY"))return new(c("BladeRunnerInstrumentedStreamHandler"))(a,b);else return a}function e(a){var b=!1;switch(a){case"group1":b=c("gkx")("227");break;case"group2":b=c("gkx")("229");break;case"group3":b=c("gkx")("231");break;case"group4":b=c("gkx")("233");break;case"group5":b=c("gkx")("235");break;case"group6":b=c("gkx")("2254");break}return b}function h(a){var b=!1;switch(a){case"skywalker":b=c("gkx")("2030");break;case"skywalker_experiment1":b=c("gkx")("2448");break;case"skywalker_experiment2":b=c("gkx")("2458");break;case"skywalker_bulletin":b=c("justknobx")._("494");break}return b}function i(a){if(a!=null){var b=a.lastIndexOf("/");b=b>0?a.substr(0,b):a;return b}}function f(a){var d,e;return b("regeneratorRuntime").async(function(f){while(1)switch(f.prev=f.next){case 0:d=i(a);if(!(d!=null)){f.next=6;break}f.next=4;return b("regeneratorRuntime").awrap(c("TransportSelectingClientCCResolver").getCCGroupName(d));case 4:e=f.sent;return f.abrupt("return",h(e)&&c("DGWEnvUtil").isDGWEnvCompatible());case 6:return f.abrupt("return",!1);case 7:case"end":return f.stop()}},null,this)}function j(a,b){b=i(b);return a!=null&&a==="SKY"&&b!=null?b:(b=a)!=null?b:"unknown"}g.BRHandlerConverter=a;g.isDGWStream=e;g.isDGWAllowedSKYTopic=h;g.getTopicPrefix=i;g.isDGWSupportedSKYTopic=f;g.getMethodContextForCC=j}),98); __d("ThrottlingClient",["EmptyStream","Promise","RtiWebRequestStreamClient","TransportSelectingClientUtils","gkx"],(function(a,b,c,d,e,f,g){a=function(){function a(a){this.$2=c("RtiWebRequestStreamClient").ThrottledMethods,this.$1=a}var e=a.prototype;e.createStream=function(a,e,f,g,h){var i=d("TransportSelectingClientUtils").getMethodContextForCC(a.method,a.topic);if(c("gkx")("1682")&&this.$2[i]){g.onTermination("RequestStream method "+i+" has been throttled on this client");return b("Promise").resolve(c("EmptyStream"))}return this.$1.createStream(a,e,f,g,h)};return a}();g["default"]=a}),98); __d("TransportSelectingClient",["BladeRunnerDeferredClient","DGWEnvUtil","DGWRequestStreamDeferredClient","RequestStreamHandler","ThrottlingClient","TransportSelectingClientUtils","regeneratorRuntime"],(function(a,b,c,d,e,f,g){a=function(){function a(){this.$1=null,c("DGWRequestStreamDeferredClient")!=null&&(this.$2=new(c("ThrottlingClient"))(c("DGWRequestStreamDeferredClient")))}var e=a.prototype;e.requestStream=function(a,e,f,g){var h,i,j,k,l;return b("regeneratorRuntime").async(function(m){while(1)switch(m.prev=m.next){case 0:i=new(c("RequestStreamHandler"))(f);j=this.$2;if(!(j!=null&&c("DGWEnvUtil").isDGWEnvCompatible())){m.next=9;break}m.next=5;return b("regeneratorRuntime").awrap(j.createStream(a,e,g,i,{}));case 5:k=m.sent;m.next=8;return b("regeneratorRuntime").awrap(k.start());case 8:return m.abrupt("return",k);case 9:m.next=11;return b("regeneratorRuntime").awrap(c("BladeRunnerDeferredClient").requestStream(a,e,d("TransportSelectingClientUtils").BRHandlerConverter(i,(h=a.method)!=null?h:"unknown"),g));case 11:l=m.sent;return m.abrupt("return",l);case 13:case"end":return m.stop()}},null,this)};return a}();g["default"]=a}),98); __d("TransportSelectingClientSingleton",["TransportSelectingClient"],(function(a,b,c,d,e,f,g){"use strict";a=new(c("TransportSelectingClient"))();g["default"]=a}),98); __d("TWriteBuffer",[],(function(a,b,c,d,e,f){a=function(){function a(b){b===void 0&&(b=a.DEFAULT_BYTE_BUFFER_SIZE),this.$1=new DataView(new ArrayBuffer(b)),this.$2=0}var b=a.prototype;b.write=function(a){this.$2+a.length>this.$1.byteLength&&this.$3(this.$2+a.length);for(var b=0;bthis.$1.byteLength&&this.$3(this.$2+1);this.$1.setUint8(this.$2,a);this.$2++;return 1};b.writeFloatBE=function(a){this.$2+Float32Array.BYTES_PER_ELEMENT>this.$1.byteLength&&this.$3(this.$2+Float32Array.BYTES_PER_ELEMENT);this.$1.setFloat32(this.$2,a);this.$2+=Float32Array.BYTES_PER_ELEMENT;return Float32Array.BYTES_PER_ELEMENT};b.writeDoubleBE=function(a){this.$2+Float64Array.BYTES_PER_ELEMENT>this.$1.byteLength&&this.$3(this.$2+Float64Array.BYTES_PER_ELEMENT);this.$1.setFloat64(this.$2,a);this.$2+=Float64Array.BYTES_PER_ELEMENT;return Float64Array.BYTES_PER_ELEMENT};b.toByteArray=function(){var a=new Uint8Array(this.$1.buffer,0,this.$2);return a};b.currentSize=function(){return this.$2};b.getUnderlyingDataView=function(){return this.$1};b.$3=function(a){a=a*2;if(!Number.isSafeInteger(a))throw new Error("unable to resize");a=new DataView(new ArrayBuffer(a));for(var b=0;b>6|192),b.writeByte(d&63|128);else if((d&64512)==55296){if(e+1>=a.length)throw new Error("UTF-16 string is truncated: ["+d.toString(16)+"]");if((a.charCodeAt(e+1)&64512)!==56320)throw new Error("Invalid UTF-16 string: ["+d.toString(16)+", "+a.charCodeAt(e+1).toString(16)+"]");d=65536+((d&1023)<<10)+(a.charCodeAt(++e)&1023);b.writeByte(d>>18|240);b.writeByte(d>>12&63|128);b.writeByte(d>>6&63|128);b.writeByte(d&63|128)}else b.writeByte(d>>12|224),b.writeByte(d>>6&63|128),b.writeByte(d&63|128)}return b.toByteArray()};g.StringToUtf8=a}),98); __d("ThriftTypes",[],(function(a,b,c,d,e,f){a=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});b=a;f["default"]=b}),66); __d("Utf8ToString",[],(function(a,b,c,d,e,f){var g=function(a,b){throw new Error(a+": ["+b.map(function(a){return a.toString(16)}).toString()+"]")},h=function(a){g("Invalid UTF-8 sequence",a)},i=function(a,b){g("Not enough bytes for "+a+"-byte sequence",b)};a=function(a){var b=0,c=[];while(b=128&&d<194)h([d]);else if(d>=194&&d<224){b>=a.length&&i(2,[d]);var e=a[b++];(e&192)!==128&&h([d,e]);c.push(String.fromCharCode((d&31)<<6|e&63))}else if(d>=240&&d<245){b+2>=a.length&&i(4,[d]);e=a[b++];var f=a[b++],g=a[b++];(d==240&&(!(e>=144&&e<192)||(f&192)!==128||(g&192)!==128)||d>=241&&d<244&&((e&192)!==128||(f&192)!==128||(g&192)!==128)||d==244&&(!(e>=128&&e<144)||(f&192)!==128||(g&192)!==128))&&h([d,e,f,g]);e=((d&7)<<18|(e&63)<<12|(f&63)<<6|g&63)-65536;c.push(String.fromCharCode(55296+(e>>10)));c.push(String.fromCharCode(56320+(e&1023)))}else if(d>=245)h([d]);else{b+1>=a.length&&i(3,[d]);f=a[b++];g=a[b++];d==224?f>=160&&f<192||h([d,f,g]):d>=225&&d<237?f>=128&&f<192||h([d,f,g]):d==237?f>=128&&f<160||h([d,f,g]):d>=238&&d<240&&(f>=128&&f<192||h([d,f,g]));g>=128&&g<192||h([d,f,g]);c.push(String.fromCharCode((d&15)<<12|(f&63)<<6|g&63))}}return c.join("")};f.Utf8ToString=a}),66); __d("jsbi",[],(function(a,b,c,d,e,f){(function(a,b){"object"==typeof f&&"undefined"!=typeof e?e.exports=b():"function"==typeof define&&define.amd?define(b):a.JSBI=b()})(this,function(){"use strict";function a(b){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},a(b)}function b(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function c(a,b){for(var c,d=0;dg.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded");return a=m(this,f(g).call(this,a)),a.sign=c,a}return e(g,c),d(g,[{key:"toDebugString",value:function(){var a=["BigInt["],b=!0,c=!1,d=void 0;try{for(var e,e,f=this[Symbol.iterator]();!(b=(e=f.next()).done);b=!0)e=e.value,a.push((e?(e>>>0).toString(16):e)+", ")}catch(a){c=!0,d=a}finally{try{b||null==f["return"]||f["return"]()}finally{if(c)throw d}}return a.push("]"),a.join("")}},{key:"toString",value:function(){var a=0a||36this.length&&(c=this.length);for(var d=65535&a,a=a>>>16,e=0,f=65535&b,b=b>>>16,i=0;i>>16;var o=j(m,d);m=j(m,a);var p=j(n,d);n=j(n,a);var q=f+(65535&o);o=b+e+(q>>>16)+(o>>>16)+(65535&m)+(65535&p);f=(m>>>16)+(p>>>16)+(65535&n)+(o>>>16),e=f>>>16,f&=65535,b=n>>>16;this.__setDigit(i,65535&q|o<<16)}if(0!==e||0!==f||0!==b)throw new Error("implementation bug")}},{key:"__inplaceAdd",value:function(a,b,c){for(var d,e=0,f=0;f>>16,this.__setHalfDigit(b+f,d);return e}},{key:"__inplaceSub",value:function(a,b,c){var d=0;if(1&b){b>>=1;for(var e=this.__digit(b),f=65535&e,k=0;k>>1;k++){var l=a.__digit(k),m=(e>>>16)-(65535&l)-d;d=1&m>>>16,this.__setDigit(b+k,m<<16|65535&f),e=this.__digit(b+k+1),f=(65535&e)-(l>>>16)-d,d=1&f>>>16}m=a.__digit(k);l=(e>>>16)-(65535&m)-d;d=1&l>>>16,this.__setDigit(b+k,l<<16|65535&f);if(b+k+1>=this.length)throw new RangeError("out of bounds");0==(1&c)&&(e=this.__digit(b+k+1),f=(65535&e)-(m>>>16)-d,d=1&f>>>16,this.__setDigit(b+a.length,4294901760&e|65535&f))}else{b>>=1;for(l=0;l>>16;f=(k>>>16)-(m>>>16)-d;d=1&f>>>16,this.__setDigit(b+l,f<<16|65535&e)}k=this.__digit(b+l);m=a.__digit(l);f=(65535&k)-(65535&m)-d;d=1&f>>>16;e=0;0==(1&c)&&(e=(k>>>16)-(m>>>16)-d,d=1&e>>>16),this.__setDigit(b+l,e<<16|65535&f)}return d}},{key:"__inplaceRightShift",value:function(a){if(0!==a){for(var b,c=this.__digit(0)>>>a,d=this.length-1,e=0;e>>a;this.__setDigit(d,c)}}},{key:"__digit",value:function(a){return this[a]}},{key:"__unsignedDigit",value:function(a){return this[a]>>>0}},{key:"__setDigit",value:function(a,b){this[a]=0|b}},{key:"__setDigitGrow",value:function(a,b){this[a]=0|b}},{key:"__halfDigitLength",value:function(){var a=this.length;return 65535>=this.__unsignedDigit(a-1)?2*a-1:2*a}},{key:"__halfDigit",value:function(a){return 65535&this[a>>>1]>>>((1&a)<<4)}},{key:"__setHalfDigit",value:function(a,b){var c=a>>>1,d=this.__digit(c);a=1&a?65535&d|b<<16:4294901760&d|65535&b;this.__setDigit(c,a)}}],[{key:"BigInt",value:function(b){var c=Math.floor,d=Number.isFinite;if("number"==typeof b){if(0===b)return g.__zero();if((0|b)===b)return 0>b?g.__oneDigit(-b,!0):g.__oneDigit(b,!1);if(!d(b)||c(b)!==b)throw new RangeError("The number "+b+" cannot be converted to BigInt because it is not an integer");return g.__fromDouble(b)}if("string"==typeof b){d=g.__fromString(b);if(null===d)throw new SyntaxError("Cannot convert "+b+" to a BigInt");return d}if("boolean"==typeof b)return!0===b?g.__oneDigit(1,!1):g.__zero();if("object"===a(b)){if(b.constructor===g)return b;c=g.__toPrimitive(b);return g.BigInt(c)}throw new TypeError("Cannot convert "+b+" to a BigInt")}},{key:"toNumber",value:function(a){var b=a.length;if(0===b)return 0;if(1===b){var c=a.__unsignedDigit(0);return a.sign?-c:c}c=a.__digit(b-1);var d=k(c),e=32*b-d;if(1024>>=12;var h=d-12,i=12<=d?0:c<<20+d;d=20+d;0>>32-h,i=c<>>32-d,d-=32);h=g.__decideRounding(a,d,b,c);if((1===h||0===h&&1==(1&i))&&(i=i+1>>>0,0===i&&(f++,0!=f>>>20&&(f=0,e++,1023=g.__kMaxLengthBits)throw new RangeError("BigInt too big");if(1===a.length&&2===a.__digit(0)){var c=1+(b>>>5),d=a.sign&&0!=(1&b);d=new g(c,d);d.__initializeDigits();var e=1<<(31&b);return d.__setDigit(c-1,e),d}c=null;e=a;for(0!=(1&b)&&(c=a),b>>=1;0!==b;b>>=1)e=g.multiply(e,e),0!=(1&b)&&(null===c?c=e:c=g.multiply(c,e));return c}},{key:"multiply",value:function(a,b){if(0===a.length)return a;if(0===b.length)return b;var c=a.length+b.length;32<=a.__clzmsd()+b.__clzmsd()&&c--;c=new g(c,a.sign!==b.sign);c.__initializeDigits();for(var d=0;dg.__absoluteCompare(a,b))return g.__zero();var c=a.sign!==b.sign,d=b.__unsignedDigit(0);if(1===b.length&&65535>=d){if(1===d)return c===a.sign?a:g.unaryMinus(a);d=g.__absoluteDivSmall(a,d,null)}else d=g.__absoluteDivLarge(a,b,!0,!1);return d.sign=c,d.__trim()}},{key:"remainder",value:function(a,b){if(0===b.length)throw new RangeError("Division by zero");if(0>g.__absoluteCompare(a,b))return a;var c=b.__unsignedDigit(0);if(1===b.length&&65535>=c){if(1===c)return g.__zero();c=g.__absoluteModSmall(a,c);return 0===c?g.__zero():g.__oneDigit(c,a.sign)}c=g.__absoluteDivLarge(a,b,!1,!0);return c.sign=a.sign,c.__trim()}},{key:"add",value:function(a,b){var c=a.sign;return c===b.sign?g.__absoluteAdd(a,b,c):0<=g.__absoluteCompare(a,b)?g.__absoluteSub(a,b,c):g.__absoluteSub(b,a,!c)}},{key:"subtract",value:function(a,b){var c=a.sign;return c===b.sign?0<=g.__absoluteCompare(a,b)?g.__absoluteSub(a,b,c):g.__absoluteSub(b,a,!c):g.__absoluteAdd(a,b,c)}},{key:"leftShift",value:function(a,b){return 0===b.length||0===a.length?a:b.sign?g.__rightShiftByAbsolute(a,b):g.__leftShiftByAbsolute(a,b)}},{key:"signedRightShift",value:function(a,b){return 0===b.length||0===a.length?a:b.sign?g.__leftShiftByAbsolute(a,b):g.__rightShiftByAbsolute(a,b)}},{key:"unsignedRightShift",value:function(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}},{key:"lessThan",value:function(a,b){return 0>g.__compareToBigInt(a,b)}},{key:"lessThanOrEqual",value:function(a,b){return 0>=g.__compareToBigInt(a,b)}},{key:"greaterThan",value:function(a,b){return 0=g.__kMaxLengthBits)return b;var c=a+31>>>5;if(b.lengthg.__kMaxLengthBits)throw new RangeError("BigInt too big");return g.__truncateAndSubFromPowerOfTwo(a,b,!1)}if(a>=g.__kMaxLengthBits)return b;var c=a+31>>>5;if(b.length>>d)return b}return g.__truncateToNBits(a,b)}},{key:"ADD",value:function(a,b){if(a=g.__toPrimitive(a),b=g.__toPrimitive(b),"string"==typeof a)return"string"!=typeof b&&(b=b.toString()),a+b;if("string"==typeof b)return a.toString()+b;if(a=g.__toNumeric(a),b=g.__toNumeric(b),g.__isBigInt(a)&&g.__isBigInt(b))return g.add(a,b);if("number"==typeof a&&"number"==typeof b)return a+b;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}},{key:"LT",value:function(a,b){return g.__compare(a,b,0)}},{key:"LE",value:function(a,b){return g.__compare(a,b,1)}},{key:"GT",value:function(a,b){return g.__compare(a,b,2)}},{key:"GE",value:function(a,b){return g.__compare(a,b,3)}},{key:"EQ",value:function(b,c){for(;;){if(g.__isBigInt(b))return g.__isBigInt(c)?g.equal(b,c):g.EQ(c,b);if("number"==typeof b){if(g.__isBigInt(c))return g.__equalToNumber(c,b);if("object"!==a(c))return b==c;c=g.__toPrimitive(c)}else if("string"==typeof b){if(g.__isBigInt(c))return b=g.__fromString(b),null!==b&&g.equal(b,c);if("object"!==a(c))return b==c;c=g.__toPrimitive(c)}else if("boolean"==typeof b){if(g.__isBigInt(c))return g.__equalToNumber(c,+b);if("object"!==a(c))return b==c;c=g.__toPrimitive(c)}else if("symbol"===a(b)){if(g.__isBigInt(c))return!1;if("object"!==a(c))return b==c;c=g.__toPrimitive(c)}else if("object"===a(b)){if("object"===a(c)&&c.constructor!==g)return b==c;b=g.__toPrimitive(b)}else return b==c}}},{key:"NE",value:function(a,b){return!g.EQ(a,b)}},{key:"__zero",value:function(){return new g(0,!1)}},{key:"__oneDigit",value:function(a,b){b=new g(1,b);return b.__setDigit(0,a),b}},{key:"__decideRounding",value:function(a,b,c,d){if(0b)b=-b-1;else{if(0===c)return-1;c--,d=a.__digit(c),b=31}b=1<>>20;c=c-1023;var d=(c>>>5)+1;a=new g(d,0>a);var e=1048575&g.__kBitConversionInts[1]|1048576,f=g.__kBitConversionInts[0],k=20;c=31&c;var n=0;if(c>>m,e=e<<32-m|f>>>m,f<<=32-m}else if(c===k)n=32,b=e,e=f;else{m=c-k;n=32-m,b=e<>>32-m,e=f<=a&&9<=a)||(159>=a?32==a:131071>=a?160==a||5760==a:196607>=a?(a&=131071,10>=a||40==a||41==a||47==a||95==a||4096==a):65279==a)}},{key:"__fromString",value:function(a){var b=11073741824/i)return null;var k=i*m+j>>>g.__kBitsPerCharTableShift,l=new g(k+31>>>5,!1),n=10>b?b:10,o=10>=g.__kBitsPerCharTableShift;var p=[],q=[],r=!1;do{for(var s,t=0,u=0;;){if(void 0,f-48>>>0>>0>>0>>0>>g.__kBitsPerCharTableShift+5;l.__inplaceMultiplyAdd(z,y,B)}while(!v)}if(e!==d){if(!g.__isWhitespace(f))return null;for(e++;e>>m-f)}if(0!==e){if(d>=a.length)throw new Error("implementation bug");a.__setDigit(d++,e)}for(;d>>1)+(85&d),d=(51&d>>>2)+(51&d),d=(15&d>>>4)+(15&d);d=d;b=b-1;var e=a.__digit(c-1),f=k(e);f=0|(32*c-f+d-1)/d;if(a.sign&&f++,268435456>>q,n=32-q;n>=d;)h[f--]=g.__kConversionChars[l&b],l>>>=d,n-=d}p=(l|e<>>d-n;0!==l;)h[f--]=g.__kConversionChars[l&b],l>>>=d;if(a.sign&&(h[f--]="-"),-1!==f)throw new Error("implementation bug");return h.join("")}},{key:"__toStringGeneric",value:function(a,b,c){var d=a.length;if(0===d)return"";if(1===d){var e=a.__unsignedDigit(0).toString(b);return!1===c&&a.sign&&(e="-"+e),e}e=32*d-k(a.__digit(d-1));d=g.__kMaxBitsPerChar[b];d=d-1;e=e*g.__kBitsPerCharTableMultiplier;e+=d-1,e=0|e/d;var f;d=e+1>>1;e=g.exponentiate(g.__oneDigit(b,!1),g.__oneDigit(d,!1));var h=e.__unsignedDigit(0);if(1===e.length&&65535>=h){f=new g(a.length,!1),f.__initializeDigits();for(var i,j=0,l=2*a.length-1;0<=l;l--)i=j<<16|a.__halfDigit(l),f.__setHalfDigit(l,0|i/h),j=0|i%h;i=j.toString(b)}else{h=g.__absoluteDivLarge(a,e,!0,!0);f=h.quotient;l=h.remainder.__trim();i=g.__toStringGeneric(l,b,!0)}f.__trim();for(j=g.__toStringGeneric(f,b,!0);i.lengtha?g.__absoluteLess(c):0}},{key:"__compareToNumber",value:function(a,b){if(!0|b){var c=a.sign,d=0>b;if(c!==d)return g.__unequalSign(c);if(0===a.length){if(d)throw new Error("implementation bug");return 0===b?0:-1}if(1d?g.__absoluteGreater(c):eb)return g.__unequalSign(c);if(0===b)throw new Error("implementation bug: should be handled elsewhere");if(0===a.length)return-1;g.__kBitConversionDouble[0]=b;b=2047&g.__kBitConversionInts[1]>>>20;if(2047==b)throw new Error("implementation bug: handled elsewhere");b=b-1023;if(0>b)return g.__absoluteGreater(c);var d=a.length,e=a.__digit(d-1),f=k(e),l=32*d-f;b=b+1;if(lb)return g.__absoluteGreater(c);b=1048576|1048575&g.__kBitConversionInts[1];var m=g.__kBitConversionInts[0],o=20;f=31-f;if(f!==(l-1)%31)throw new Error("implementation bug");var p;l=0;if(f>>q,b=b<<32-q|m>>>q,m<<=32-q}else if(f===o)l=32,p=b,b=m;else{q=f-o;l=32-q,p=b<>>32-q,b=m<>>=0,p>>>=0,e>p)return g.__absoluteGreater(c);if(e>>0,b=m,m=0):p=0;o=a.__unsignedDigit(f);if(o>p)return g.__absoluteGreater(c);if(ob&&a.__unsignedDigit(0)===h(b):0===g.__compareToDouble(a,b)}},{key:"__comparisonResultToBool",value:function(a,b){switch(b){case 0:return 0>a;case 1:return 0>=a;case 2:return 0b;case 3:return a>=b}if(g.__isBigInt(a)&&"string"==typeof b)return b=g.__fromString(b),null!==b&&g.__comparisonResultToBool(g.__compareToBigInt(a,b),c);if("string"==typeof a&&g.__isBigInt(b))return a=g.__fromString(a),null!==a&&g.__comparisonResultToBool(g.__compareToBigInt(a,b),c);if(a=g.__toNumeric(a),b=g.__toNumeric(b),g.__isBigInt(a)){if(g.__isBigInt(b))return g.__comparisonResultToBool(g.__compareToBigInt(a,b),c);if("number"!=typeof b)throw new Error("implementation bug");return g.__comparisonResultToBool(g.__compareToNumber(a,b),c)}if("number"!=typeof a)throw new Error("implementation bug");if(g.__isBigInt(b))return g.__comparisonResultToBool(g.__compareToNumber(b,a),2^c);if("number"!=typeof b)throw new Error("implementation bug");return 0===c?ab:3===c?a>=b:void 0}},{key:"__absoluteAdd",value:function(a,b,c){if(a.length>>16)+(f>>>16)+(m>>>16);c=h>>>16,d.__setDigit(e,65535&m|h<<16)}for(;e>>16)+(m>>>16);c=h>>>16,d.__setDigit(e,65535&m|h<<16)}return e>>16;f=(f>>>16)-(l>>>16)-d;d=1&f>>>16,c.__setDigit(e,65535&m|f<<16)}for(;e>>16;f=(l>>>16)-d;d=1&f>>>16,c.__setDigit(e,65535&m|f<<16)}return c.__trim()}},{key:"__absoluteAddOne",value:function(a,b){var c=2c?0:a.__unsignedDigit(c)>b.__unsignedDigit(c)?1:-1}},{key:"__multiplyAccumulate",value:function(a,b,c,d){if(0!==b){for(var e=65535&b,b=b>>>16,f=0,g=0,k=0,l=0;l>>16,p=a.__digit(l),q=65535&p;p=p>>>16;var r=j(q,e);q=j(q,b);var s=j(p,e);p=j(p,b);n+=g+(65535&r),o+=k+f+(n>>>16)+(r>>>16)+(65535&q)+(65535&s),f=o>>>16,g=(q>>>16)+(s>>>16)+(65535&p)+f,f=g>>>16,g&=65535,k=p>>>16,m=65535&n|o<<16,c.__setDigit(d,m)}for(;0!==f||0!==g||0!==k;d++){r=c.__digit(d);q=(65535&r)+g;s=(r>>>16)+(q>>>16)+k+f;g=0,k=0,f=s>>>16,r=65535&q|s<<16,c.__setDigit(d,r)}}}},{key:"__internalMultiplyAdd",value:function(a,b,c,d,e){for(var c=c,f=0,h=0;h>>16;l=j(l>>>16,b);m=(65535&l)+(m>>>16)+c;c=m>>>16,f=l>>>16,e.__setDigit(h,m<<16|65535&n)}if(e.length>d)for(e.__setDigit(d++,c+f);d>>0,k=0|f/b;d=0|f%b,f=(d<<16|a.__halfDigit(e-1))>>>0;var l=0|f/b;d=0|f%b,c.__setDigit(e>>>1,k<<16|l)}return c}},{key:"__absoluteModSmall",value:function(a,b){for(var c,d=0,e=2*a.length-1;0<=e;e--)c=(d<<16|a.__halfDigit(e))>>>0,d=0|c%b;return d}},{key:"__absoluteDivLarge",value:function(a,b,c,d){var f=b.__halfDigitLength(),e=b.length,n=a.__halfDigitLength()-f,i=null;c&&(i=new g(n+2>>>1,!1),i.__initializeDigits());var l=new g(f+2>>>1,!1);l.__initializeDigits();var m=g.__clz16(b.__halfDigit(f-1));0>>0;p=0|q/k;for(var q=0|q%k,r=b.__halfDigit(f-2),s=a.__halfDigit(n+f-2);j(p,r)>>>0>(q<<16|s)>>>0&&(p--,q+=k,!(65535>>1,o|p))}return d?(a.__inplaceRightShift(m),c?{quotient:i,remainder:a}:a):c?i:void 0}},{key:"__clz16",value:function(a){return k(a)-16}},{key:"__specialLeftShift",value:function(a,b,c){var e=a.length,d=new g(e+c,!1);if(0===b){for(var f=0;f>>32-b;return 0b)throw new RangeError("BigInt too big");var c=b>>>5;b=31&b;var d=a.length,e=0!==b&&0!=a.__digit(d-1)>>>32-b,f=d+c+(e?1:0),m=new g(f,a.sign);if(0===b){for(var n=0;n>>32-b;if(e)m.__setDigit(d+c,n);else if(0!==n)throw new Error("implementation bug")}return m.__trim()}},{key:"__rightShiftByAbsolute",value:function(a,b){var c=a.length,d=a.sign;b=g.__toShiftAmount(b);if(0>b)return g.__rightShiftByMaximum(d);var e=b>>>5;b=31&b;var f=c-e;if(0>=f)return g.__rightShiftByMaximum(d);var i=!1;if(d)if(0!=(a.__digit(e)&(1<>>b,f=c-e-1,c=0;c>>b;m.__setDigit(f,d)}return i&&(m=g.__absoluteAddOne(m,!0,m)),m.__trim()}},{key:"__rightShiftByMaximum",value:function(a){return a?g.__oneDigit(1,!0):g.__zero()}},{key:"__toShiftAmount",value:function(a){if(1g.__kMaxLengthBits?-1:a}},{key:"__toPrimitive",value:function(b){var c=1>>5,d=new g(c,b.sign),c=c-1,e=0;e>>b}return d.__setDigit(c,e),d.__trim()}},{key:"__truncateAndSubFromPowerOfTwo",value:function(a,b,c){for(var d=Math.min,e=a+31>>>5,c=new g(e,c),f=0,e=e-1,h=0,d=d(e,b.length);f>>16;j=0-(j>>>16)-h;h=1&j>>>16,c.__setDigit(f,65535&l|j<<16)}for(;f>>16;f=0-(l>>>16)-h;b=65535&d|f<<16}else{a=32-j;l=l<>>a;d=1<<32-a;f=(65535&d)-(65535&l)-h;h=1&f>>>16;j=(d>>>16)-(l>>>16)-h;b=65535&f|j<<16,b&=d-1}return c.__setDigit(e,b),c.__trim()}},{key:"__digitPow",value:function(a,b){for(var c=1;0>>=1,a*=a;return c}}]),g}(k(Array));return n.__kMaxLength=33554432,n.__kMaxLengthBits=n.__kMaxLength<<5,n.__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],n.__kBitsPerCharTableShift=5,n.__kBitsPerCharTableMultiplier=1<this.$3&&a.fid-this.$3<=B-1?c+=this.$1.writeByte(a.fid-this.$3<<4|b):(c+=this.$1.writeByte(b),c+=this.writeI16(a.fid));this.$3=a.fid;return c};b.$8=function(a){var b=0,c=this.$9(a.etype);a.size<=B-2?b+=this.$1.writeByte(a.size<<4|c):(b+=this.$1.writeByte(240|c),b+=this.writeVarint32(a.size));return b};b.readFieldBegin=function(){var a=this.$1.readByte(),b=a&15;if(b===c("ThriftTypes").STOP)return{ftype:c("ThriftTypes").STOP,fid:0};a=(a&240)>>>4;var d;a===0?d=this.readI16():d=this.$3+a;a=this.$10(b);(b===h.CT_BOOLEAN_TRUE||b===h.CT_BOOLEAN_FALSE)&&(this.$5=b===h.CT_BOOLEAN_TRUE);this.$3=d;return{ftype:a,fid:d}};b.readListBegin=function(){return this.$11()};b.readListEnd=function(){return 0};b.readSetBegin=function(){return this.$11()};b.readSetEnd=function(){return 0};b.readMapBegin=function(){var a=this.readVarint32();if(a>0){var b=this.$1.readByte(),c=this.$12(b>>4,"readMapBegin:key");b=this.$12(b&15,"readMapBegin:value");return{ktype:this.$10(c),vtype:this.$10(b),size:a}}return{size:a}};b.readMapEnd=function(){return 0};b.$12=function(a,b){if(a<0||a>13)throw new Error(b+" read invalid compact type: "+a);return a};b.$11=function(){var a=this.$1.readByte(),b=this.$12(a&15,"_readListOrSetBegin");b=this.$10(b);a=a>>4&15;a===15&&(a=this.readVarint32());return{etype:b,size:a}};b.readFieldEnd=function(){return 0};b.readByte=function(){this.$6.setUint8(0,this.$1.readByte());return this.$6.getInt8(0)};b.writeByte=function(a){if(ak)throw new Error("byte to write is out of range: "+a);this.$6.setInt8(0,a);return this.$1.writeByte(this.$6.getUint8(0))};b.readFloat=function(){return this.$1.readFloatBE()};b.writeFloat=function(a){return this.$1.writeFloatBE(a)};b.readDouble=function(){return this.$1.readDoubleBE()};b.writeDouble=function(a){return this.$1.writeDoubleBE(a)};b.writeString=function(a){return this.writeBinary(d("StringToUtf8").StringToUtf8(a))};b.skip=function(a){switch(a){case c("ThriftTypes").STOP:return;case c("ThriftTypes").BOOL:this.readBool();break;case c("ThriftTypes").BYTE:this.readByte();break;case c("ThriftTypes").DOUBLE:this.readDouble();break;case c("ThriftTypes").I16:this.readI16();break;case c("ThriftTypes").I32:this.readI32();break;case c("ThriftTypes").I64:this.readI64();break;case c("ThriftTypes").STRING:this.readString();break;case c("ThriftTypes").STRUCT:this.readStructBegin();var b;while(!0){b=this.readFieldBegin();if(b.ftype===c("ThriftTypes").STOP)break;this.skip(b.ftype)}this.readStructEnd();break;case c("ThriftTypes").MAP:b=this.readMapBegin();if(b.size>0&&b.ktype!=null&&b.vtype!=null){var d=b.ktype,e=b.vtype;for(var f=0;fm)throw new Error("trying to write i16 out of range: "+a);return this.writeVarint32(this.i32ToZigzag(a))};b.readI16=function(){var a=this.zigzagToI32(this.readVarint32());if(am)throw new Error("read invalid i16: "+a);return a};b.writeI32=function(a){if(ao)throw new Error("i32 out of range: "+a);return this.writeVarint32(this.i32ToZigzag(a))};b.readI32=function(){return this.zigzagToI32(this.readVarint32())};b.writeI64=function(a){return this.writeVarint64(this.i64ToZigzag(a))};b.readI64=function(){return this.zigzagToI64(this.readVarint64())};b.readBool=function(){var a;this.$5!=null?(a=this.$5,this.$5=null):a=this.$1.readByte()===h.CT_BOOLEAN_TRUE;return a};b.writeBool=function(a){var b=0;this.$4!=null?(b+=this.$7(this.$4,a?i.CT_BOOLEAN_TRUE:i.CT_BOOLEAN_FALSE),this.$4=null):b+=this.$1.writeByte(a?h.CT_BOOLEAN_TRUE:h.CT_BOOLEAN_FALSE);return b};b.readBinary=function(){var a=this.readVarint32();return a===0?new Uint8Array(0):this.$1.readBytes(a)};b.writeBinary=function(a){var b=0;b+=this.writeVarint32(a.length);b+=this.$1.write(a);return b};b.i32ToZigzag=function(a){if(ao)throw new Error("number: "+a+" is out of range of i32");return(a<<1^(a<0?4294967295:0))>>>0};b.zigzagToI32=function(a){if(a<0||a>q)throw new Error("number: "+a+" is out of range of uint32");return a>>>1^-1*(a&1)};b.i64ToZigzag=function(a){if(c("jsbi").greaterThan(a,r)||c("jsbi").lessThan(a,s))throw new Error("i64 out of range: "+a.toString());return c("jsbi").bitwiseXor(c("jsbi").signedRightShift(a,u),c("jsbi").leftShift(a,v))};b.zigzagToI64=function(a){if(c("jsbi").lessThan(a,0)||c("jsbi").greaterThan(a,t))throw new Error("invalid uint64: "+a.toString());return c("jsbi").equal(c("jsbi").bitwiseAnd(a,v),v)?c("jsbi").bitwiseNot(c("jsbi").signedRightShift(a,v)):c("jsbi").signedRightShift(a,v)};b.writeVarint32=function(a){if(a<0||a>q)throw new Error("writeVarint32 received out of range uint32: "+a);a=a;var b=0;while(!0)if(a>>>7===0){this.$1.writeByte(a);b++;break}else this.$1.writeByte(a&127|128),b++,a>>>=7;return b};b.readVarint32=function(){var a=0,b=0,c;while(!0){c=this.$1.readByte();a=(a|(c&127)<>>0;b+=7;if((c&128)==0){if(b===35&&(c&240)!=0)throw new Error("result exceeded 32 bit limit");break}if(b>28)throw new Error("result exceeded 32 bit limit")}return a};b.writeVarint64=function(a){if(c("jsbi").lessThan(a,w)||c("jsbi").greaterThan(a,t))throw new Error("invalid uint64: "+a.toString());a=a;var b=0;while(!0)if(c("jsbi").equal(c("jsbi").signedRightShift(a,x),w)){this.$1.writeByte(c("jsbi").toNumber(a));b++;break}else{var d=c("jsbi").toNumber(c("jsbi").bitwiseOr(c("jsbi").bitwiseAnd(a,z),A));this.$1.writeByte(d);b++;a=c("jsbi").signedRightShift(a,x)}return b};b.readVarint64=function(){var a=w,b=w,d;while(!0){d=c("jsbi").BigInt(this.$1.readByte());a=c("jsbi").bitwiseOr(a,c("jsbi").leftShift(c("jsbi").bitwiseAnd(d,z),b));b=c("jsbi").add(b,x);if(c("jsbi").equal(c("jsbi").bitwiseAnd(d,A),w)){if(c("jsbi").equal(b,y)&&c("jsbi").notEqual(d,v))throw new Error("result exceeded 64 bit limit");break}if(c("jsbi").greaterThan(b,u))throw new Error("result exceeded 64 bit limit")}return a};b.readString=function(){return d("Utf8ToString").Utf8ToString(this.readBinary())};b.getLastFieldId=function(){return this.$3};b.getLastField=function(){return this.$2};b.getBooleanFieldInfo=function(){return this.$4};b.getBooleanValue=function(){return this.$5};b.$9=function(a){return j[a]};b.$10=function(a){switch(a){case h.CT_STOP:return c("ThriftTypes").STOP;case h.CT_BOOLEAN_FALSE:case h.CT_BOOLEAN_TRUE:return c("ThriftTypes").BOOL;case h.CT_BYTE:return c("ThriftTypes").BYTE;case h.CT_I16:return c("ThriftTypes").I16;case h.CT_I32:return c("ThriftTypes").I32;case h.CT_I64:return c("ThriftTypes").I64;case h.CT_DOUBLE:return c("ThriftTypes").DOUBLE;case h.CT_FLOAT:return c("ThriftTypes").FLOAT;case h.CT_BINARY:return c("ThriftTypes").STRING;case h.CT_LIST:return c("ThriftTypes").LIST;case h.CT_SET:return c("ThriftTypes").SET;case h.CT_MAP:return c("ThriftTypes").MAP;case h.CT_STRUCT:return c("ThriftTypes").STRUCT;default:throw new Error("don't know what type")}};return a}();g["default"]=a}),98); __d("TNoOpWriteBuffer",[],(function(a,b,c,d,e,f){a=function(){function a(){this.$1=0}var b=a.prototype;b.write=function(a){this.$1+=a.length;return a.length};b.writeByte=function(a){this.$1++;return 1};b.writeFloatBE=function(a){this.$1+=Float32Array.BYTES_PER_ELEMENT;return Float32Array.BYTES_PER_ELEMENT};b.writeDoubleBE=function(a){this.$1+=Float64Array.BYTES_PER_ELEMENT;return Float64Array.BYTES_PER_ELEMENT};b.toByteArray=function(){throw new Error("operation not supported")};b.currentSize=function(){return this.$1};b.readByte=function(){throw new Error("operation not supported")};b.readBytes=function(a){throw new Error("operation not supported")};b.readFloatBE=function(){throw new Error("operation not supported")};b.readDoubleBE=function(){throw new Error("operation not supported")};return a}();f["default"]=a}),66); __d("TReadBuffer",[],(function(a,b,c,d,e,f){a=function(){function a(a){this.$1=a,this.$2=0}var b=a.prototype;b.readByte=function(){if(this.$2this.$1.length)throw new Error("not enough bytes to read");var b=new Uint8Array(this.$1.buffer,this.$3(),a);this.$2+=a;return b};b.readFloatBE=function(){if(Float32Array.BYTES_PER_ELEMENT+this.$2>this.$1.length)throw new Error("not enough bytes to read");var a=new DataView(this.$1.buffer).getFloat32(this.$3());this.$2+=Float32Array.BYTES_PER_ELEMENT;return a};b.readDoubleBE=function(){if(Float64Array.BYTES_PER_ELEMENT+this.$2>this.$1.length)throw new Error("not enough bytes to read");var a=new DataView(this.$1.buffer).getFloat64(this.$3());this.$2+=Float64Array.BYTES_PER_ELEMENT;return a};b.$3=function(){return this.$2+this.$1.byteOffset};b.getCurrentCursor=function(){return this.$2};b.writeByte=function(a){throw new Error("operation not supported")};b.write=function(a){throw new Error("operation not supported")};b.toByteArray=function(){throw new Error("operation not supported")};b.writeFloatBE=function(a){throw new Error("operation not supported")};b.writeDoubleBE=function(a){throw new Error("operation not supported")};return a}();f["default"]=a}),66); __d("CompactSerializerPolyfill",["TCompactProtocolPolyfill","TNoOpWriteBuffer","TReadBuffer","TWriteBuffer"],(function(a,b,c,d,e,f,g){"use strict";function h(a,b){a=new(c("TReadBuffer"))(a);a=new(c("TCompactProtocolPolyfill"))(a);return b(a)}function a(a,b,c){try{return h(a,b)}catch(a){c!=null&&c(a)}return null}function i(a,b,d){d===void 0&&(d=!1);if(d){d=new(c("TNoOpWriteBuffer"))();var e=new(c("TCompactProtocolPolyfill"))(d);b(a,e);e=new(c("TWriteBuffer"))(d.currentSize())}else e=new(c("TWriteBuffer"))();d=new(c("TCompactProtocolPolyfill"))(e);b(a,d);return d.toByteArray()}function b(a,b,c,d){c===void 0&&(c=!1);try{return i(a,b,c)}catch(a){d!=null&&d(a)}return null}g.deserialize=h;g.deserializeNoThrow=a;g.serialize=i;g.serializeNoThrow=b}),98); __d("DGWRequestStreamUtils",["Base64","WebDriverConfig","cr:3024","gkx"],(function(a,b,c,d,e,f,g){"use strict";function a(a,d,e,f){var g={};a=Object.entries(a);for(var h=0;h0&&(g["xrs-instrumentation"]=c("Base64").encode(e));g["XRS-Accept-Ack"]="RSAck";f!=null&&f.ackTimeoutSec!=null&&(g["XRS-SRAck-Timeout"]=f.ackTimeoutSec.toString());g["XRSS-http_referer"]=window.location.href;if(c("WebDriverConfig").isTestRunning&&c("gkx")("5639")){j=b("cr:3024")==null?void 0:b("cr:3024").get();j!=null&&(g["XRSS-is_test"]="1",g["XRSS-original_request_id"]=j)}return g}function h(a){return Object.keys(a).reduce(function(b,c){(typeof a[c]==="string"||typeof a[c]==="boolean"||typeof a[c]==="number"||typeof a[c]==="object")&&(b[c]=a[c]);return b},{})}function d(a){if(a.response&&a.response.instrumentation_data!=null&&a.response.instrumentation_data.length>0)try{a=JSON.parse(new TextDecoder("utf-8").decode(a.response.instrumentation_data));return{auxId:a.auxId,dfTraceId:(a=a.dataFlowTracingData)==null?void 0:a.traceId}}catch(a){}return null}function e(a,b){var c=a.headers;a=a.body;b.kill_body===!0&&(a=null);b.new_body!=null&&(a=b.new_body);if(b.new_headers!=null)try{c=h(JSON.parse(b.new_headers))}catch(a){}if(b.patch_headers!=null)try{c=babelHelpers["extends"]({},c,h(JSON.parse(b.patch_headers)))}catch(a){}return{headers:c,body:a}}g.convertHeaders=a;g.cleanHeaders=h;g.getInstrumentationDataFieldsFromPayload=d;g.transformContextWithRewriteDelta=e}),98); __d("DGWStream",["$InternalEnum"],(function(a,b,c,d,e,f){"use strict";var g=b("$InternalEnum").Mirrored(["ABNORMAL_CLOSURE","GOING_AWAY","SERVER_INTERNAL_ERROR","PREMATURE_CLOSE","UNKNOWN_ERROR","KEEPALIVE_TIMEOUT","TRANSPORT_CLOSED_BEFORE_STREAM_INIT","ESTABLISHMENT_TIMEOUT","UNAUTHENTICATED","UNAUTHORIZED","REJECTED","BAD_REQUEST","DGW_SERVER_ERROR","ESTABLISHMENT_ERROR"]);function a(a){switch(a){case g.UNAUTHENTICATED:case g.UNAUTHORIZED:case g.REJECTED:case g.BAD_REQUEST:case g.UNKNOWN_ERROR:case g.SERVER_INTERNAL_ERROR:return!1;default:return!0}}f.StreamError=g;f.isRetryableError=a}),66); __d("DGWStreamHandler",[],(function(a,b,c,d,e,f){"use strict";a=function(){function a(a,b,c,d,e){this.$2=a,this.$3=b,this.$4=c,this.$5=d,this.$6=e,this.$1=!0}var b=a.prototype;b.onClose=function(a){if(!this.$1)return;this.$2(a)};b.onDataReceived=function(a){if(!this.$1)return;this.$3(a)};b.onError=function(a){if(!this.$1)return;this.$4(a)};b.onStreamMustDrain=function(a,b){if(!this.$1)return;this.$5(a,b)};b.onServerHasFinishedSendingData=function(a){if(!this.$1)return;this.$6(a)};b.stop=function(){this.$1=!1};b.isStopped=function(){return!this.$1};return a}();f["default"]=a}),66); __d("RequestStreamCommonRequestStreamCommonSerializers",["RequestStreamCommonRequestStreamCommonTypes","ThriftTypes","jsbi"],(function(a,b,c,d,e,f){"use strict";function a(){return{}}function c(){return{bytes:Uint8Array.of()}}function d(){return{message:""}}function e(){return{reason:b("RequestStreamCommonRequestStreamCommonTypes").TerminationReason.cast(0)}}function g(){return{}}function h(){return{stream_id:"0",last_sequencer:0,amendment_count:0,last_status:b("RequestStreamCommonRequestStreamCommonTypes").FlowStatus.cast(0)}}function i(){return{caller_timestamp_ms:"0"}}function j(){return{original_ping_timestamp_ms:"0"}}function k(){return{}}function l(a,c){c.writeStructBegin("ResponseRewriteRequest"),a.new_headers!=null&&(c.writeFieldBegin({fname:"new_headers",ftype:b("ThriftTypes").STRING,fid:1}),c.writeString(a.new_headers),c.writeFieldEnd()),a.new_body!=null&&(c.writeFieldBegin({fname:"new_body",ftype:b("ThriftTypes").STRING,fid:2}),c.writeBinary(a.new_body),c.writeFieldEnd()),a.patch_headers!=null&&(c.writeFieldBegin({fname:"patch_headers",ftype:b("ThriftTypes").STRING,fid:3}),c.writeString(a.patch_headers),c.writeFieldEnd()),a.kill_body!=null&&(c.writeFieldBegin({fname:"kill_body",ftype:b("ThriftTypes").BOOL,fid:4}),c.writeBool(a.kill_body),c.writeFieldEnd()),a.temporary!=null&&(c.writeFieldBegin({fname:"temporary",ftype:b("ThriftTypes").BOOL,fid:5}),c.writeBool(a.temporary),c.writeFieldEnd()),c.writeFieldStop(),c.writeStructEnd()}function m(a,c){c.writeStructBegin("ResponseData");c.writeFieldBegin({fname:"bytes",ftype:b("ThriftTypes").STRING,fid:1});if(a.bytes!=null)c.writeBinary(a.bytes);else{var d=Uint8Array.of();c.writeBinary(d)}c.writeFieldEnd();a.metadata!=null&&(c.writeFieldBegin({fname:"metadata",ftype:b("ThriftTypes").STRING,fid:2}),c.writeString(a.metadata),c.writeFieldEnd());c.writeFieldStop();c.writeStructEnd()}function n(a,c){c.writeStructBegin("LogMessage");c.writeFieldBegin({fname:"message",ftype:b("ThriftTypes").STRING,fid:1});if(a.message!=null)c.writeString(a.message);else{a="";c.writeString(a)}c.writeFieldEnd();c.writeFieldStop();c.writeStructEnd()}function o(a,c){c.writeStructBegin("Termination");c.writeFieldBegin({fname:"reason",ftype:b("ThriftTypes").I32,fid:1});if(a.reason!=null){var d;c.writeI32((d=a.reason)!=null?d:0)}else{d=b("RequestStreamCommonRequestStreamCommonTypes").TerminationReason.cast(0);c.writeI32((d=d)!=null?d:0)}c.writeFieldEnd();a.message!=null&&(c.writeFieldBegin({fname:"message",ftype:b("ThriftTypes").STRING,fid:2}),c.writeString(a.message),c.writeFieldEnd());a.retry_delay_ms!=null&&(c.writeFieldBegin({fname:"retry_delay_ms",ftype:b("ThriftTypes").I64,fid:3}),c.writeI64(b("jsbi").BigInt(a.retry_delay_ms)),c.writeFieldEnd());c.writeFieldStop();c.writeStructEnd()}function p(a,c){c.writeStructBegin("AmendStreamAck"),a.amendment_id!=null&&(c.writeFieldBegin({fname:"amendment_id",ftype:b("ThriftTypes").I64,fid:1}),c.writeI64(b("jsbi").BigInt(a.amendment_id)),c.writeFieldEnd()),a.accepted!=null&&(c.writeFieldBegin({fname:"accepted",ftype:b("ThriftTypes").BOOL,fid:2}),c.writeBool(a.accepted),c.writeFieldEnd()),a.result!=null&&(c.writeFieldBegin({fname:"result",ftype:b("ThriftTypes").STRING,fid:3}),c.writeBinary(a.result),c.writeFieldEnd()),c.writeFieldStop(),c.writeStructEnd()}function q(a,c){c.writeStructBegin("StreamCheck");c.writeFieldBegin({fname:"stream_id",ftype:b("ThriftTypes").I64,fid:1});if(a.stream_id!=null)c.writeI64(b("jsbi").BigInt(a.stream_id));else{var d="0";c.writeI64(b("jsbi").BigInt(d))}c.writeFieldEnd();c.writeFieldBegin({fname:"last_sequencer",ftype:b("ThriftTypes").I32,fid:2});if(a.last_sequencer!=null)c.writeI32(a.last_sequencer);else{d=0;c.writeI32(d)}c.writeFieldEnd();c.writeFieldBegin({fname:"amendment_count",ftype:b("ThriftTypes").I32,fid:4});if(a.amendment_count!=null)c.writeI32(a.amendment_count);else{d=0;c.writeI32(d)}c.writeFieldEnd();c.writeFieldBegin({fname:"last_status",ftype:b("ThriftTypes").I32,fid:3});if(a.last_status!=null){c.writeI32((d=a.last_status)!=null?d:0)}else{a=b("RequestStreamCommonRequestStreamCommonTypes").FlowStatus.cast(0);c.writeI32((d=a)!=null?d:0)}c.writeFieldEnd();c.writeFieldStop();c.writeStructEnd()}function r(a,c){c.writeStructBegin("Ping");c.writeFieldBegin({fname:"caller_timestamp_ms",ftype:b("ThriftTypes").I64,fid:1});if(a.caller_timestamp_ms!=null)c.writeI64(b("jsbi").BigInt(a.caller_timestamp_ms));else{var d="0";c.writeI64(b("jsbi").BigInt(d))}c.writeFieldEnd();if(a.streams_to_check!=null){c.writeFieldBegin({fname:"streams_to_check",ftype:b("ThriftTypes").LIST,fid:2});c.writeListBegin({etype:b("ThriftTypes").STRUCT,size:a.streams_to_check.length});for(var d=a.streams_to_check,a=Array.isArray(d),e=0,d=a?d:d[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var f;if(a){if(e>=d.length)break;f=d[e++]}else{e=d.next();if(e.done)break;f=e.value}f=f;q(f,c)}c.writeListEnd();c.writeFieldEnd()}c.writeFieldStop();c.writeStructEnd()}function s(a,c){c.writeStructBegin("Pong");c.writeFieldBegin({fname:"original_ping_timestamp_ms",ftype:b("ThriftTypes").I64,fid:1});if(a.original_ping_timestamp_ms!=null)c.writeI64(b("jsbi").BigInt(a.original_ping_timestamp_ms));else{var d="0";c.writeI64(b("jsbi").BigInt(d))}c.writeFieldEnd();if(a.stream_ids_missing!=null){c.writeFieldBegin({fname:"stream_ids_missing",ftype:b("ThriftTypes").LIST,fid:2});c.writeListBegin({etype:b("ThriftTypes").I64,size:a.stream_ids_missing.length});for(var d=a.stream_ids_missing,e=Array.isArray(d),f=0,d=e?d:d[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var g;if(e){if(f>=d.length)break;g=d[f++]}else{f=d.next();if(f.done)break;g=f.value}g=g;c.writeI64(b("jsbi").BigInt(g))}c.writeListEnd();c.writeFieldEnd()}if(a.stream_ids_behind!=null){c.writeFieldBegin({fname:"stream_ids_behind",ftype:b("ThriftTypes").LIST,fid:3});c.writeListBegin({etype:b("ThriftTypes").I64,size:a.stream_ids_behind.length});for(g=a.stream_ids_behind,f=Array.isArray(g),e=0,g=f?g:g[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){if(f){if(e>=g.length)break;d=g[e++]}else{e=g.next();if(e.done)break;d=e.value}d=d;c.writeI64(b("jsbi").BigInt(d))}c.writeListEnd();c.writeFieldEnd()}if(a.stream_ids_with_lost_amendments!=null){c.writeFieldBegin({fname:"stream_ids_with_lost_amendments",ftype:b("ThriftTypes").LIST,fid:4});c.writeListBegin({etype:b("ThriftTypes").I64,size:a.stream_ids_with_lost_amendments.length});for(d=a.stream_ids_with_lost_amendments,e=Array.isArray(d),f=0,d=e?d:d[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){if(e){if(f>=d.length)break;g=d[f++]}else{f=d.next();if(f.done)break;g=f.value}g=g;c.writeI64(b("jsbi").BigInt(g))}c.writeListEnd();c.writeFieldEnd()}if(a.stream_ids_with_wrong_status!=null){c.writeFieldBegin({fname:"stream_ids_with_wrong_status",ftype:b("ThriftTypes").LIST,fid:5});c.writeListBegin({etype:b("ThriftTypes").I64,size:a.stream_ids_with_wrong_status.length});for(g=a.stream_ids_with_wrong_status,f=Array.isArray(g),e=0,g=f?g:g[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){if(f){if(e>=g.length)break;d=g[e++]}else{e=g.next();if(e.done)break;d=e.value}a=d;c.writeI64(b("jsbi").BigInt(a))}c.writeListEnd();c.writeFieldEnd()}c.writeFieldStop();c.writeStructEnd()}function t(a,c){c.writeStructBegin("StreamResponseDelta");if(a.flow_status!=null){var d;c.writeFieldBegin({fname:"flow_status",ftype:b("ThriftTypes").I32,fid:1});c.writeI32((d=a.flow_status)!=null?d:0);c.writeFieldEnd();c.writeFieldStop();c.writeStructEnd();return}if(a.log!=null){c.writeFieldBegin({fname:"log",ftype:b("ThriftTypes").STRUCT,fid:2});n(a.log,c);c.writeFieldEnd();c.writeFieldStop();c.writeStructEnd();return}if(a.rewrite!=null){c.writeFieldBegin({fname:"rewrite",ftype:b("ThriftTypes").STRUCT,fid:3});l(a.rewrite,c);c.writeFieldEnd();c.writeFieldStop();c.writeStructEnd();return}if(a.data!=null){c.writeFieldBegin({fname:"data",ftype:b("ThriftTypes").STRUCT,fid:4});m(a.data,c);c.writeFieldEnd();c.writeFieldStop();c.writeStructEnd();return}if(a.termination!=null){c.writeFieldBegin({fname:"termination",ftype:b("ThriftTypes").STRUCT,fid:5});o(a.termination,c);c.writeFieldEnd();c.writeFieldStop();c.writeStructEnd();return}if(a.amend_ack!=null){c.writeFieldBegin({fname:"amend_ack",ftype:b("ThriftTypes").STRUCT,fid:6});p(a.amend_ack,c);c.writeFieldEnd();c.writeFieldStop();c.writeStructEnd();return}c.writeFieldStop();c.writeStructEnd()}function u(a){var c={};a.readStructBegin();while(!0){var d=a.readFieldBegin(),e=d.ftype;d=d.fid;if(e===b("ThriftTypes").STOP)break;switch(d){case 1:e===b("ThriftTypes").STRING?c.new_headers=a.readString():a.skip(e);break;case 2:e===b("ThriftTypes").STRING?c.new_body=a.readBinary():a.skip(e);break;case 3:e===b("ThriftTypes").STRING?c.patch_headers=a.readString():a.skip(e);break;case 4:e===b("ThriftTypes").BOOL?c.kill_body=a.readBool():a.skip(e);break;case 5:e===b("ThriftTypes").BOOL?c.temporary=a.readBool():a.skip(e);break;default:a.skip(e)}a.readFieldEnd()}a.readStructEnd();return c}function v(a){var c={};a.readStructBegin();while(!0){var d=a.readFieldBegin(),e=d.ftype;d=d.fid;if(e===b("ThriftTypes").STOP)break;switch(d){case 1:e===b("ThriftTypes").STRING?c.bytes=a.readBinary():a.skip(e);break;case 2:e===b("ThriftTypes").STRING?c.metadata=a.readString():a.skip(e);break;default:a.skip(e)}a.readFieldEnd()}a.readStructEnd();c.bytes===void 0&&(c.bytes=Uint8Array.of());return c}function w(a){var c={};a.readStructBegin();while(!0){var d=a.readFieldBegin(),e=d.ftype;d=d.fid;if(e===b("ThriftTypes").STOP)break;switch(d){case 1:e===b("ThriftTypes").STRING?c.message=a.readString():a.skip(e);break;default:a.skip(e)}a.readFieldEnd()}a.readStructEnd();c.message===void 0&&(c.message="");return c}function x(a){var c={};a.readStructBegin();while(!0){var d=a.readFieldBegin(),e=d.ftype;d=d.fid;if(e===b("ThriftTypes").STOP)break;switch(d){case 1:e===b("ThriftTypes").I32?c.reason=b("RequestStreamCommonRequestStreamCommonTypes").TerminationReason.cast(a.readI32()):a.skip(e);break;case 2:e===b("ThriftTypes").STRING?c.message=a.readString():a.skip(e);break;case 3:e===b("ThriftTypes").I64?c.retry_delay_ms=a.readI64().toString():a.skip(e);break;default:a.skip(e)}a.readFieldEnd()}a.readStructEnd();c.reason===void 0&&(c.reason=b("RequestStreamCommonRequestStreamCommonTypes").TerminationReason.cast(0));return c}function y(a){var c={};a.readStructBegin();while(!0){var d=a.readFieldBegin(),e=d.ftype;d=d.fid;if(e===b("ThriftTypes").STOP)break;switch(d){case 1:e===b("ThriftTypes").I64?c.amendment_id=a.readI64().toString():a.skip(e);break;case 2:e===b("ThriftTypes").BOOL?c.accepted=a.readBool():a.skip(e);break;case 3:e===b("ThriftTypes").STRING?c.result=a.readBinary():a.skip(e);break;default:a.skip(e)}a.readFieldEnd()}a.readStructEnd();return c}function z(a){var c={};a.readStructBegin();while(!0){var d=a.readFieldBegin(),e=d.ftype;d=d.fid;if(e===b("ThriftTypes").STOP)break;switch(d){case 1:e===b("ThriftTypes").I64?c.stream_id=a.readI64().toString():a.skip(e);break;case 2:e===b("ThriftTypes").I32?c.last_sequencer=a.readI32():a.skip(e);break;case 4:e===b("ThriftTypes").I32?c.amendment_count=a.readI32():a.skip(e);break;case 3:e===b("ThriftTypes").I32?c.last_status=b("RequestStreamCommonRequestStreamCommonTypes").FlowStatus.cast(a.readI32()):a.skip(e);break;default:a.skip(e)}a.readFieldEnd()}a.readStructEnd();c.stream_id===void 0&&(c.stream_id="0");c.last_sequencer===void 0&&(c.last_sequencer=0);c.amendment_count===void 0&&(c.amendment_count=0);c.last_status===void 0&&(c.last_status=b("RequestStreamCommonRequestStreamCommonTypes").FlowStatus.cast(0));return c}function A(a){var c={};a.readStructBegin();while(!0){var d=a.readFieldBegin(),e=d.ftype;d=d.fid;if(e===b("ThriftTypes").STOP)break;switch(d){case 1:e===b("ThriftTypes").I64?c.caller_timestamp_ms=a.readI64().toString():a.skip(e);break;case 2:if(e===b("ThriftTypes").LIST){c.streams_to_check=[];d=a.readListBegin();for(var f=0;f=d.length)break;g=d[f++]}else{f=d.next();if(f.done)break;g=f.value}g=g;b("RequestStreamCommonRequestStreamCommonSerializers").serializeStreamResponseDelta(g,c)}c.writeListEnd()}else{g=[];c.writeListBegin({etype:b("ThriftTypes").STRUCT,size:g.length});for(f=0;f=0;--p)o[48+p]=52+p,o[65+p]=p,o[97+p]=26+p;o[43]=62;o[47]=63;function q(m,n,p){var q,r,l=0,s=n,t=p.length;n=n+(t*3>>2)-(p[t-2]=="=")-(p[t-1]=="=");for(;l>4,s>2),s>2]=o;t[y+68>>2]=p;t[y+64>>2]=l;t[y+60>>2]=r;t[y+56>>2]=m;t[y+52>>2]=n;a:{if(t[y+52>>2]?!t[y+56>>2]|(!t[y+72>>2]|!t[y+68>>2]|(!t[y+64>>2]|!t[y+60>>2])):1){t[y+76>>2]=5;break a}t[t[y+64>>2]>>2]=0;t[t[y+60>>2]>>2]=0;p=t[y+68>>2];l=t[y+56>>2];r=t[y+52>>2];o=A+-64|0;A=o;t[o+56>>2]=t[y+72>>2];t[o+52>>2]=p;t[o+48>>2]=l;t[o+44>>2]=r;t[o+40>>2]=0;t[o+36>>2]=t[o+56>>2];b:{c:{d:{while(1){if(!t[o+52>>2])break c;t[o+32>>2]=t[o+36>>2];q[o+31|0]=u[t[o+36>>2]];t[o+52>>2]=t[o+52>>2]-1;t[o+36>>2]=t[o+36>>2]+1;if(u[o+31|0]!=10?u[o+31|0]==2|u[o+31|0]==4|u[o+31|0]==9:1){t[o+40>>2]=t[o+40>>2]+1;continue}t[o+24>>2]=1;if(V(u[o+31|0])&1){z=o,B=X(u[o+31|0])&1,q[z+23|0]=B;t[o+16>>2]=q[o+23|0]&1?1:2;if(w[o+52>>2]>2]){t[t[o+48>>2]>>2]=t[o+32>>2];t[t[o+44>>2]>>2]=t[o+52>>2]+t[o+24>>2];break b}t[o+52>>2]=t[o+52>>2]-t[o+16>>2];t[o+24>>2]=t[o+16>>2]+t[o+24>>2];t[o+36>>2]=t[o+16>>2]+t[o+36>>2];if(!(u[o+31|0]!=14?u[o+31|0]!=8:0)){t[o+40>>2]=t[o+40>>2]+1;continue}}if(w[o+52>>2]<3)break d;t[o+12>>2]=0;p=t[o+36>>2];l=u[p|0]|u[p+1|0]<<8;q[o+12|0]=l;q[o+13|0]=l>>>8;q[o+14|0]=u[p+2|0];t[o+52>>2]=t[o+52>>2]-3;t[o+24>>2]=t[o+24>>2]+3;t[o+36>>2]=t[o+36>>2]+3;if(w[o+12>>2]<=w[o+52>>2]){t[o+40>>2]=t[o+40>>2]+1;t[o+36>>2]=t[o+12>>2]+t[o+36>>2];t[o+52>>2]=t[o+52>>2]-t[o+12>>2];continue}break}t[t[o+48>>2]>>2]=t[o+32>>2];t[t[o+44>>2]>>2]=t[o+52>>2]+t[o+24>>2];break b}t[t[o+48>>2]>>2]=t[o+32>>2];t[t[o+44>>2]>>2]=t[o+52>>2]+t[o+24>>2];break b}t[t[o+44>>2]>>2]=t[o+52>>2]}t[o+60>>2]=t[o+40>>2];A=o- -64|0;t[y+48>>2]=t[o+60>>2];if(!t[y+48>>2]){t[y+76>>2]=0;break a}z=y,B=D(x(t[y+48>>2],20)),t[z+44>>2]=B;if(!t[y+44>>2]){t[y+76>>2]=3;break a}t[y+40>>2]=t[y+44>>2];t[y+36>>2]=t[y+72>>2];t[y+32>>2]=t[y+68>>2]-t[t[y+52>>2]>>2];t[y+28>>2]=0;while(1){if(w[y+28>>2]>2]){if(w[y+32>>2]<1){O(t[y+44>>2],t[y+28>>2]);t[y+76>>2]=1;break a}q[y+27|0]=u[t[y+36>>2]];t[y+36>>2]=t[y+36>>2]+1;t[y+32>>2]=t[y+32>>2]-1;e:{if(!u[y+27|0]|u[y+27|0]==1|(u[y+27|0]==2|u[y+27|0]==3)|(u[y+27|0]==4|u[y+27|0]==9|u[y+27|0]==10))break e;if(V(u[y+27|0])&1)break e;O(t[y+44>>2],t[y+28>>2]);t[y+76>>2]=6;break a}o=t[y+40>>2];t[o>>2]=u[y+27|0]&15|t[o>>2]&-16;f:{if(u[y+27|0]!=10?u[y+27|0]==2|u[y+27|0]==4|u[y+27|0]==9:1){o=t[y+40>>2];t[o>>2]=t[o>>2]&-268435441;t[y+40>>2]=t[y+40>>2]+20;break f}if(V(u[y+27|0])&1){o=A-48|0;A=o;t[o+40>>2]=t[y+40>>2];t[o+36>>2]=y+36;t[o+32>>2]=y+32;g:{if(!(V(t[t[o+40>>2]>>2]&15)&1)){t[o+44>>2]=1;break g}z=o,B=X(t[t[o+40>>2]>>2]&15)&1,q[z+31|0]=B;t[o+24>>2]=q[o+31|0]&1?1:2;if(w[t[o+32>>2]>>2]>2]){t[o+44>>2]=1;break g}ba(t[o+40>>2]+4|0,t[t[o+36>>2]>>2],t[o+24>>2]);p=t[o+36>>2];t[p>>2]=t[o+24>>2]+t[p>>2];p=t[o+32>>2];t[p>>2]=t[p>>2]-t[o+24>>2];if((t[t[o+40>>2]>>2]&15)==8){p=t[o+40>>2];t[p>>2]=t[p>>2]&-268435441;t[o+44>>2]=0;break g}if((t[t[o+40>>2]>>2]&15)==14){p=t[o+40>>2];t[p>>2]=t[p>>2]&-268435441;t[o+44>>2]=0;break g}if(w[t[o+32>>2]>>2]<3){t[o+44>>2]=11;break g}t[o+20>>2]=0;p=t[t[o+36>>2]>>2];l=u[p|0]|u[p+1|0]<<8;q[o+20|0]=l;q[o+21|0]=l>>>8;q[o+22|0]=u[p+2|0];p=t[o+36>>2];t[p>>2]=t[p>>2]+3;p=t[o+32>>2];t[p>>2]=t[p>>2]-3;p=t[o+40>>2];t[p>>2]=t[p>>2]&-268435441|(t[o+20>>2]&16777215)<<4;if(w[t[o+32>>2]>>2]>2]){t[o+44>>2]=11;break g}if((t[t[o+40>>2]>>2]&15)==15){t[t[o+40>>2]+12>>2]=t[o+20>>2];p=D(t[o+20>>2]);t[t[o+40>>2]+8>>2]=p;if(!t[t[o+40>>2]+8>>2]){t[o+44>>2]=3;break g}ba(t[t[o+40>>2]+8>>2],t[t[o+36>>2]>>2],t[o+20>>2]);p=t[o+36>>2];t[p>>2]=t[o+20>>2]+t[p>>2];p=t[o+32>>2];t[p>>2]=t[p>>2]-t[o+20>>2];t[o+44>>2]=0;break g}if((t[t[o+40>>2]>>2]&15)==5){t[t[o+40>>2]+12>>2]=t[o+20>>2];p=D(t[o+20>>2]);t[t[o+40>>2]+8>>2]=p;if(!t[t[o+40>>2]+8>>2]){t[o+44>>2]=3;break g}ba(t[t[o+40>>2]+8>>2],t[t[o+36>>2]>>2],t[o+20>>2]);p=t[o+36>>2];t[p>>2]=t[o+20>>2]+t[p>>2];p=t[o+32>>2];t[p>>2]=t[p>>2]-t[o+20>>2];t[o+44>>2]=0;break g}h:{if(!((t[t[o+40>>2]>>2]&15)!=6?(t[t[o+40>>2]>>2]&15)!=7:0)){z=o,B=Q(t[o+36>>2],t[o+32>>2],o+19|0,o+18|0),t[z+12>>2]=B;if(t[o+12>>2]){t[o+44>>2]=t[o+12>>2];break g}break h}if(!((t[t[o+40>>2]>>2]&15)!=13?(t[t[o+40>>2]>>2]&15)!=12:0)){l=t[o+32>>2];p=A-32|0;t[p+24>>2]=t[o+36>>2];t[p+20>>2]=l;t[p+16>>2]=o+19;t[p+12>>2]=o+16;s[p+10>>1]=0;i:{if(w[t[p+20>>2]>>2]<2){t[p+28>>2]=1;break i}l=t[t[p+24>>2]>>2];l=u[l|0]|u[l+1|0]<<8;q[p+10|0]=l;q[p+11|0]=l>>>8;l=t[p+24>>2];t[l>>2]=t[l>>2]+2;l=t[p+20>>2];t[l>>2]=t[l>>2]-2;q[t[p+16>>2]]=(v[p+10>>1]&32768)==32768;s[t[p+12>>2]>>1]=v[p+10>>1]&32767;t[p+28>>2]=0}t[o+12>>2]=t[p+28>>2];if(t[o+12>>2]){t[o+44>>2]=t[o+12>>2];break g}}}if((t[t[o+40>>2]>>2]&15)==12){p=t[o+40>>2];s[p+8>>1]=s[p+8>>1]&1|v[o+16>>1]<<1;t[o+44>>2]=0;break g}if((t[t[o+40>>2]>>2]&15)==7){p=t[o+40>>2];q[p+8|0]=q[p+8|0]&1|u[o+18|0]<<1;t[o+44>>2]=0;break g}if((t[t[o+40>>2]>>2]&15)==13){l=t[o+32>>2];r=t[o+20>>2];m=t[o+40>>2]+12|0;n=t[o+40>>2];p=A-32|0;A=p;t[p+24>>2]=t[o+36>>2];t[p+20>>2]=l;t[p+16>>2]=r;t[p+12>>2]=m;t[p+8>>2]=n+16;j:{if(w[p+16>>2]<2){t[p+28>>2]=9;break j}t[t[p+8>>2]>>2]=t[p+16>>2]-2;if(w[t[p+20>>2]>>2]>2]>>2]){t[p+28>>2]=1;break j}l=D(t[t[p+8>>2]>>2]);t[t[p+12>>2]>>2]=l;if(!t[t[p+12>>2]>>2]){t[p+28>>2]=3;break j}ba(t[t[p+12>>2]>>2],t[t[p+24>>2]>>2],t[t[p+8>>2]>>2]);l=t[p+24>>2];t[l>>2]=t[t[p+8>>2]>>2]+t[l>>2];l=t[p+20>>2];t[l>>2]=t[l>>2]-t[t[p+8>>2]>>2];t[p+28>>2]=0}A=p+32|0;t[o+8>>2]=t[p+28>>2];if(t[o+8>>2]){t[o+44>>2]=t[o+8>>2];break g}p=t[o+40>>2];s[p+8>>1]=q[o+19|0]&1|v[p+8>>1]&65534;p=t[o+40>>2];s[p+8>>1]=s[p+8>>1]&1|v[o+16>>1]<<1;t[o+44>>2]=0;break g}if((t[t[o+40>>2]>>2]&15)==6){z=o,B=M(t[o+36>>2],t[o+32>>2],t[o+20>>2],t[o+40>>2]+12|0,t[o+40>>2]+16|0),t[z+4>>2]=B;if(t[o+4>>2]){t[o+44>>2]=t[o+4>>2];break g}p=t[o+40>>2];q[p+8|0]=q[o+19|0]&1|u[p+8|0]&254;p=t[o+40>>2];q[p+8|0]=q[p+8|0]&1|u[o+18|0]<<1;t[o+44>>2]=0;break g}t[o+44>>2]=1}A=o+48|0;t[y+20>>2]=t[o+44>>2];if(!t[y+20>>2]){t[y+40>>2]=t[y+40>>2]+20;break f}O(t[y+44>>2],t[y+28>>2]);t[y+76>>2]=t[y+20>>2];break a}t[y+16>>2]=0;if(w[y+32>>2]<3){O(t[y+44>>2],t[y+28>>2]);t[y+76>>2]=1;break a}o=t[y+36>>2];p=u[o|0]|u[o+1|0]<<8;q[y+16|0]=p;q[y+17|0]=p>>>8;q[y+18|0]=u[o+2|0];t[y+36>>2]=t[y+36>>2]+3;t[y+32>>2]=t[y+32>>2]-3;if(!(t[y+16>>2]==1|u[y+27|0]!=1)){O(t[y+44>>2],t[y+28>>2]);t[y+76>>2]=7;break a}o=t[y+40>>2];t[o>>2]=t[o>>2]&-268435441|(t[y+16>>2]&16777215)<<4;if(u[y+27|0]==3){if(t[y+16>>2]!=1){O(t[y+44>>2],t[y+28>>2]);t[y+76>>2]=10;break a}q[y+15|0]=0;if(w[y+32>>2]<1){J(t[y+44>>2]);t[y+76>>2]=1;break a}q[y+15|0]=u[t[y+36>>2]];t[y+36>>2]=t[y+36>>2]+1;t[y+32>>2]=t[y+32>>2]-1;k:{if(u[y+15|0]<=4){q[t[y+40>>2]+4|0]=u[y+15|0];break k}q[t[y+40>>2]+4|0]=4}t[y+40>>2]=t[y+40>>2]+20;break f}z=y,B=Q(y+36|0,y+32|0,y+14|0,y+13|0),t[z+8>>2]=B;if(t[y+8>>2]){O(t[y+44>>2],t[y+28>>2]);t[y+76>>2]=t[y+8>>2];break a}if(u[y+27|0]==1){o=t[y+40>>2];q[o+4|0]=q[o+4|0]&1|u[y+13|0]<<1;t[y+40>>2]=t[y+40>>2]+20;break f}if(!u[y+27|0]){z=y,B=M(y+36|0,y+32|0,t[y+16>>2],t[y+40>>2]+8|0,t[y+40>>2]+12|0),t[z+4>>2]=B;if(t[y+4>>2]){O(t[y+44>>2],t[y+28>>2]);t[y+76>>2]=t[y+4>>2];break a}o=t[y+40>>2];q[o+4|0]=q[y+14|0]&1|u[o+4|0]&254;o=t[y+40>>2];q[o+4|0]=q[o+4|0]&1|u[y+13|0]<<1;t[y+40>>2]=t[y+40>>2]+20}}t[y+28>>2]=t[y+28>>2]+1;continue}break}if(t[y+32>>2]){O(t[y+44>>2],t[y+48>>2]);t[y+76>>2]=1;break a}t[t[y+64>>2]>>2]=t[y+44>>2];t[t[y+60>>2]>>2]=t[y+48>>2];t[y+76>>2]=0}A=y+80|0;return t[y+76>>2]}function D(o){var q=0,l=0,r=0,m=0,n=0,s=0,u=0,v,w=0,x,p;w=8;a:{b:{if(o>>>0>4294967239)break b;while(1){w=w>>>0>8?w:8;l=t[603];n=l;m=t[602];u=m;o=o>>>0>8?o+3&-4:8;c:{if(o>>>0<=127){s=(o>>>3|0)-1|0;break c}r=y(o);s=((o>>>29-r^4)-(r<<2)|0)+110|0;if(o>>>0<=4095)break c;r=((o>>>30-r^2)-(r<<1)|0)+71|0;s=r>>>0<63?r:63}q=s;r=q&31;(q&63)>>>0>=32?(q=0,l=l>>>r|0):(q=l>>>r|0,l=((1<>>r);r=q;if(l|q){while(1){n=l;q=r;d:{if(q|l){m=q-1|0;v=m+1|0;u=m;m=l-1|0;u=(m|0)!=-1?v:u;m=y(l^m)+32|0;l=y(q^u);l=(l|0)==32?m:l;q=63-l|0;0-(l>>>0>63)|0;break d}q=64}m=q;q=m;l=q&31;(q&63)>>>0>=32?(q=0,u=r>>>l|0):(q=r>>>l|0,u=((1<>>l);r=q;s=m+s|0;n=s<<4;q=t[n+1384>>2];m=n+1376|0;e:{if((q|0)!=(m|0)){l=I(q,w,o);if(l)break b;l=t[q+4>>2];t[l+8>>2]=t[q+8>>2];t[t[q+8>>2]+4>>2]=l;t[q+8>>2]=m;l=n+1380|0;t[q+4>>2]=t[l>>2];t[l>>2]=q;t[t[q+4>>2]+8>>2]=q;s=s+1|0;l=(r&1)<<31|u>>>1;r=r>>>1|0;break e}x=t[603];q=s;v=q&63;l=v;n=l&31;l>>>0>=32?(l=0,m=-1>>>n|0):(l=-1>>>n|0,m=(1<>>n);m=m&-2;n=v&31;v>>>0>=32?(l=m<>>32-n|l<>>0>=32?(l=-1<>>32-q|-1<>>0>=32?(m=0,q=l>>>q|0):(m=l>>>q|0,q=((1<>>q);l=q|v;B=n|m;t[602]=t[602]&l;t[603]=B&x;l=u^1}if(l|r)continue;break}m=t[602];n=t[603]}f:{if(n|m){r=y(n);r=63-((r|0)==32?y(m)+32|0:r)<<4;q=r+1376|0;r=t[r+1384>>2];g:{if(!n&m>>>0<1073741824)break g;s=98;if((q|0)==(r|0))break g;while(1){l=I(r,w,o);if(l)break b;r=t[r+8>>2];if(!s)break g;s=s-1|0;if((q|0)!=(r|0))continue;break}}if(G(o+48|0))break f;if(!r|(q|0)==(r|0))break a;while(1){l=I(r,w,o);if(l)break b;r=t[r+8>>2];if((q|0)!=(r|0))continue;break}break a}if(!G(o+48|0))break a}l=0;if(o>>>0>4294967239)break b;r=w;q=0;while(1){s=q;if(r){r=r-1&r;q=q+1|0;continue}break}if(s>>>0<=1)continue;break}}return l}return 0}function E(o,p,l,r,m,n,x){o=o|0;p=p|0;l=l|0;r=r|0;m=m|0;n=n|0;x=x|0;var y=0,z=0;y=A-32|0;A=y;s[y+26>>1]=o;t[y+20>>2]=p;t[y+16>>2]=l;q[y+15|0]=r;s[y+12>>1]=m;t[y+8>>2]=n;t[y+4>>2]=x;a:{if(!(!(q[y+15|0]&1)|v[y+12>>1]<=32767)){t[y+28>>2]=4;break a}p=t[y+20>>2];l=t[y+16>>2];r=t[y+8>>2];m=t[y+4>>2];n=q[y+15|0]&1;o=A+-64|0;A=o;t[o+56>>2]=y+26;t[o+52>>2]=p;t[o+48>>2]=l;t[o+44>>2]=r;t[o+40>>2]=m;q[o+39|0]=2;q[o+38|0]=13;t[o+32>>2]=y+12;q[o+31|0]=n;q[o+30|0]=2;b:{c:{if(!(!t[o+52>>2]|(!t[o+44>>2]|!t[o+40>>2]))&&w[o+48>>2]<=16777215)break c;t[o+60>>2]=5;break b}t[o+24>>2]=t[o+48>>2]+(u[o+39|0]+(u[o+30|0]+4|0)|0);z=o,x=D(t[o+24>>2]),t[z+20>>2]=x;if(!t[o+20>>2]){t[o+60>>2]=3;break b}t[o+16>>2]=t[o+20>>2];q[t[o+16>>2]]=u[o+38|0];t[o+16>>2]=t[o+16>>2]+1;ba(t[o+16>>2],t[o+56>>2],u[o+30|0]);t[o+16>>2]=u[o+30|0]+t[o+16>>2];t[o+12>>2]=u[o+39|0]+t[o+48>>2];if(w[o+12>>2]>2]){J(t[o+20>>2]);t[o+60>>2]=9;break b}p=t[o+16>>2];l=u[o+12|0]|u[o+13|0]<<8;q[p|0]=l;q[p+1|0]=l>>>8;q[p+2|0]=u[o+14|0];t[o+16>>2]=t[o+16>>2]+3;if(q[o+31|0]&1)d:{if(u[o+38|0]==6){p=t[o+32>>2];q[p|0]=u[p|0]|128;break d}e:{if(u[o+38|0]==13){p=t[o+32>>2];s[p>>1]=v[p>>1]|32768;break e}J(t[o+20>>2]);t[o+60>>2]=1;break b}}ba(t[o+16>>2],t[o+32>>2],u[o+39|0]);t[o+16>>2]=u[o+39|0]+t[o+16>>2];ba(t[o+16>>2],t[o+52>>2],t[o+48>>2]);t[t[o+44>>2]>>2]=t[o+20>>2];t[t[o+40>>2]>>2]=t[o+24>>2];t[o+60>>2]=0}A=o- -64|0;t[y+28>>2]=t[o+60>>2]}A=y+32|0;return t[y+28>>2]}function F(o,p,l,r,m){o=o|0;p=p|0;l=l|0;r=r|0;m=m|0;var n=0,v=0;n=A-32|0;A=n;s[n+30>>1]=o;t[n+24>>2]=p;t[n+20>>2]=l;t[n+16>>2]=r;t[n+12>>2]=m;p=t[n+24>>2];l=t[n+20>>2];r=t[n+16>>2];m=t[n+12>>2];o=A-48|0;A=o;t[o+40>>2]=n+30;t[o+36>>2]=p;t[o+32>>2]=l;t[o+28>>2]=r;t[o+24>>2]=m;q[o+23|0]=2;q[o+22|0]=15;a:{if(!(t[o+24>>2]?t[o+28>>2]:0)){t[o+44>>2]=5;break a}t[t[o+28>>2]>>2]=0;t[t[o+24>>2]>>2]=0;if(!(w[o+32>>2]<=16777215?t[o+36>>2]:0)){t[o+44>>2]=5;break a}t[o+16>>2]=t[o+32>>2]+(u[o+23|0]+4|0);v=o,r=D(t[o+16>>2]),t[v+12>>2]=r;if(!t[o+12>>2]){t[o+44>>2]=3;break a}t[o+8>>2]=t[o+12>>2];q[t[o+8>>2]]=u[o+22|0];t[o+8>>2]=t[o+8>>2]+1;ba(t[o+8>>2],t[o+40>>2],u[o+23|0]);t[o+8>>2]=u[o+23|0]+t[o+8>>2];p=t[o+8>>2];l=u[o+32|0]|u[o+33|0]<<8;q[p|0]=l;q[p+1|0]=l>>>8;q[p+2|0]=u[o+34|0];t[o+8>>2]=t[o+8>>2]+3;ba(t[o+8>>2],t[o+36>>2],t[o+32>>2]);t[o+8>>2]=t[o+32>>2]+t[o+8>>2];t[t[o+28>>2]>>2]=t[o+12>>2];t[t[o+24>>2]>>2]=t[o+16>>2];t[o+44>>2]=0}A=o+48|0;A=n+32|0;return t[o+44>>2]}function G(o){var p=0,l,r=0,m=0,n,s=0;r=t[343];l=o+3&-4;p=r+l|0;a:{b:{if(p>>>0<=r>>>0?l:0)break b;if(p>>>0>wa()<<16>>>0&&!(z(p|0)|0))break b;t[343]=p;break a}t[604]=48;r=-1}if((r|0)!=-1){l=o+r|0;p=l-16|0;t[p+12>>2]=16;t[p>>2]=16;o=t[600];o?s=t[o+8>>2]:s=0;c:{d:{if((s|0)==(r|0)){m=r-(t[r-4>>2]&-2)|0;n=t[m-4>>2];t[o+8>>2]=l;o=m-(n&-2)|0;l=-16;if(!(q[(o+t[o>>2]|0)-4|0]&1))break d;l=t[o+4>>2];t[l+8>>2]=t[o+8>>2];t[t[o+8>>2]+4>>2]=l;p=p-o|0;t[o>>2]=p;break c}t[r+12>>2]=16;t[r>>2]=16;t[r+8>>2]=l;t[r+4>>2]=o;t[600]=r;l=16}o=r+l|0;p=p-o|0;t[o>>2]=p}t[((p&-4)+o|0)-4>>2]=p|1;s=o;m=t[o>>2]-8|0;e:{if(m>>>0<=127){p=(m>>>3|0)-1|0;break e}n=y(m);p=((m>>>29-n^4)-(n<<2)|0)+110|0;if(m>>>0<=4095)break e;p=((m>>>30-n^2)-(n<<1)|0)+71|0;p=p>>>0<63?p:63}l=p<<4;t[s+4>>2]=l+1376;l=l+1384|0;t[o+8>>2]=t[l>>2];t[l>>2]=o;t[t[o+8>>2]+4>>2]=o;l=t[603];o=p&31;(p&63)>>>0>=32?(p=1<>>32-o,o=1<>1]=o;s[m+8>>1]=p;t[m+4>>2]=l;t[m>>2]=r;a:{if(v[m+8>>1]>32767){t[m+12>>2]=4;break a}p=t[m+4>>2];l=t[m>>2];o=A-48|0;A=o;t[o+40>>2]=m+10;t[o+36>>2]=p;t[o+32>>2]=l;q[o+31|0]=2;q[o+30|0]=12;t[o+24>>2]=m+8;q[o+23|0]=2;b:{if(!(t[o+32>>2]?t[o+36>>2]:0)){t[o+44>>2]=5;break b}t[o+16>>2]=u[o+31|0]+(u[o+23|0]+4|0);n=o,r=D(t[o+16>>2]),t[n+12>>2]=r;if(!t[o+12>>2]){t[o+44>>2]=3;break b}t[o+8>>2]=t[o+12>>2];q[t[o+8>>2]]=u[o+30|0];t[o+8>>2]=t[o+8>>2]+1;ba(t[o+8>>2],t[o+40>>2],u[o+23|0]);t[o+8>>2]=u[o+23|0]+t[o+8>>2];t[o+4>>2]=u[o+31|0];p=t[o+8>>2];l=u[o+4|0]|u[o+5|0]<<8;q[p|0]=l;q[p+1|0]=l>>>8;q[p+2|0]=u[o+6|0];t[o+8>>2]=t[o+8>>2]+3;ba(t[o+8>>2],t[o+24>>2],u[o+31|0]);t[t[o+32>>2]>>2]=t[o+16>>2];t[t[o+36>>2]>>2]=t[o+12>>2];t[o+44>>2]=0}A=o+48|0;t[m+12>>2]=t[o+44>>2]}A=m+16|0;return t[m+12>>2]}function H(o,p,l){o=o|0;p=p|0;l=l|0;var q=0,m=0,n=0,r=0,s=0;n=A+-64|0;A=n;m=1;a:{if(R(o,p,0))break a;m=0;if(!p)break a;q=A+-64|0;A=q;m=t[p>>2];r=t[m-4>>2];s=t[m-8>>2];t[q+20>>2]=0;t[q+16>>2]=1084;t[q+12>>2]=p;t[q+8>>2]=1132;m=0;ca(q+24|0,39);p=p+s|0;b:{if(R(r,1132,0)){t[q+56>>2]=1;ka[t[t[r>>2]+20>>2]](r,q+8|0,p,p,1,0);m=t[q+32>>2]==1?p:0;break b}ka[t[t[r>>2]+24>>2]](r,q+8|0,p,1,0);c:switch(t[q+44>>2]){case 0:m=t[q+48>>2]==1?t[q+36>>2]==1?t[q+40>>2]==1?t[q+28>>2]:0:0:0;break b;case 1:break c;default:break b}if(t[q+48>>2]|t[q+36>>2]!=1|t[q+40>>2]!=1?t[q+32>>2]!=1:0)break b;m=t[q+24>>2]}A=q- -64|0;p=m;m=0;if(!p)break a;ca(n+8|4,52);t[n+56>>2]=1;t[n+20>>2]=-1;t[n+16>>2]=o;t[n+8>>2]=p;ka[t[t[p>>2]+28>>2]](p,n+8|0,t[l>>2],1);o=t[n+32>>2];(o|0)==1&&(t[l>>2]=t[n+24>>2]);m=(o|0)==1}o=m;A=n- -64|0;return o|0}function I(o,p,l){var q=0,m,n=0,r=0;q=o+4|0;m=(q+p|0)-1&0-p;p=t[o>>2];if(m+l>>>0<=(p+o|0)-4>>>0){n=t[o+4>>2];t[n+8>>2]=t[o+8>>2];t[t[o+8>>2]+4>>2]=n;(q|0)!=(m|0)&&(m=m-q|0,n=o-(t[o-4>>2]&-2)|0,q=m+t[n>>2]|0,t[n>>2]=q,t[(n+(q&-4)|0)-4>>2]=q,o=o+m|0,p=p-m|0,t[o>>2]=p);a:{if(l+24>>>0<=p>>>0){q=(o+l|0)+8|0;p=(p-l|0)-8|0;t[q>>2]=p;t[(q+(p&-4)|0)-4>>2]=p|1;r=q;n=t[q>>2]-8|0;b:{if(n>>>0<=127){m=(n>>>3|0)-1|0;break b}p=y(n);m=((n>>>29-p^4)-(p<<2)|0)+110|0;if(n>>>0<=4095)break b;p=((n>>>30-p^2)-(p<<1)|0)+71|0;m=p>>>0<63?p:63}p=m;m=p<<4;t[r+4>>2]=m+1376;m=m+1384|0;t[q+8>>2]=t[m>>2];t[m>>2]=q;t[t[q+8>>2]+4>>2]=q;m=t[603];q=p&31;(p&63)>>>0>=32?(p=1<>>32-q,r=1<>2]=p;t[((p&-4)+o|0)-4>>2]=p;break a}t[(o+p|0)-4>>2]=p}o=o+4|0}else o=0;return o}function J(o){var p=0,l,q=0,m,n=0;if(o){l=o-4|0;m=t[l>>2];q=m;p=l;n=t[o-8>>2];o=n&-2;(o|0)!=(n|0)&&(p=l-o|0,q=t[p+4>>2],t[q+8>>2]=t[p+8>>2],t[t[p+8>>2]+4>>2]=q,q=o+m|0);o=l+m|0;l=t[o>>2];(l|0)!=t[(o+l|0)-4>>2]&&(m=t[o+4>>2],t[m+8>>2]=t[o+8>>2],t[t[o+8>>2]+4>>2]=m,q=q+l|0);t[p>>2]=q;t[((q&-4)+p|0)-4>>2]=q|1;n=p;q=t[p>>2]-8|0;a:{if(q>>>0<=127){o=(q>>>3|0)-1|0;break a}m=y(q);o=((q>>>29-m^4)-(m<<2)|0)+110|0;if(q>>>0<=4095)break a;o=((q>>>30-m^2)-(m<<1)|0)+71|0;o=o>>>0<63?o:63}l=o<<4;t[n+4>>2]=l+1376;l=l+1384|0;t[p+8>>2]=t[l>>2];t[l>>2]=p;t[t[p+8>>2]+4>>2]=p;l=t[603];p=o&31;(o&63)>>>0>=32?(o=1<>>32-p,p=1<>2]=n;t[p+36>>2]=o;t[p+32>>2]=l;a:{if(!(t[p+32>>2]?t[p+36>>2]:0)){t[p+44>>2]=5;break a}if(w[p+40>>2]>4){t[p+44>>2]=8;break a}t[p+28>>2]=5;m=p,l=D(t[p+28>>2]),t[m+24>>2]=l;if(!t[p+24>>2]){t[p+44>>2]=3;break a}t[p+20>>2]=t[p+24>>2];q[p+19|0]=3;q[t[p+20>>2]]=u[p+19|0];t[p+20>>2]=t[p+20>>2]+1;t[p+12>>2]=1;n=t[p+20>>2];o=u[p+12|0]|u[p+13|0]<<8;q[n|0]=o;q[n+1|0]=o>>>8;q[n+2|0]=u[p+14|0];t[p+20>>2]=t[p+20>>2]+3;q[p+11|0]=t[p+40>>2];q[t[p+20>>2]]=u[p+11|0];t[t[p+36>>2]>>2]=t[p+24>>2];t[t[p+32>>2]>>2]=t[p+28>>2];t[p+44>>2]=0}A=p+48|0;return t[p+44>>2]}function L(n,o,l,p,m){n=n|0;o=o|0;l=l|0;p=p|0;m=m|0;if(R(n,t[o+8>>2],m)){da(o,l,p);return}a:{if(R(n,t[o>>2],m)){if(!(t[o+20>>2]!=(l|0)?t[o+16>>2]!=(l|0):0)){if((p|0)!=1)break a;t[o+32>>2]=1;return}t[o+32>>2]=p;b:{if(t[o+44>>2]==4)break b;s[o+52>>1]=0;n=t[n+8>>2];ka[t[t[n>>2]+20>>2]](n,o,l,l,1,m);if(u[o+53|0]){t[o+44>>2]=3;if(!u[o+52|0])break b;break a}t[o+44>>2]=4}t[o+20>>2]=l;t[o+40>>2]=t[o+40>>2]+1;if(t[o+36>>2]!=1|t[o+24>>2]!=2)break a;q[o+54|0]=1;return}n=t[n+8>>2];ka[t[t[n>>2]+24>>2]](n,o,l,p,m)}}function M(o,p,l,q,m){var n=0;n=A-32|0;A=n;t[n+24>>2]=o;t[n+20>>2]=p;t[n+16>>2]=l;t[n+12>>2]=q;t[n+8>>2]=m;a:{if(w[n+16>>2]<1){t[n+28>>2]=9;break a}t[t[n+8>>2]>>2]=t[n+16>>2]-1;if(w[t[n+20>>2]>>2]>2]>>2]){t[n+28>>2]=1;break a}o=D(t[t[n+8>>2]>>2]);t[t[n+12>>2]>>2]=o;if(!t[t[n+12>>2]>>2]){t[n+28>>2]=3;break a}ba(t[t[n+12>>2]>>2],t[t[n+24>>2]>>2],t[t[n+8>>2]>>2]);o=t[n+24>>2];t[o>>2]=t[t[n+8>>2]>>2]+t[o>>2];o=t[n+20>>2];t[o>>2]=t[o>>2]-t[t[n+8>>2]>>2];t[n+28>>2]=0}A=n+32|0;return t[n+28>>2]}function N(n,o,l){n=n|0;o=o|0;l=l|0;var p=0,m=0;p=A-32|0;A=p;s[p+26>>1]=n;t[p+20>>2]=o;t[p+16>>2]=l;t[t[p+16>>2]>>2]=3;m=p,l=D(t[t[p+16>>2]>>2]),t[m+12>>2]=l;a:{if(!t[p+12>>2]){t[p+28>>2]=3;break a}t[t[p+20>>2]>>2]=t[p+12>>2];q[p+11|0]=14;q[t[p+12>>2]]=u[p+11|0];t[p+12>>2]=t[p+12>>2]+1;n=t[p+12>>2];o=u[p+26|0]|u[p+27|0]<<8;q[n|0]=o;q[n+1|0]=o>>>8;t[p+28>>2]=0}A=p+32|0;return t[p+28>>2]}function O(m,n){var l=0;l=A-16|0;A=l;t[l+12>>2]=m;t[l+8>>2]=n;t[l+4>>2]=0;while(1){if(w[l+4>>2]>2]){t[l>>2]=t[l+12>>2]+x(t[l+4>>2],20);a:{if(!(t[t[l>>2]>>2]&15)){J(t[t[l>>2]+8>>2]);break a}b:{if((t[t[l>>2]>>2]&15)==5){J(t[t[l>>2]+8>>2]);break b}(t[t[l>>2]>>2]&15)==6&&J(t[t[l>>2]+12>>2])}}t[l+4>>2]=t[l+4>>2]+1;continue}break}J(t[l+12>>2]);A=l+16|0}function P(m,n,l,o){q[m+53|0]=1;a:{if(t[m+4>>2]!=(l|0))break a;q[m+52|0]=1;l=t[m+16>>2];if(!l){t[m+36>>2]=1;t[m+24>>2]=o;t[m+16>>2]=n;if((o|0)!=1|t[m+48>>2]!=1)break a;q[m+54|0]=1;return}if((n|0)==(l|0)){l=t[m+24>>2];(l|0)==2&&(t[m+24>>2]=o,l=o);if(t[m+48>>2]!=1|(l|0)!=1)break a;q[m+54|0]=1;return}q[m+54|0]=1;t[m+36>>2]=t[m+36>>2]+1}}function Q(n,o,l,p){var m;m=A-32|0;t[m+24>>2]=n;t[m+20>>2]=o;t[m+16>>2]=l;t[m+12>>2]=p;q[m+11|0]=0;a:{if(w[t[m+20>>2]>>2]<1){t[m+28>>2]=1;break a}q[m+11|0]=u[t[t[m+24>>2]>>2]];n=t[m+24>>2];t[n>>2]=t[n>>2]+1;n=t[m+20>>2];t[n>>2]=t[n>>2]-1;q[t[m+16>>2]]=(u[m+11|0]&128)==128;q[t[m+12>>2]]=u[m+11|0]&127;t[m+28>>2]=0}return t[m+28>>2]}function ma(n,o,l,p,m){n=n|0;o=o|0;l=l|0;p=p|0;m=m|0;if(R(n,t[o+8>>2],m)){da(o,l,p);return}a:{if(!R(n,t[o>>2],m))break a;if(!(t[o+20>>2]!=(l|0)?t[o+16>>2]!=(l|0):0)){if((p|0)!=1)break a;t[o+32>>2]=1;return}t[o+20>>2]=l;t[o+32>>2]=p;t[o+40>>2]=t[o+40>>2]+1;t[o+36>>2]!=1|t[o+24>>2]!=2||(q[o+54|0]=1);t[o+44>>2]=4}}function R(m,n,l){var o;if(!l)return t[m+4>>2]==t[n+4>>2];if((m|0)==(n|0))return 1;l=t[m+4>>2];m=u[l|0];n=t[n+4>>2];o=u[n|0];a:{if(!m|(o|0)!=(m|0))break a;while(1){o=u[n+1|0];m=u[l+1|0];if(!m)break a;n=n+1|0;l=l+1|0;if((m|0)==(o|0))continue;break}}return(m|0)==(o|0)}function na(m,n){m=m|0;n=n|0;var l=0,o=0;l=A-32|0;A=l;t[l+24>>2]=m;t[l+20>>2]=n;o=l,m=D(1),t[o+16>>2]=m;a:{if(!t[l+16>>2]){t[l+28>>2]=3;break a}q[l+15|0]=9;q[t[l+16>>2]]=u[l+15|0];t[t[l+24>>2]>>2]=t[l+16>>2];t[t[l+20>>2]>>2]=1;t[l+28>>2]=0}A=l+32|0;return t[l+28>>2]}function S(m,n){m=m|0;n=n|0;var l=0,o=0;l=A-32|0;A=l;t[l+24>>2]=m;t[l+20>>2]=n;o=l,m=D(1),t[o+16>>2]=m;a:{if(!t[l+16>>2]){t[l+28>>2]=3;break a}q[l+15|0]=10;q[t[l+16>>2]]=u[l+15|0];t[t[l+24>>2]>>2]=t[l+16>>2];t[t[l+20>>2]>>2]=1;t[l+28>>2]=0}A=l+32|0;return t[l+28>>2]}function T(m,n){m=m|0;n=n|0;var l=0,o=0;l=A-32|0;A=l;t[l+24>>2]=m;t[l+20>>2]=n;o=l,m=D(1),t[o+16>>2]=m;a:{if(!t[l+16>>2]){t[l+28>>2]=3;break a}q[l+15|0]=2;q[t[l+16>>2]]=u[l+15|0];t[t[l+24>>2]>>2]=t[l+16>>2];t[t[l+20>>2]>>2]=1;t[l+28>>2]=0}A=l+32|0;return t[l+28>>2]}function U(m,n){m=m|0;n=n|0;var l=0,o=0;l=A-32|0;A=l;t[l+24>>2]=m;t[l+20>>2]=n;o=l,m=D(1),t[o+16>>2]=m;a:{if(!t[l+16>>2]){t[l+28>>2]=3;break a}q[l+15|0]=4;q[t[l+16>>2]]=u[l+15|0];t[t[l+24>>2]>>2]=t[l+16>>2];t[t[l+20>>2]>>2]=1;t[l+28>>2]=0}A=l+32|0;return t[l+28>>2]}function V(l){var m=0;m=A-16|0;A=m;t[m+12>>2]=l;l=1;a:{if(X(t[m+12>>2])&1)break a;l=1;if(t[m+12>>2]==15)break a;l=1;if(t[m+12>>2]==13)break a;l=1;if(t[m+12>>2]==12)break a;l=t[m+12>>2]==14}A=m+16|0;return l}function W(m,n,l){var o;o=t[m+16>>2];if(!o){t[m+36>>2]=1;t[m+24>>2]=l;t[m+16>>2]=n;return}a:{if((n|0)==(o|0)){if(t[m+24>>2]!=2)break a;t[m+24>>2]=l;return}q[m+54|0]=1;t[m+24>>2]=2;t[m+36>>2]=t[m+36>>2]+1}}function X(l){var m;m=A-16|0;t[m+12>>2]=l;l=1;a:{if(t[m+12>>2]==5)break a;l=1;if(t[m+12>>2]==6)break a;l=1;if(t[m+12>>2]==7)break a;l=t[m+12>>2]==8}return l}function Y(o,p,l,q,m,n){o=o|0;p=p|0;l=l|0;q=q|0;m=m|0;n=n|0;if(R(o,t[p+8>>2],n)){P(p,l,q,m);return}o=t[o+8>>2];ka[t[t[o>>2]+20>>2]](o,p,l,q,m,n)}function Z(){var m=0,n,l;while(1){n=m<<4;l=n+1376|0;t[n+1380>>2]=l;t[n+1384>>2]=l;m=m+1|0;if((m|0)!=64)continue;break}G(48)}function $(m,n,l,o){m=m|0;n=n|0;l=l|0;o=o|0;if(R(m,t[n+8>>2],0)){W(n,l,o);return}m=t[m+8>>2];ka[t[t[m>>2]+28>>2]](m,n,l,o)}function aa(o,p,l,q,m,n){o=o|0,p=p|0,l=l|0,q=q|0,m=m|0,n=n|0,R(o,t[p+8>>2],n)&&P(p,l,q,m)}function ba(m,n,l){if(l)while(1){q[m|0]=u[n|0];m=m+1|0;n=n+1|0;l=l-1|0;if(l)continue;break}}function ca(l,m){if(m)while(1){q[l|0]=0;l=l+1|0;m=m-1|0;if(m)continue;break}}function oa(m,n,l,o){m=m|0,n=n|0,l=l|0,o=o|0,R(m,t[n+8>>2],0)&&W(n,l,o)}function da(m,n,l){t[m+28>>2]==1|t[m+4>>2]!=(n|0)||(t[m+28>>2]=l)}function pa(l,m){l=l|0;m=m|0;return x(m,20)+l|0}function ea(l){l=l|0;return v[l+8>>1]>>>1|0}function qa(l){l=l|0;return s[l+8>>1]&1}function fa(l){l=l|0;return t[l+12>>2]}function ra(l){l=l|0;return t[l>>2]&15}function sa(l){l=l|0;return t[l+16>>2]}function ga(l){l=l|0;return v[l+4>>1]}function ha(l){l=l|0;return t[l+8>>2]}function ia(l){l=l|0;return u[l+4|0]}function ja(l){l=l|0;return l|0}function ta(l){return D(l)}function ua(l){l=l|0,J(l)}function va(l){l|0}n=u;r(l);var ka=m([null,ja,ua,va,va,H,aa,ma,oa,ua,Y,L,$]);function wa(){return p.byteLength/65536|0}function xa(l){l=l|0;var m=wa()|0;l=m+l|0;if(m0&&(l+=m-l%m);return l}var H,I;function J(l){H=l,m.HEAP8=new Int8Array(l),m.HEAP16=new Int16Array(l),m.HEAP32=new Int32Array(l),m.HEAPU8=I=new Uint8Array(l),m.HEAPU16=new Uint16Array(l),m.HEAPU32=new Uint32Array(l),m.HEAPF32=new Float32Array(l),m.HEAPF64=new Float64Array(l)}u=m.INITIAL_MEMORY||2097152;m.wasmMemory?E=m.wasmMemory:E=new D.Memory({initial:u/65536,maximum:2147483648/65536});E&&(H=E.buffer);H.byteLength;J(H);var K,L=[],M=[],N=[];function O(){if(m.preRun){typeof m.preRun=="function"&&(m.preRun=[m.preRun]);while(m.preRun.length)ma(m.preRun.shift())}da(L)}function P(){da(M)}function Q(){if(m.postRun){typeof m.postRun=="function"&&(m.postRun=[m.postRun]);while(m.postRun.length)na(m.postRun.shift())}da(N)}function ma(l){L.unshift(l)}function R(l){M.unshift(l)}function na(l){N.unshift(l)}(!Math.imul||Math.imul(4294967295,5)!==-5)&&(Math.imul=function(l,m){var n=l>>>16;l=l&65535;var o=m>>>16;m=m&65535;return l*m+(n*m+l*o<<16)|0});if(!Math.fround){var S=new Float32Array(1);Math.fround=function(l){S[0]=l;return S[0]}}Math.clz32||(Math.clz32=function(l){var m=32,n=l>>16;n&&(m-=16,l=n);n=l>>8;n&&(m-=8,l=n);n=l>>4;n&&(m-=4,l=n);n=l>>2;n&&(m-=2,l=n);n=l>>1;return n?m-2:m-l});Math.trunc||(Math.trunc=function(l){return l<0?Math.ceil(l):Math.floor(l)});var T=0,U=null,V=null;function W(l){T++,m.monitorRunDependencies&&m.monitorRunDependencies(T)}function X(l){T--;m.monitorRunDependencies&&m.monitorRunDependencies(T);if(T==0){U!==null&&(clearInterval(U),U=null);if(V){l=V;V=null;l()}}}m.preloadedImages={};m.preloadedAudios={};function Y(l){m.onAbort&&m.onAbort(l);l+="";B(l);F=!0;l="abort("+l+"). Build with -s ASSERTIONS=1 for more info.";l=new D.RuntimeError(l);s(l);throw l}var Z="data:application/octet-stream;base64,";function $(l){return l.startsWith(Z)}var aa="dgwcppbridge.wasm";$(aa)||(aa=z(aa));function ba(l){try{if(l==aa&&C)return new Uint8Array(C);var m=ga(l);if(m)return m;if(A)return A(l);else throw"both async and sync fetching of the wasm failed"}catch(l){Y(l)}}function ca(){return!C&&(w||x)&&typeof fetch==="function"?fetch(aa,{credentials:"same-origin"}).then(function(l){if(!l.ok)throw"failed to load wasm binary file at '"+aa+"'";return l.arrayBuffer()})["catch"](function(){return ba(aa)}):n.resolve().then(function(){return ba(aa)})}function oa(){var n={a:ha};function o(n,l){l=n.exports;m.asm=l;K=m.asm.A;R(m.asm.c);X("wasm-instantiate")}W("wasm-instantiate");function r(l){o(l.instance)}function t(l){return ca().then(function(l){l=D.instantiate(l,n);return l}).then(l,function(l){B("failed to asynchronously prepare wasm: "+l),Y(l)})}function u(){if(!C&&typeof D.instantiateStreaming==="function"&&!$(aa)&&typeof fetch==="function")return fetch(aa,{credentials:"same-origin"}).then(function(l){l=D.instantiateStreaming(l,n);return l.then(r,function(l){B("wasm streaming compile failed: "+l);B("falling back to ArrayBuffer instantiation");return t(r)})});else return t(r)}if(m.instantiateWasm)try{var l=m.instantiateWasm(n,o);return l}catch(l){B("Module.instantiateWasm callback failed with error: "+l);return!1}u()["catch"](s);return{}}function da(l){while(l.length>0){var n=l.shift();if(typeof n=="function"){n(m);continue}var o=n.func;typeof o==="number"?n.arg===void 0?K.get(o)():K.get(o)(n.arg):o(n.arg===void 0?null:n.arg)}}function pa(l){try{E.grow(l-H.byteLength+65535>>>16);J(E.buffer);return 1}catch(l){}}function ea(l){var m=I.length;l=l>>>0;var n=2147483648;if(l>n)return!1;for(var o=1;o<=4;o*=2){var p=m*(1+.2/o);p=Math.min(p,l+100663296);p=Math.min(n,la(Math.max(l,p),65536));p=pa(p);if(p)return!0}return!1}var qa=!1;function fa(l){var m=[];for(var n=0;n255&&(qa&&G(!1,"Character code "+o+" ("+String.fromCharCode(o)+") at offset "+n+" not in 0x00-0xFF."),o&=255);m.push(String.fromCharCode(o))}return m.join("")}var ra=typeof atob==="function"?atob:function(l){var m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="",o,p,q,r,s,t=0;l=l.replace(/[^A-Za-z0-9\+\/\=]/g,"");do p=m.indexOf(l.charAt(t++)),q=m.indexOf(l.charAt(t++)),r=m.indexOf(l.charAt(t++)),s=m.indexOf(l.charAt(t++)),p=p<<2|q>>4,q=(q&15)<<4|r>>2,o=(r&3)<<6|s,n=n+String.fromCharCode(p),r!==64&&(n=n+String.fromCharCode(q)),s!==64&&(n=n+String.fromCharCode(o));while(t0)return;O();if(T>0)return;function n(){if(ia)return;ia=!0;m.calledRun=!0;if(F)return;P();o(m);m.onRuntimeInitialized&&m.onRuntimeInitialized();Q()}m.setStatus?(m.setStatus("Running..."),setTimeout(function(){setTimeout(function(){m.setStatus("")},1),n()},1)):n()}m.run=ja;if(m.preInit){typeof m.preInit=="function"&&(m.preInit=[m.preInit]);while(m.preInit.length>0)m.preInit.pop()()}ja();return m.ready}}();typeof q==="object"&&typeof p==="object"?p.exports=r:typeof define==="function"&&define.amd?define([],function(){return r}):typeof q==="object"&&(q.Module=r)}),null); __d("DGWUtils",["Base64","DGWConstants","DGWCppBridge","DGWLoggingContext","Random","URI","regeneratorRuntime"],(function(a,b,c,d,e,f,g){"use strict";var h=4;function a(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=d("Random").random()*16|0;a=a==="x"?b:b&3|8;return a.toString(16)})}function i(a){var b=new TextDecoder();b=b.decode(a);a=c("Base64").encode(b);b=a.replace(/\+/gi,"-").replace(/\//gi,"_").replace(/=/gi,"");return b}var j=null;e=function(){function a(){}a.initialize=function(){return b("regeneratorRuntime").async(function(a){while(1)switch(a.prev=a.next){case 0:if(!(j!=null)){a.next=2;break}return a.abrupt("return");case 2:a.next=4;return b("regeneratorRuntime").awrap(c("DGWCppBridge")());case 4:j=a.sent;case 5:case"end":return a.stop()}},null,this)};a.constructConnectUrl=function(a){var b,e=a.appId,f=a.appVersion,g=a.authType,h=a.dgwVersion,j=a.fbId,k=a.tier,l=a.loggingId,m=a.headers,n=a.endpoint,o=a.serviceId,p=a.regionHint;a=a.establishStreamFrame;var q=(b={},b[d("DGWConstants").HEADER_CONSTANTS.HEADER_APPID]=e,b[d("DGWConstants").HEADER_CONSTANTS.HEADER_APPVERSION]=f,b[d("DGWConstants").HEADER_CONSTANTS.HEADER_AUTHTYPE]=g,b[d("DGWConstants").HEADER_CONSTANTS.HEADER_DGW_VERSION]=""+h,b[d("DGWConstants").HEADER_CONSTANTS.HEADER_UUID]=j,b[d("DGWConstants").HEADER_CONSTANTS.HEADER_TARGET_TIER]=k,b);a!==void 0&&(q[d("DGWConstants").HEADER_CONSTANTS.HEADER_ESTABLISH_STREAM_FRAME_BASE64]=i(a));l!==void 0&&(q[d("DGWConstants").HEADER_CONSTANTS.HEADER_LOGGING_ID]=l);p!==void 0&&(q[d("DGWConstants").HEADER_CONSTANTS.HEADER_REGIONHINT]=p);Object.keys(m).forEach(function(a){var b=d("DGWConstants").HEADER_CONSTANTS.APPHEADER_PREFIX+a;Object.prototype.hasOwnProperty.call(q,b)||(q[b]=m[a])});e=new(c("URI"))(n);e.setQueryData(q);e.setPath(e.getPath()+"/"+o);e.toString().length>2e3&&(delete q[d("DGWConstants").HEADER_CONSTANTS.HEADER_ESTABLISH_STREAM_FRAME_BASE64],e.setQueryData(q));return e.toString()};return a}();f=function(){function a(a,b,c){this.$1=null,this.$2=a,this.$3=b,this.$4=c}a.initialize=function(){return b("regeneratorRuntime").async(function(a){while(1)switch(a.prev=a.next){case 0:if(!(j!=null)){a.next=2;break}return a.abrupt("return");case 2:a.next=4;return b("regeneratorRuntime").awrap(c("DGWCppBridge")());case 4:j=a.sent;case 5:case"end":return a.stop()}},null,this)};var e=a.prototype;e.malloc=function(a){try{a=j.__malloc(a);if(a===0){var b;(b=this.$2)==null?void 0:b.logError(d("DGWLoggingContext").DGWLoggingComponent.CODEC_COMPONENT,"wasm malloc failure","malloc returned 0");return-1}return a}catch(a){(b=this.$2)==null?void 0:b.logError(d("DGWLoggingContext").DGWLoggingComponent.CODEC_COMPONENT,"wasm malloc failure","exception during malloc",a.toString());return-1}};e.free=function(a){j.__free(a)};e.append=function(a){if(this.$1==null){this.$1=a;return}var b=this.$1.length,c=new Uint8Array(b+a.length);c.set(this.$1,0);c.set(a,b);this.$1=c};e.processData=function(){var a=this;if(this.$1==null)return;var b=this.$1.length,c=this.malloc(b);if(c===-1)return;var e=j.HEAPU8.subarray(c,c+b);if(this.$1)for(var f=0;fi){this.$1=new Uint8Array(((b=this.$1)==null?void 0:b.subarray(i))||[])}else this.$1=null;k=j.HEAPU32.subarray(g/h,g/h+1)[0];c=j.HEAPU32.subarray(e/h,e/h+1)[0];var l=[];for(b=0;b0&&(d("DGWLoggingContext").DGWLoggingContext.bumpODSKey(d("DGWLoggingContext").DGWLoggingComponent.PINGER,"reset.newtimeout"),this.$2=window.setTimeout(function(){a.$6()},this.$1))};b.cancel=function(){this.$2&&(d("DGWLoggingContext").DGWLoggingContext.bumpODSKey(d("DGWLoggingContext").DGWLoggingComponent.PINGER,"canceled"),window.clearTimeout(this.$2),this.$2=null)};return a}();g.DGWPinger=a}),98); __d("DGWStreamGroupCallbacks",["$InternalEnum"],(function(a,b,c,d,e,f){"use strict";a=b("$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});c=function(){function a(){}var b=a.prototype;b.onStreamGroupError=function(){};b.onStreamGroupMustDrain=function(){};b.onStreamGroupTransportClose=function(){};return a}();f.DGWStreamGroupError=a;f.NoOpDGWStreamGroupCallbacks=c}),66); __d("DGWTransportEvents",["DGWLoggingContext"],(function(a,b,c,d,e,f,g){"use strict";a=function(){function a(a){this.$3=a}var b=a.prototype;b.transportEstablished=function(){this.$3.logEvent(d("DGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"open"),this.$2=Date.now()};b.transportEstablishmentPending=function(){this.$1=Date.now(),this.$3.logEvent(d("DGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"transportPending",null,!0)};b.transportClosed=function(a,b){this.$4=Date.now(),a?(d("DGWLoggingContext").DGWLoggingContext.bumpODSKey(d("DGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"transport_close_graceful"),this.$3.logEvent(d("DGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"Transport closed gracefully",null,!0)):(d("DGWLoggingContext").DGWLoggingContext.bumpODSKey(d("DGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"transport_close_with_error"),this.$3.logError(d("DGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"Transport closed abnormally",b))};b.transportEstablishmentFailure=function(a){this.$3.logError(d("DGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"WebSocket transport establishment failure","WebSocket close code: "+a)};b.streamEstablishmentTimeout=function(a,b){this.$3.logError(d("DGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"Grouped Stream establishment timeout",a,"streamId:"+b)};b.streamEstablishmentPending=function(a){this.$3.logEvent(d("DGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"Grouped Stream establishment pending","streamId:"+a,!0)};b.streamEstablishmentSuccess=function(a){this.$3.logEvent(d("DGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"Grouped Stream establishment success","streamId:"+a,!0)};b.transportError=function(a,b,c){this.$3.logError(d("DGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,a,b,c)};b.receivedFrameForInactiveStream=function(a,b,c){this.$3.logWarn(d("DGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"Frame received for inactive stream","frameType: "+a+", streamID: "+b,c)};b.ranOutOfStreamIds=function(a){this.$3.logWarn(d("DGWLoggingContext").DGWLoggingComponent.WEBSOCKET_TRANSPORT_COMPONENT,"Hit max StreamId limit","Hit max StreamId limit",a)};return a}();g.DGWTransportEvents=a}),98); __d("DGWWebSocketTransport",[],(function(a,b,c,d,e,f){"use strict";function a(a){a=new WebSocket(a);a.binaryType="arraybuffer";a.onopen=function(){};a.onclose=function(){};a.onerror=function(){};return a}f.getWebSocketConnection=a}),66); __d("DGWAckManager",["DGWLoggingContext","Promise","regeneratorRuntime"],(function(a,b,c,d,e,f,g){"use strict";var h=function(){var b=a.prototype;b.stopTracking=function(a){window.clearTimeout(this.$1),this.$3(a)};function a(a,b,c){var d=this;this.$3=c;this.sendId=a;this.$2=b;this.handleAckReceived=function(){d.stopTracking(!0)};this.$1=window.setTimeout(function(){d.stopTracking(!1)},b)}return a}();a=function(){function a(a){this.$1=new Map(),this.$2=a}var c=a.prototype;c.waitForAck=function(a,c){var e,f;return b("regeneratorRuntime").async(function(g){while(1)switch(g.prev=g.next){case 0:d("DGWLoggingContext").DGWLoggingContext.bumpODSKey(d("DGWLoggingContext").DGWLoggingComponent.ACK_MANAGER_COMPONENT,"ack_expected");e=this.$1;g.prev=2;g.next=5;return b("regeneratorRuntime").awrap(new(b("Promise"))(function(b,d){e.set(a,new h(a,c,b))}));case 5:f=g.sent;f===!0?this.$2.logEvent(d("DGWLoggingContext").DGWLoggingComponent.ACK_MANAGER_COMPONENT,"Received ACK","sendId: "+a,!0):(d("DGWLoggingContext").DGWLoggingContext.bumpODSKey(d("DGWLoggingContext").DGWLoggingComponent.ACK_MANAGER_COMPONENT,"ack_timeout"),this.$2.logWarn(d("DGWLoggingContext").DGWLoggingComponent.ACK_MANAGER_COMPONENT,"ACK timeout","Request "+a+" timed out after "+c+"ms"));e["delete"](a);return g.abrupt("return",f);case 11:g.prev=11;g.t0=g["catch"](2);e["delete"](a);throw g.t0;case 15:case"end":return g.stop()}},null,this,[[2,11]])};c.handleAckReceived=function(a){d("DGWLoggingContext").DGWLoggingContext.bumpODSKey(d("DGWLoggingContext").DGWLoggingComponent.ACK_MANAGER_COMPONENT,"ack_received");var b=this.$1.get(a);if(b===void 0){d("DGWLoggingContext").DGWLoggingContext.bumpODSKey(d("DGWLoggingContext").DGWLoggingComponent.ACK_MANAGER_COMPONENT,"ack_received.not_tracked");this.$2.logWarn(d("DGWLoggingContext").DGWLoggingComponent.ACK_MANAGER_COMPONENT,"untracked ACK","Received ACK for ackId "+a+" which was not being tracked");return}b.handleAckReceived()};c.clearPendingAcks=function(){var a=this;this.$2.logEvent(d("DGWLoggingContext").DGWLoggingComponent.ACK_MANAGER_COMPONENT,"Clearing pending acks","ACKs cleared size: "+this.$1.size);this.$1.forEach(function(b,c,e){a.$2.logEvent(d("DGWLoggingContext").DGWLoggingComponent.ACK_MANAGER_COMPONENT,"Clearing pending ACK with ackId "+b.sendId,null,!0),b.stopTracking(!1),e["delete"](c)})};return a}();g.DGWAckManager=a}),98); __d("DGWStreamEvents",["DGWLoggingContext"],(function(a,b,c,d,e,f,g){"use strict";a=function(){function a(a,b,c){this.$4=new Map(),this.$5=new Map(),this.$6=a,this.$1=b,c!=null&&(this.$8="streamId:"+c+"::")}var b=a.prototype;b.streamEstablished=function(){this.$6.logEvent(this.$1,"open",this.$8,!0),d("DGWLoggingContext").DGWLoggingContext.bumpODSKey(this.$1,"stream_establishment_success")};b.streamEstablishmentPending=function(){this.$2=Date.now(),this.$6.logEvent(this.$1,"streamPending",this.$8,!0),d("DGWLoggingContext").DGWLoggingContext.bumpODSKey(this.$1,"stream_establishment_pending")};b.dataSent=function(a,b,c){var d=c?"sendWithAckRequested":"sendWithoutAckRequested";this.$6.logEvent(this.$1,d,((d=this.$8)!=null?d:"")+"sendId:"+a+", payloadSize:"+b,!0);this.$4.set(a,{ackRequested:c,payloadSize:b,sendTimestamp:Date.now()})};b.ackReceived=function(a){var b;this.$6.logEvent(this.$1,"AckReceived",((b=this.$8)!=null?b:"")+"sendId:"+a+"}",!0);d("DGWLoggingContext").DGWLoggingContext.bumpODSKey(this.$1,"ack_received");b=this.$4.get(a);b!=null&&(b.ackReceivedTimestamp=Date.now())};b.ackSent=function(a){var b;d("DGWLoggingContext").DGWLoggingContext.bumpODSKey(this.$1,"ack_sent");this.$6.logEvent(this.$1,"ACK sent",((b=this.$8)!=null?b:"")+"ackId: "+a,!0)};b.drainSent=function(a){var b;this.$6.logEvent(this.$1,"Drain sent",((b=this.$8)!=null?b:"")+"drainReason: "+a)};b.dataReceived=function(a,b,c){var e;d("DGWLoggingContext").DGWLoggingContext.bumpODSKey(this.$1,"data_received");this.$6.logEvent(this.$1,"Data received",((e=this.$8)!=null?e:"")+"sendId: "+((e=c)!=null?e:"null")+", ackRequested: "+b.toString()+", payloadSize: "+a,!0);c!=null&&this.$5.set(c,{ackRequested:b,payloadSize:a,receiveTimestamp:Date.now()})};b.endOfDataReceived=function(){d("DGWLoggingContext").DGWLoggingContext.bumpODSKey(this.$1,"end_of_data_received"),this.$6.logEvent(this.$1,"EndOfDataReceived",this.$8,!0)};b.endOfDataSent=function(){d("DGWLoggingContext").DGWLoggingContext.bumpODSKey(this.$1,"end_of_data_sent"),this.$6.logEvent(this.$1,"EndOfDataSent",this.$8,!0)};b.streamClosed=function(a,b){this.$7=Date.now();var c=this.$9();if(a){d("DGWLoggingContext").DGWLoggingContext.bumpODSKey(this.$1,"stream_closed_gracefully");this.$6.logEvent(this.$1,"Stream closed gracefully",""+((a=this.$8)!=null?a:"")+c)}else{d("DGWLoggingContext").DGWLoggingContext.bumpODSKey(this.$1,"stream_closed_with_error");this.$6.logError(this.$1,"Stream closed abnormally",b,""+((a=this.$8)!=null?a:"")+c)}};b.connectionEstablishmentFailure=function(a){this.$6.logEvent(this.$1,"WebSocket connection establishment failure","WebSocket close code: "+a)};b.streamEstablishmentFailure=function(a,b){this.$6.logError(this.$1,"Failed to establish DGW Stream","Last seen error: "+a.toString(),""+((a=this.$8)!=null?a:"")+b);d("DGWLoggingContext").DGWLoggingContext.bumpODSKey(this.$1,"stream_establishment_failure")};b.error=function(a,b){b={msg:b,state:this.$9()};this.$6.logError(this.$1,a,JSON.stringify(b),this.$8)};b.$9=function(){var a={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(a)};return a}();g.DGWStreamEvents=a}),98); __d("GroupedStream",["DGWAckManager","DGWConstants","DGWLoggingContext","DGWStream","DGWStreamEvents","regeneratorRuntime"],(function(a,b,c,d,e,f,g){"use strict";a=function(){function a(a,b,c,e,f,g,h){this.$1=a,this.$3=!1,this.$4=!1,this.$5=!1,this.$6=b,this.$7=c,this.$8=e,this.$2=g,this.$9=f,this.$10=new(d("DGWAckManager").DGWAckManager)(this.$9),this.$12=new(d("DGWStreamEvents").DGWStreamEvents)(this.$9,d("DGWLoggingContext").DGWLoggingComponent.GROUPED_STREAM_COMPONENT,this.$1),this.$11=0,this.$13=h}var c=a.prototype;c.send=function(a,c){var e,f,g;return b("regeneratorRuntime").async(function(h){while(1)switch(h.prev=h.next){case 0:f=this.$11++%d("DGWConstants").MAX_ACK_ID;if(this.$14(a,!0,f)){h.next=3;break}return h.abrupt("return",!1);case 3:h.next=5;return b("regeneratorRuntime").awrap(this.$10.waitForAck(f,(e=c)!=null?e:d("DGWConstants").DEFAULT_ACK_TIMEOUT_MS));case 5:g=h.sent;return h.abrupt("return",g);case 7:case"end":return h.stop()}},null,this)};c.sendAndForget=function(a){return this.$14(a,!1)};c.close=function(){var a=this.$2.encodeEndOfData(this.$1);if(a==null){this.$9.logError(d("DGWLoggingContext").DGWLoggingComponent.GROUPED_STREAM_COMPONENT,"Failed to encode EndOfData","streamId: "+this.$1);return}a=this.$8.send(a);if(!a){this.$9.logError(d("DGWLoggingContext").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.$15()};c.__sendDrain=function(a){var b=d("DGWConstants").drainReasonToDrainReasonString(a);if(this.$5)return!1;a=this.$2.encodeDrain(a);if(a==null)return!1;this.$12.drainSent(b);b=this.$8.send(a);return b};c.__transportCloseHook=function(a){this.$13(),this.$10.clearPendingAcks(),a?(this.$12.error("Received StreamError","StreamErrorType: "+a),this.$6.onError(a)):this.$5&&this.$4?this.$15():(this.$12.streamClosed(!1,"Stream closed: ClosedLocally: "+this.$5.toString()+", EndOfDataReceived: "+this.$4.toString()),this.$6.onError(d("DGWStream").StreamError.PREMATURE_CLOSE))};c.$15=function(){this.$13(),this.$12.streamClosed(!0,"Graceful close"),this.$6.onClose(this)};c.__dataReceivedHook=function(a,b){this.$12.dataReceived(a.length,b!=null,b),b!=null&&this.$16(b),this.$6.onDataReceived(a)};c.__ackReceivedHook=function(a){this.$12.ackReceived(a),this.$10.handleAckReceived(a)};c.__drainReceivedHook=function(a){this.$3===!1&&(this.$6.onStreamMustDrain(this,a),this.$3=!0)};c.__endOfDataHook=function(){this.$12.endOfDataReceived(),this.$4=!0,this.$5?this.$15():this.$6.onServerHasFinishedSendingData(this)};c.$14=function(a,b,c){b===void 0&&(b=!1);c===void 0&&(c=0);if(this.$5){this.$9.logError(d("DGWLoggingContext").DGWLoggingComponent.GROUPED_STREAM_COMPONENT,"Failed to send data","Stream closed locally");return!1}a=this.$2.encodeData(a,b,c,this.$1);if(a==null)return!1;var e=this.$8.send(a);if(!e){this.$9.logError(d("DGWLoggingContext").DGWLoggingComponent.GROUPED_STREAM_COMPONENT,"Failed to send data","ClosedLocally: "+this.$5.toString());return!1}this.$12.dataSent(c,a.length,b);return!0};c.$16=function(a){var b=this.$2.encodeAck(a,this.$1);if(b==null){this.$9.logError(d("DGWLoggingContext").DGWLoggingComponent.GROUPED_STREAM_COMPONENT,"Failed to encode ACK","ackId: "+a);return!1}b=this.$8.send(b);if(!b){this.$9.logError(d("DGWLoggingContext").DGWLoggingComponent.GROUPED_STREAM_COMPONENT,"Failed to send ACK","ackId: "+a);return!1}this.$12.ackSent(a);return!0};return a}();g.GroupedStream=a}),98); __d("StreamIdGenerator",["err"],(function(a,b,c,d,e,f,g){"use strict";var h=65535;a=function(){function a(){this.$1=new Set(),this.$2=0,this.$1.add(this.$2)}var b=a.prototype;b.getNextStreamId=function(){var a;if(!this.streamIdAvailable())throw c("err")("Max number of stream IDs reached");if(this.$1.size===0)return++this.$2;a=(a=this.$1.values().next().value)!=null?a:0;this.$1["delete"](a);return a};b.putBackStreamId=function(a){this.$1.add(a)};b.streamIdAvailable=function(){return this.$1.size>0||this.$2=a.length)break;e=a[d++]}else{d=a.next();if(d.done)break;e=d.value}e=e;e=e.bucketIndex;if(e==void 0)break;b.push(e)}return b};b=function(a){var b=[];for(var a=a,c=Array.isArray(a),d=0,a=c?a:a[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var e;if(c){if(d>=a.length)break;e=a[d++]}else{d=a.next();if(d.done)break;e=d.value}e=e;e=e.bucketName;if(e===void 0)break;b.push(e)}return b};var g=function(a){return a.name};c=function(a){return a.map(g)};d=function(a){var b=[];for(var a=a,c=Array.isArray(a),d=0,a=c?a:a[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var e;if(c){if(d>=a.length)break;e=a[d++]}else{d=a.next();if(d.done)break;e=d.value}e=e;e=e.value;if(e===void 0)break;b.push(e)}return b};f.getBucketIndices=a;f.getBucketNames=b;f.getContextNames=c;f.getContextValues=d}),66); __d("ContextualConfigCollateExposureData",["ContextualConfigConstants","ContextualConfigResolvedContextsUtils"],(function(a,b,c,d,e,f,g){"use strict";var h=["cfg_ver_timestamp","policy_id","version","sample_rate"],i=function(a){return a.join(d("ContextualConfigConstants").LIST_DELIMITER)},j=function(a,b){for(var c=0;cx())&&(u=a.toString(16)+"-"+(~~(Math.random()*16777215)).toString(16),F().set(l,u));return u}function z(){return{user_agent:window.navigator.userAgent,screen_height:window.screen.availHeight,screen_width:window.screen.availWidth,density:window.screen.devicePixelRatio||null,platform:window.navigator.platform||null,locale:window.navigator.language||null}}function A(){return{locale:navigator.language}}function B(a,b,c,d,e,f,g){var h=g!=null&&g!=0?g:Date.now();t=g!=null&&g!=0?Date.now():h;g=b!=null&&b!=""?b:p;return{name:a,time:h/1e3,module:g,obj_type:d,obj_id:e,uuid:f,extra:c}}function C(a,b,c){return B("content",null,{flags:b},null,null,a,c)}function D(a){var b=window.__mrdr;if(b)for(var c in b){var d=b[c];if(d[3]!==0){delete b[c];if(c==="1")if(r!==null)c=r;else continue;a.push(C(c,1,d[1]));a.push(C(c,2,d[2]));a.push(C(c,3,d[3]))}}}function E(a,c){D(a);if(a.length===0)return;o&&a.push(B("counters",null,m));var d=b("Banzai").BASIC;c==="vital"&&(d=b("Banzai").VITAL);var e=b("MarauderConfig").gk_enabled;s===0&&e&&(a.push(B("device_status",null,A())),d={delay:5e3});c==="signal"&&(d={signal:!0});e&&Math.random()<.01&&a.push(B("device_info",null,z()));if(r!==null)for(c=0;c0},i=function(a){return typeof a==="number"&&!isNaN(a)&&a!==Infinity&&a!==-Infinity},j=function(a){return typeof a==="string"},k=function(a){switch(a){case d("ContextualConfigConstants").TYPE.BOOL:case d("ContextualConfigConstants").TYPE.FLOAT:case d("ContextualConfigConstants").TYPE.INT:case d("ContextualConfigConstants").TYPE.STRING:return!0;default:return!1}};g.isArray=a;g.isBoolean=b;g.isDefined=c;g.isKey=e;g.isInteger=f;g.isNonEmptyString=h;g.isNumber=i;g.isString=j;g.isType=k}),98); __d("ContextualConfigParseBoolean",["ContextualConfigConstants"],(function(a,b,c,d,e,f,g){"use strict";function a(a){switch(a.toUpperCase()){case"TRUE":return!0;case"FALSE":return!1;default:throw new Error(d("ContextualConfigConstants").ERROR.BAD_BOOLEAN_FORMAT)}}g["default"]=a}),98); __d("ContextualConfigParsePredBoolean",["ContextualConfigConstants","ContextualConfigParseBoolean"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b){var e;switch(b){case d("ContextualConfigConstants").CONTEXT_BUCKET_STRATEGY.SAME:var f=c("ContextualConfigParseBoolean")(a);e=function(a){return a===f};break;case d("ContextualConfigConstants").CONTEXT_BUCKET_STRATEGY.NULL:e=function(a){return a==null};break;case d("ContextualConfigConstants").CONTEXT_BUCKET_STRATEGY.NNULL:e=function(a){return a!=null};break;case d("ContextualConfigConstants").CONTEXT_BUCKET_STRATEGY.CATCH_ALL:e=function(a){return!0};break;default:throw new Error(d("ContextualConfigConstants").ERROR.ILLEGAL_BOOLEAN_STRATEGY)}return function(a){return e(a)}}g["default"]=a}),98); __d("ContextualConfigParseFloat",["ContextualConfigAssert","ContextualConfigConstants","ContextualConfigValidators"],(function(a,b,c,d,e,f,g){"use strict";var h=/^[-\+]?([1-9]\d*|0)(\.\d+)?$/,i=function(a){return h.test(a)};function a(a){c("ContextualConfigAssert")(i(a),d("ContextualConfigConstants").ERROR.BAD_NUMBER_FORMAT);a=parseFloat(a);c("ContextualConfigAssert")(d("ContextualConfigValidators").isNumber(a),d("ContextualConfigConstants").ERROR.BAD_NUMBER_FORMAT);return a}g["default"]=a}),98); __d("ContextualConfigParseInteger",["ContextualConfigAssert","ContextualConfigConstants","ContextualConfigValidators"],(function(a,b,c,d,e,f,g){"use strict";var h=/^[-\+]?([1-9]\d*|0)$/,i=function(a){return h.test(a)};function a(a){c("ContextualConfigAssert")(i(a),d("ContextualConfigConstants").ERROR.BAD_NUMBER_FORMAT);a=parseInt(a,10);c("ContextualConfigAssert")(d("ContextualConfigValidators").isNumber(a),d("ContextualConfigConstants").ERROR.BAD_NUMBER_FORMAT);return a}g["default"]=a}),98); __d("ContextualConfigPredAssertions",["ContextualConfigAssert","ContextualConfigConstants"],(function(a,b,c,d,e,f,g){"use strict";a=function(a){return c("ContextualConfigAssert")(a>0,d("ContextualConfigConstants").ERROR.MISMATCH_NUMBER_OF_VALUES)};b=function(a,b){return c("ContextualConfigAssert")(a===b,d("ContextualConfigConstants").ERROR.MISMATCH_NUMBER_OF_VALUES)};e=function(a,b){return c("ContextualConfigAssert")(a=g[0]&&ag[0]};break;case d("ContextualConfigConstants").CONTEXT_BUCKET_STRATEGY.GTE:d("ContextualConfigPredAssertions").assertNumberOfValues(g.length,1);h=function(a){if(typeof a!=="number")return!1;return f&&!d("ContextualConfigValidators").isInteger(a)?!1:a>=g[0]};break;default:throw new Error(d("ContextualConfigConstants").ERROR.ILLEGAL_NUMERIC_STRATEGY)}return function(a){return h(a)}}g["default"]=a}),98); __d("ContextualConfigParseRegExp",["ContextualConfigConstants"],(function(a,b,c,d,e,f,g){"use strict";var h=/^\/(.+)\/(.*)$/;function a(a){try{var b=a.match(h);if(b!=null)return new RegExp(b[1],b[2]);else return new RegExp(a)}catch(a){throw new Error(d("ContextualConfigConstants").ERROR.REGEX_SYNTAX_ERROR)}}g["default"]=a}),98); __d("ContextualConfigParsePredString",["ContextualConfigConstants","ContextualConfigParseRegExp","ContextualConfigPredAssertions"],(function(a,b,c,d,e,f,g){"use strict";var h=function(a){if(typeof a!=="string")throw new Error(d("ContextualConfigConstants").ERROR.INVALID_VALUE_TYPE);return a},i=function(a){var b=[];for(var a=a,c=Array.isArray(a),d=0,a=c?a:a[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var e;if(c){if(d>=a.length)break;e=a[d++]}else{d=a.next();if(d.done)break;e=d.value}e=e;b.push(h(e))}return b};function a(a,b,e){var f=i(e),g;switch(b){case d("ContextualConfigConstants").CONTEXT_BUCKET_STRATEGY.SAME:g=function(b){return typeof b!=="string"?!1:b===a};break;case d("ContextualConfigConstants").CONTEXT_BUCKET_STRATEGY.NULL:g=function(a){return a==null};break;case d("ContextualConfigConstants").CONTEXT_BUCKET_STRATEGY.NNULL:g=function(a){return a!=null};break;case d("ContextualConfigConstants").CONTEXT_BUCKET_STRATEGY.CATCH_ALL:g=function(a){return!0};break;case d("ContextualConfigConstants").CONTEXT_BUCKET_STRATEGY.IN:d("ContextualConfigPredAssertions").assertHasValues(f.length);g=function(a){return typeof a!=="string"?!1:f.indexOf(a)!==-1};break;case d("ContextualConfigConstants").CONTEXT_BUCKET_STRATEGY.NIN:d("ContextualConfigPredAssertions").assertHasValues(f.length);g=function(a){return typeof a!=="string"?!1:f.indexOf(a)===-1};break;case d("ContextualConfigConstants").CONTEXT_BUCKET_STRATEGY.CONTAINS:d("ContextualConfigPredAssertions").assertNumberOfValues(f.length,1);g=function(a){return typeof a!=="string"?!1:a.indexOf(f[0])!==-1};break;case d("ContextualConfigConstants").CONTEXT_BUCKET_STRATEGY.REGEX:d("ContextualConfigPredAssertions").assertNumberOfValues(f.length,1);var h=c("ContextualConfigParseRegExp")(f[0]);g=function(a){return typeof a!=="string"?!1:h.test(a)};break;default:throw new Error(d("ContextualConfigConstants").ERROR.ILLEGAL_STRING_STRATEGY)}return function(a){return g(a)}}g["default"]=a}),98); __d("ContextualConfigParseContextBuckets",["ContextualConfigAssert","ContextualConfigConstants","ContextualConfigParsePredBoolean","ContextualConfigParsePredNumeric","ContextualConfigParsePredString","ContextualConfigValidators"],(function(a,b,c,d,e,f,g){"use strict";var h=function(a){return c("ContextualConfigAssert")(d("ContextualConfigValidators").isDefined(a),d("ContextualConfigConstants").ERROR.MISSING_BUCKETS)},i=function(a){return c("ContextualConfigAssert")(d("ContextualConfigValidators").isArray(a),d("ContextualConfigConstants").ERROR.MISSING_BUCKETS)},j=d("ContextualConfigValidators").isKey(d("ContextualConfigConstants").CONTEXT_BUCKET_STRATEGY),k=function(a){return c("ContextualConfigAssert")(d("ContextualConfigValidators").isString(a)&&j(a.toUpperCase()),d("ContextualConfigConstants").ERROR.MISSING_BUCKET_STRATEGY)},l=function(a){return c("ContextualConfigAssert")(d("ContextualConfigValidators").isArray(a),d("ContextualConfigConstants").ERROR.ILLEGAL_BUCKET_VALUES)},m=function(a){return c("ContextualConfigAssert")(d("ContextualConfigValidators").isNonEmptyString(a),d("ContextualConfigConstants").ERROR.MISSING_BUCKET_NAME)},n=function(a,b){var e=b.name;m(e);var f=b.strategy;k(f);b=b.values||[];l(b);switch(a){case d("ContextualConfigConstants").TYPE.BOOL:return c("ContextualConfigParsePredBoolean")(e,f);case d("ContextualConfigConstants").TYPE.FLOAT:return c("ContextualConfigParsePredNumeric")(e,f,b,!1);case d("ContextualConfigConstants").TYPE.INT:return c("ContextualConfigParsePredNumeric")(e,f,b,!0);case d("ContextualConfigConstants").TYPE.STRING:return c("ContextualConfigParsePredString")(e,f,b);default:throw new Error(d("ContextualConfigConstants").ERROR.UNKNOWN_BUCKET_DEFINITION)}},o=function(a,b){h(b);var c=b.name;m(c);return{name:c,pred:n(a,b)}};function a(a,b){i(b);return b.map(function(b){return o(a,b)})}g["default"]=a}),98); __d("ContextualConfigParseContexts",["ContextualConfigAssert","ContextualConfigConstants","ContextualConfigParseContextBuckets","ContextualConfigValidators"],(function(a,b,c,d,e,f,g){"use strict";var h=function(a){return c("ContextualConfigAssert")(d("ContextualConfigValidators").isDefined(a),d("ContextualConfigConstants").ERROR.BAD_CONTEXT_IDENTIFIER)},i=function(a){return c("ContextualConfigAssert")(d("ContextualConfigValidators").isArray(a)&&a.length>0,d("ContextualConfigConstants").ERROR.MISSING_CONTEXT_IN_CONFIG)},j=function(a){return c("ContextualConfigAssert")(d("ContextualConfigValidators").isNonEmptyString(a),d("ContextualConfigConstants").ERROR.BAD_CONTEXT_IDENTIFIER)},k=function(a){return c("ContextualConfigAssert")(d("ContextualConfigValidators").isType(a),d("ContextualConfigConstants").ERROR.BAD_CONTEXT_IDENTIFIER)},l=function(a){h(a);var b=a.name,d=a.type;a=a.buckets;j(b);k(d);return{name:b,type:d,buckets:c("ContextualConfigParseContextBuckets")(d,a)}};function a(a){i(a);return a.map(l)}g["default"]=a}),98); __d("ContextualConfigIsEqualParams",[],(function(a,b,c,d,e,f){"use strict";function a(a,b){if(a.length!=b.length)return!1;for(var c=0;c=a.length)break;f=a[e++]}else{e=a.next();if(e.done)break;f=e.value}f=f;if(f.name===b)return f.type}throw new Error(d("ContextualConfigConstants").ERROR.UNDECLARED_OUTPUT_PARAM)},m=function(a){return function(b){i(b);var d=b.name;j(d);var e=l(a,d);k(e);b=c("ContextualConfigParseResultParamValue")(e,b.value);return{name:d,type:e,value:b}}};function a(a,b){h(b);return b.map(m(a))}g["default"]=a}),98); __d("ContextualConfigParseDenseResultParams",["ContextualConfigAssert","ContextualConfigConstants","ContextualConfigIsEqualParams","ContextualConfigParseResultParams"],(function(a,b,c,d,e,f,g){"use strict";var h=function(a,b){return c("ContextualConfigAssert")(c("ContextualConfigIsEqualParams")(a,b),d("ContextualConfigConstants").ERROR.RESULTS_VECTOR_SIZE_MISMATCH)};function a(a,b){b=c("ContextualConfigParseResultParams")(a,b.map(function(b,c){return{name:a[c].name,value:b}}));h(a,b);return b}g["default"]=a}),98); __d("ContextualConfigParseDenseDefaults",["ContextualConfigConstants","ContextualConfigParseDenseResultParams"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b){try{return c("ContextualConfigParseDenseResultParams")(a,b)}catch(a){throw new Error(d("ContextualConfigConstants").ERROR.MISSING_DEFAULT_VALUE)}}g["default"]=a}),98); __d("ContextualConfigParseMonitors",["ContextualConfigAssert","ContextualConfigConstants","ContextualConfigValidators"],(function(a,b,c,d,e,f,g){"use strict";var h=function(a){return c("ContextualConfigAssert")(d("ContextualConfigValidators").isDefined(a),d("ContextualConfigConstants").ERROR.BAD_CONTEXT_IDENTIFIER)},i=function(a){return c("ContextualConfigAssert")(d("ContextualConfigValidators").isArray(a),d("ContextualConfigConstants").ERROR.BAD_MONITORED_CONTEXTS)},j=function(a){return c("ContextualConfigAssert")(d("ContextualConfigValidators").isNonEmptyString(a),d("ContextualConfigConstants").ERROR.BAD_CONTEXT_IDENTIFIER)},k=function(a){return c("ContextualConfigAssert")(d("ContextualConfigValidators").isType(a),d("ContextualConfigConstants").ERROR.BAD_CONTEXT_IDENTIFIER)},l=function(a){h(a);var b=a.name;a=a.type;j(b);k(a);return{name:b,type:a}};function a(a){i(a);return a.map(l)}g["default"]=a}),98); __d("ContextualConfigParseOutputParams",["ContextualConfigAssert","ContextualConfigConstants","ContextualConfigValidators"],(function(a,b,c,d,e,f,g){var h=function(a){return c("ContextualConfigAssert")(d("ContextualConfigValidators").isArray(a),d("ContextualConfigConstants").ERROR.MISSING_OUTPUTS_DEFINITION)},i=function(a){return c("ContextualConfigAssert")(d("ContextualConfigValidators").isType(a),d("ContextualConfigConstants").ERROR.BAD_OUTPUT_TYPE)},j=function(a){return c("ContextualConfigAssert")(d("ContextualConfigValidators").isNonEmptyString(a),d("ContextualConfigConstants").ERROR.BAD_OUTPUT_NAME)},k=function(a){return c("ContextualConfigAssert")(l(a),d("ContextualConfigConstants").ERROR.DUPLICATE_OUTPUT_NAME)},l=function(a){var b={};for(var a=a,c=Array.isArray(a),d=0,a=c?a:a[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var e;if(c){if(d>=a.length)break;e=a[d++]}else{d=a.next();if(d.done)break;e=d.value}e=e;if(b[e.name])return!1;b[e.name]=!0}return!0},m=function(a){j(a.name);i(a.type);return a};function a(a){h(a);a=a.map(m);k(a);return a}g["default"]=a}),98); __d("ContextualConfigParseVector",["ContextualConfigAssert","ContextualConfigConstants","ContextualConfigParseResultParamValue","ContextualConfigValidators"],(function(a,b,c,d,e,f,g){"use strict";var h=function(a){return c("ContextualConfigAssert")(d("ContextualConfigValidators").isArray(a),d("ContextualConfigConstants").ERROR.MISSING_VECTOR)},i=function(a,b){return c("ContextualConfigAssert")(a===b,d("ContextualConfigConstants").ERROR.RESULTS_VECTOR_SIZE_MISMATCH)},j=function(a,b){i(a.length,b.length);for(var d=0;d=0;d-=1)b.push(c),c*=a[d].buckets.length;return b.reverse()},j=function(a,b,d,e){try{b=b.slice(d,d+a.length);return[null,c("ContextualConfigParseDenseResultParams")(a,b)]}catch(a){return[a,e]}},k=function(a,b,d){try{d=d.reduce(function(b,d,e){c("ContextualConfigAssert")(e=b.length)break;f=b[e++]}else{e=b.next();if(e.done)break;f=e.value}f=f;c[f.name]=f}f=[];for(e=a,d=Array.isArray(e),b=0,e=d?e:e[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){if(d){if(b>=e.length)break;a=e[b++]}else{b=e.next();if(b.done)break;a=b.value}a=a;var g=c[a.name];f.push(g!=null&&g.name===a.name&&g.type===a.type?g:a)}return f}f["default"]=a}),66); __d("ContextualConfigParseDefaults",["ContextualConfigAssert","ContextualConfigConstants","ContextualConfigIsEqualParams","ContextualConfigParseResultParams"],(function(a,b,c,d,e,f,g){"use strict";var h=function(a,b){return c("ContextualConfigAssert")(c("ContextualConfigIsEqualParams")(a,b),d("ContextualConfigConstants").ERROR.MISSING_DEFAULT_VALUE)};function a(a,b){b=c("ContextualConfigParseResultParams")(a,b);h(a,b);return b}g["default"]=a}),98); __d("ContextualConfigParseTable",["ContextualConfigAssert","ContextualConfigConstants","ContextualConfigParseResultParams","ContextualConfigValidators"],(function(a,b,c,d,e,f,g){"use strict";var h=function(a){return c("ContextualConfigAssert")(d("ContextualConfigValidators").isArray(a),d("ContextualConfigConstants").ERROR.MISSING_TABLE)},i=function(a){return c("ContextualConfigAssert")(d("ContextualConfigValidators").isDefined(a),d("ContextualConfigConstants").ERROR.MISSING_TABLE)},j=function(a){return c("ContextualConfigAssert")(d("ContextualConfigValidators").isNonEmptyString(a),d("ContextualConfigConstants").ERROR.MISSING_TABLE_ITEM_BUCKET)},k=function(a){return c("ContextualConfigAssert")(d("ContextualConfigValidators").isArray(a),d("ContextualConfigConstants").ERROR.MISSING_TABLE_ITEM_VALUES)},l=function(a,b){i(b);var d=b.bucket;b=b.values;j(d);k(b);return{bucket:d,values:c("ContextualConfigParseResultParams")(a,b)}};function a(a,b){h(b);return b.reduce(function(b,c){c=l(a,c);b[c.bucket]=c.values;return b},{})}g["default"]=a}),98); __d("TableContextualConfig",["ContextualConfigAssert","ContextualConfigConstants","ContextualConfigMergePartialResultParams","ContextualConfigParseContexts","ContextualConfigParseDefaults","ContextualConfigParseMonitors","ContextualConfigParseOutputParams","ContextualConfigParseTable","ContextualConfigResolveContexts","ContextualConfigResolvedContextsUtils","ContextualConfigValidators"],(function(a,b,c,d,e,f,g){"use strict";var h=[],i=function(a){return c("ContextualConfigAssert")(d("ContextualConfigValidators").isDefined(a),d("ContextualConfigConstants").ERROR.BAD_CONFIG)};a=function(){function a(a,b){i(a);this.globalContextProviders=babelHelpers["extends"]({},b);b=c("ContextualConfigParseOutputParams")(a.outputs);this.contexts=c("ContextualConfigParseContexts")(a.contexts);this.defaults=c("ContextualConfigParseDefaults")(b,a.defaults);this.monitors=a.monitors!=null?c("ContextualConfigParseMonitors")(a.monitors):[];this.table=c("ContextualConfigParseTable")(b,a.table)}var b=a.prototype;b.resolve=function(a){try{return this.unsafeResolve(a)}catch(a){return[a,this.defaults,d("ContextualConfigConstants").EMPTY_RESOLVED_CONTEXTS,d("ContextualConfigConstants").EMPTY_RESOLVED_MONITORS]}};b.unsafeResolve=function(a){var b=this.globalContextProviders,e=this.contexts,f=this.defaults,g=this.monitors,i=this.table;e=c("ContextualConfigResolveContexts")(e,b,a);var j=e[0];e=e[1];if(j!=null)return[j,f,e,[]];j=d("ContextualConfigResolvedContextsUtils").getBucketNames(e).join(d("ContextualConfigConstants").BUCKET_DELIMITER);i=i[j]||h;j=c("ContextualConfigMergePartialResultParams")(f,i);f=c("ContextualConfigResolveContexts")(g,b,a);i=f[0];g=f[1];return i!=null?[i,j,e,[]]:[null,j,e,g]};return a}();g["default"]=a}),98); __d("ContextualConfigParseConfig",["ContextualConfigAssert","ContextualConfigConstants","ContextualConfigValidators","DenseContextualConfig","MultiOutputResolvedContextualConfig","TableContextualConfig"],(function(a,b,c,d,e,f,g){"use strict";var h=[1],i=function(a){return c("ContextualConfigAssert")(d("ContextualConfigValidators").isDefined(a)&&d("ContextualConfigValidators").isDefined(a.version),d("ContextualConfigConstants").ERROR.BAD_CONFIG)},j=function(a){return c("ContextualConfigAssert")(h.indexOf(a)!==-1,d("ContextualConfigConstants").ERROR.UNSUPPORTED_CONFIG_VERSION)};function a(a,b){i(a);j(a.version);switch(a.cctype){case d("ContextualConfigConstants").CONFIG_TYPE.DENSE:return new(c("DenseContextualConfig"))(a,b);case d("ContextualConfigConstants").CONFIG_TYPE.MULTI_OUTPUT_RESOLVED:return new(c("MultiOutputResolvedContextualConfig"))(a,b);case d("ContextualConfigConstants").CONFIG_TYPE.TABLE:return new(c("TableContextualConfig"))(a,b);default:throw new Error(d("ContextualConfigConstants").ERROR.UNKNOWN_CONFIG_TYPE)}}g["default"]=a}),98); __d("ContextualConfigWarn",[],(function(a,b,c,d,e,f){"use strict";function a(a){}f["default"]=a}),66); __d("ContextualConfigResult",["ContextualConfigConstants","ContextualConfigWarn"],(function(a,b,c,d,e,f,g){"use strict";a=function(){function a(a){this.$1=a.reduce(function(a,b){var c=b.name;b=b.value;a[c]=b;return a},{}),this.$2=a}var b=a.prototype;b.get=function(a,b){try{a=this.$1[a];if(typeof a!==typeof b){c("ContextualConfigWarn")(d("ContextualConfigConstants").ERROR.REQUESTED_PARAM_NOT_FOUND);return b}return a}catch(a){c("ContextualConfigWarn")(a.message);return b}};b.getParams=function(){return this.$2};return a}();g["default"]=a}),98); __d("ErrorContextualConfig",["ContextualConfigConstants"],(function(a,b,c,d,e,f,g){"use strict";a=function(){function a(a){this.error=a}var b=a.prototype;b.resolve=function(a){return[this.error,d("ContextualConfigConstants").EMPTY_RESULT_PARAMS,d("ContextualConfigConstants").EMPTY_RESOLVED_CONTEXTS,d("ContextualConfigConstants").EMPTY_RESOLVED_MONITORS]};return a}();g["default"]=a}),98); __d("ContextualConfig",["ContextualConfigCollateExposureData","ContextualConfigConstants","ContextualConfigExposureLogger","ContextualConfigParseConfig","ContextualConfigResult","ErrorContextualConfig","Random"],(function(a,b,c,d,e,f,g){"use strict";var h=1/d("ContextualConfigConstants").JSON_SUB_SAMPLE_RATE,i=1;a=function(){function a(a,b){b===void 0&&(b={}),this.isDebugLoggingEnabled=!1,this.$3=!1,this.$4=a,this.$2=b}var b=a.prototype;b.$5=function(){if(this.$1)return this.$1;var a=this.$2,b=this.$4;try{b=c("ContextualConfigParseConfig")(b,a)}catch(a){b=new(c("ErrorContextualConfig"))(a)}this.$1=b;return b};b.$6=function(a){var b=this.isDebugLoggingEnabled,e=this.$4,f=this.$3;f=!f&&d("Random").random()=r){this.$2.bumpCounter(j+"409_reset");this.$27(new Error("Too many 409 errors"));return}}this.$24(a,b,c,this.$28(d));return}this.$2.bumpCounter(j+"publish_request_success");b=a.map(function(a){return a.topic}).join(",");this.$2.debugTrace("FetchClient","Fetch publish request success. Publishes:"+b+", retry:"+c);this.$22(a);this.$18=!1;this.$21()};e.$21=function(){if(this.$14!=="ReceivingData")return;if(this.$18)return;if(this.$15.length===0&&this.$16.length===0)return;this.$18=!0;var a=this.$15.slice(0,q);this.$15=this.$15.slice(q,this.$15.length);this.$17!=null&&d("MqttEnv").Env.clearTimeout(this.$17);this.$17=null;var b=this.$16.slice(0,q);this.$16=this.$16.slice(q,this.$16.length);this.$25(a,b,0)};e.$25=function(a,b,e){var f=this,g=a.map(function(a){return a.topic}).join(",");this.$2.debugTrace("FetchClient","Fetch publish request sent. Publishes:"+g+", retry:"+e);g=c("MqttUtils").endpointWithExtraParameter(this.$1,l,n);var h=a.map(function(a){return{topic:a.topic,payload:a.payload,qos:0,messageId:d("MqttEnv").Env.random()}});h=this.$5.gen(this.$3,[],h,b);this.$2.bumpCounter(j+"publish_request");c("MqttUtils").promiseDoneWithTimeout(t.fetch(g,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",referrer:"no-referrer",body:h,keepalive:!1}),function(c){return f.$26(a,b,e,c)},function(c){return f.$24(a,b,e,c)},k)};e.$29=function(a){a=a.message;this.$2.debugTrace("FetchClient","Fetch request failed with error:"+a);this.$9(a);this.$30(!1,a);this.$2.bumpCounter(j+"error");this.$14="Error"};e.$31=function(a){var b=this;this.$2.debugTrace("FetchClient","Fetch response data received");a=d("MqttProtocolCodec").decodeByteMessages(new Uint8Array(a));a=a.messages;var c=a.filter(function(a){return a.messageType===d("MqttProtocolCodec").MESSAGE_TYPE.PINGREQ});a=a.filter(function(a){return a.messageType===d("MqttProtocolCodec").MESSAGE_TYPE.PUBLISH}).map(function(a){if(!(a instanceof d("MqttProtocolCodec").WireMessage.Publish))return{};a=a;a.qos===1&&a.messageIdentifier!=null&&(b.$16.push(a.messageIdentifier),b.$17==null&&(b.$17=d("MqttEnv").Env.setTimeout(function(){b.$21()},s)));return{topic:a.topic,payload:a.payloadMessage,qos:a.qos}});for(var e=a,f=Array.isArray(e),g=0,e=f?e:e[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var h;if(f){if(g>=e.length)break;h=e[g++]}else{g=e.next();if(g.done)break;h=g.value}h=h;this.$2.bumpCounter(j+"response_"+((h=h.topic)!=null?h:"void"))}a&&a.length>0&&(this.$13+=a.length,this.$7(a));c&&c.length>0&&this.$32()};e.$32=function(){this.$2.debugTrace("FetchClient","Got server ping request"),this.$2.bumpCounter(j+"ping")};e.$27=function(a){this.$2.debugTrace("FetchClient","Fetch request ended: "+a.toString()),this.$2.bumpCounter(j+"done"),this.$33(a.message),this.$8(),this.$14="Done"};e.$34=function(a,b,d){var e=this;if(d!=null)try{this.$31(d)}catch(a){this.$27(a);this.$2.bumpCounter(j+"dataDecodeException");return}if(b){this.$27(new Error("EOF"));return}c("MqttUtils").promiseDone(a.read(),function(c){var b=c.done;c=c.value;return e.$34(a,b,c)},function(a){return e.$27(a)})};e.$35=function(a){if(!a.ok){this.$2.bumpCounter(j+"error.http."+a.status);this.$29(this.$28(a));return}a=a.body;if(!a){this.$29(new Error("Empty body"));return}a=a.getReader();this.$6();this.$2.bumpCounter(j+"success");this.$30(!0,null);this.$11=Date.now();this.$14="ReceivingData";this.$2.debugTrace("FetchClient","Fetch request success");this.$34(a,!1,null)};e.$33=function(a){this.$2.eventLogPullFinish({pullEventName:i,sessionID:this.$3,duration:Date.now()-this.$11,errorMessage:a,publishReceived:this.$13,publishSent:this.$12})};e.$30=function(a,b){this.$2.eventLogPull({pullEventName:h,sessionID:this.$3,status:a,duration:Date.now()-this.$10,hostname:this.$1,errorMessage:b})};e.$20=function(){var a=this;if(this.$14!=="Ready")return;this.$2.debugTrace("FetchClient","Sending fetch request");this.$2.bumpCounter(j+"request");this.$10=Date.now();var b=c("MqttUtils").endpointWithExtraParameter(this.$1,m,o);c("MqttUtils").promiseDoneWithTimeout(t.fetch(b,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",referrer:"no-referrer",body:this.$4,keepalive:!1}),function(b){return a.$35(b)},function(b){return a.$29(b)},k)};e.$28=function(a){return new Error("Http error, status="+a.status)};return a}();g["default"]=a}),98); __d("MqttLongPollingClient",["MqttEnv","MqttProtocolCodec","MqttUserName","Promise","XHRRequest","getCrossOriginTransport"],(function(a,b,c,d,e,f,g){"use strict";var h=120*1e3,i="simple_pull",j="longpolling_";a=function(){function a(){this.$3="",this.$4=0,this.$2=d("MqttEnv").Env.getLoggerInstance(),this.$1="Ready",this.$5="",this.$6=new(c("MqttUserName"))("",0,1,"",0,!0),this.$7=function(){},this.$8=function(a){},this.$9=function(){},this.$10=function(a){},this.$11=0,this.$12=null,this.$13=new Set(["/t_ms","/messenger_sync_get_diffs","/messenger_sync_create_queue","/webrtc","/rtc_multi"])}var e=a.prototype;e.run=function(a,b,c,d,e,f,g,h){this.$3=a,this.$4=b,this.$5=c,this.$6=d,this.$7=e,this.$8=f,this.$9=g,this.$10=h,this.$14(this.$5)};e.isTopicSupported=function(a){return this.$13.has(a)};e.publish=function(a,c){return b("Promise").reject("not supported")};e.abort=function(){this.$12!=null&&this.$12.abort("Disconnected")};e.$15=function(a,b){if(this.$1===a)return;this.$1=a;a==="Error"&&b!=null&&this.$10(b);this.$2.debugTrace("LongPollingClient","_changeStatus : "+a)};e.$16=function(a){if(this.$1!=="RequestSend")return;if(!a){this.$17("EmptyResponse",null);return}this.$7();this.$2.bumpCounter(j+"success");this.$18(!0,null);this.$15("ResponseReceived");a=d("MqttProtocolCodec").decodeByteMessages(new Uint8Array(a));a=a.messages.filter(function(a){return a instanceof d("MqttProtocolCodec").WireMessage.Publish}).map(function(a){if(a instanceof d("MqttProtocolCodec").WireMessage.Publish){a=a;return{topic:a.topic,payload:a.payloadMessage,qos:a.qos}}else return{}});this.$8(a);this.$9()};e.$17=function(a,b){b=b!=null?b.message:"null";this.$2.debugTrace("LongPollingClient Error","Poll failed with error:"+a+", errorMsg:"+b);this.$18(!1,a+":"+b);this.$2.bumpCounter(j+"error."+a);this.$15("Error",a)};e.$18=function(a,b){this.$2.eventLogPull({pullEventName:i,sessionID:this.$4,status:a,duration:Date.now()-this.$11,hostname:this.$3,errorMessage:b})};e.$14=function(a){var b=this;if(this.$1!=="Ready"||this.$12)return;this.$2.bumpCounter(j+"request");try{this.$11=Date.now(),this.$12=new(c("XHRRequest"))(this.$3).setResponseType("arraybuffer").setRawData(a).setTransportBuilder(c("getCrossOriginTransport").withCredentials).setResponseHandler(function(a){return b.$16(a)}).setNetworkFailureHandler(function(a){b.$17("Network",a)}).setErrorHandler(function(a){b.$17("Error",a)}).setAbortHandler(function(a){b.$17("Abort",null)}).setTimeoutHandler(function(){b.$17("Timeout",null)}).setTimeout(h).send(),this.$15("RequestSend")}catch(a){this.$17("Error",a)}};return a}();g["default"]=a}),98); __d("exponentialBackoff",["MqttEnv"],(function(a,b,c,d,e,f,g){function a(a,b){b===void 0&&(b=null);var c=null,e=0;function f(){for(var f=arguments.length,g=new Array(f),h=0;h=h&&this.$24("LPError")};e.$28=function(){var a=d("MqttEnv").Env.genGk(d("MqttEnv").MqttGkNames.mqtt_lp_no_delay),b=d("MqttEnv").Env.genGk(d("MqttEnv").MqttGkNames.mqtt_ws_polling_enabled),c=d("MqttEnv").Env.genGk(d("MqttEnv").MqttGkNames.mqtt_fast_lp);this.$5.debugTrace("LongPollingRunner","_shouldPoll? pollNow:"+String(a)+" enabled:"+String(b)+" fastPoll:"+String(c)+" hasWSSupport:"+String(this.$4)+" hasWsSuccessBefore:"+String(this.$1)+" failureCount:"+this.$2+" wsFatal:"+String(this.$3));if(!b)return!1;if(a){this.$5.bumpCounter(k+".nd");return!0}if(!this.$4){this.$5.bumpCounter(k+".na");return!0}if(this.$3){this.$5.bumpCounter(k+".fatal");return!0}if(this.$1)return!1;if(c){b=Date.now()-this.$20;if(this.$21===m){if(this.$2>=1)return!0;if(b>i){this.$5.bumpCounter(k+".fastdelay");return!0}}else if(b>j){this.$5.bumpCounter(k+".regulardelay");return!0}}if(this.$2>=3){this.$5.bumpCounter(k+".failure");return!0}return!1};e.$29=function(){if(this.$14!=null)return!1;var a=this.$28();!this.$13&&a&&(this.$5.bumpCounter("polling_kickin"),this.$13=!0,this.$24("LPActive"),this.$26());this.$13&&!a&&(this.$5.bumpCounter("polling_stopped"),this.$13=!1,this.$24("LPInactive"),this.$26());return a};e.$30=function(){if(this.$22){this.$5.debugTrace("LongPollingRunner","Creating polling client using Fetch API");return new(c("MqttFetchClient"))()}else{this.$5.debugTrace("LongPollingRunner","Creating regular Polling client");return new(c("MqttLongPollingClient"))()}};e.$31=function(){this.$5.debugTrace("LongPollingRunner","Poll success"),this.$19.onPollRequestSuccess(),this.$18.reset(),this.$24("LPActive"),this.$26(),d("MqttEnv").Env.configWrite(l,m),this.$25("ReceivingData")};e.$32=function(a){var b=a.map(function(a){return a.topic}).join(",");this.$5.debugTrace("LongPollingRunner","Poll response received, message received:"+b);for(b=0;b