1(self["webpackChunkpfp_create_site"]=self["webpackChunkpfp_create_site"]||[]).push([[717],{7717:function(e,t,s){"use strict";s.r(t),s.d(t,{AlchemyWebSocketProvider:function(){return x},getAlchemyEventTag:function(){return X}});var n=s(3188),i=s(6731),r=s(475),o=s(4178),c=s(6881),l=s(8783),a=s(1581),h=s(4216);let u=null;try{if(u=WebSocket,null==u)throw new Error("inject please")}catch(se){const e=new a.Yd(h.i);u=function(){e.throwError("WebSockets not supported in this environment",a.Yd.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var d=function(e,t,s,n){function i(e){return e instanceof s?e:new s((function(t){t(e)}))}return new(s||(s=Promise))((function(s,r){function o(e){try{l(n.next(e))}catch(t){r(t)}}function c(e){try{l(n["throw"](e))}catch(t){r(t)}}function l(e){e.done?s(e.value):i(e.value).then(o,c)}l((n=n.apply(e,t||[])).next())}))};const f=new a.Yd(h.i);let p=1;class b extends l.r{constructor(e,t){"any"===t&&f.throwError("WebSocketProvider does not support 'any' network yet",a.Yd.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),super("string"===typeof e?e:"_websocket",t),this._pollingInterval=-1,this._wsReady=!1,"string"===typeof e?(0,c.zG)(this,"_websocket",new u(this.connection.url)):(0,c.zG)(this,"_websocket",e),(0,c.zG)(this,"_requests",{}),(0,c.zG)(this,"_subs",{}),(0,c.zG)(this,"_subIds",{}),(0,c.zG)(this,"_detectNetwork",super.detectNetwork()),this.websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach((e=>{this.websocket.send(this._requests[e].payload)}))},this.websocket.onmessage=e=>{const t=e.data,s=JSON.parse(t);if(null!=s.id){const e=String(s.id),n=this._requests[e];
1if(delete this._requests[e],void 0!==s.result)n.callback(null,s.result),this.emit("debug",{action:"response",request:JSON.parse(n.payload),response:s.result,provider:this});else{let e=null;s.error?(e=new Error(s.error.message||"unknown error"),(0,c.zG)(e,"code",s.error.code||null),(0,c.zG)(e,"response",t)):e=new Error("unknown error"),n.callback(e,void 0),this.emit("debug",{action:"response",error:e,request:JSON.parse(n.payload),provider:this})}}else if("eth_subscription"===s.method){const e=this._subs[s.params.subscription];e&&e.processFunc(s.params.result)}else console.warn("this should not happen")};const s=setInterval((()=>{this.emit("poll")}),1e3);s.unref&&s.unref()}get websocket(){return this._websocket}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(e){f.throwError("cannot reset events block on WebSocketProvider",a.Yd.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){f.throwError("cannot set polling interval on WebSocketProvider",a.Yd.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return d(this,void 0,void 0,(function*(){return null}))}set polling(e){e&&f.throwError("cannot set polling on WebSocketProvider",a.Yd.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,t){const s=p++;return new Promise(((n,i)=>{function r(e,t){return e?i(e):n(t)}const o=JSON.stringify({method:e,params:t,id:s,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(o),provider:this}),this._requests[String(s)]={callback:r,payload:o},this._wsReady&&this.websocket.send(o)}))}static defaultUrl(){return"ws://localhost:8546"}_subscribe(e,t,s){return d(this,void 0,void 0,(function*(){let n=this._subIds[e];null==n&&(n=Promise.all(t).then((e=>this.send("eth_subscribe",e))),this._subIds[e]=n);const i=yield n;this._subs[i]={tag:e,processFunc:s}}))}_startEvent(e){switch(e.type){case"block":this._subscribe("block",["newHeads"],(e=>{const t=i.O$.from(e.number).toNumber();this._emitted.block=t,this.emit("block",t)}));break;case"pending":this._subscribe("pending",["newPendingTransactions"],(e=>{this.emit("pending",e)}));break;case"filter":this._subscribe(e.tag,["logs",this._getFilter(e.filter)],(t=>{null==t.removed&&(t.removed=!1),this.emit(e.filter,this.formatter.filterLog(t))}));break;case"tx":{const t=e=>{const t=e.hash;this.getTransactionReceipt(t).then((e=>{e&&this.emit(t,e)}))};t(e),this._subscribe("tx",["newHeads"],(e=>{this._events.filter((e=>"tx"===e.type)).forEach(t)}));break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",e);break}}_stopEvent(e){let t=e.tag;if("tx"===e.type){if(this._events.filter((e=>"tx"===e.type)).length)return;t="tx"}else if(this.listenerCount(e.event))return;const s=this._subIds[t];s&&(delete this._subIds[t],s.then((e=>{this._subs[e]&&(delete this._subs[e],this.send("eth_unsubscribe",[e]))})))}destroy(){return d(this,void 0,void 0,(function*(){this.websocket.readyState===u.CONNECTING&&(yield new Promise((e=>{this.websocket.onopen=function(){e(!0)},this.websocket.onerror=function(){e(!1)}}))),this.websocket.close(1e3)}))}}var m=s(5710);s(4359);const g=120;class v{constructor(e){this.provider=e,this.maxBackfillBlocks=g}getNewHeadsBackfill(e,t,s){return(0,n._)(this,void 0,void 0,(function*(){I(e);const i=yield this.getBlockNumber();if(I(e),0===t.length)return this.getHeadEventsInRange(Math.max(s,i-this.maxBackfillBlocks)+1,i+1);const r=(0,n.f)(t[t.length-1].number),o=i-this.maxBackfillBlocks+1;if(r<=o)return this.getHeadEventsInRange(o,i+1);const c=yield this.getReorgHeads(e,t);I(e);const l=yield this.getHeadEventsInRange(r+1,i+1);return I(e),[...c,...l]}))}getLogsBackfill(e,t,s,i){return(0,n._)(this,void 0,void 0,(function*(){I(e);const r=yield this.getBlockNumber();if(I(e),0===s.length)return this.getLogsInRange(t,Math.max(i,r-this.maxBackfillBlocks)+1,r+1);const o=(0,n.f)(s[s.length-1].blockNumber),c=r-this.maxBackfillBlocks+1;if(o<c)return this.getLogsInRange(t,c,r+1);const l=yield this.getCommonAncestor(e,s);I(e);const a=s.filter((e=>(0,n.f)(e.blockNumber)>l.blockNumber)).map((e=>Object.assign(Object.assign({},e),{removed:!0}))),h=l.blockNumber===Number.NEGATIVE_INFINITY?(0,n.f)(s[0].blockNumber):l.blockNumber;let u=yield this.getLogsInRange(t,h,r+1);return u=u.filter((e=>e&&((0,n.f)(e.blockNumber)>l.blockNumber||(0,n.f)(e.logIndex)>l.logIndex))),I(e),[...a,...u]}))}setMaxBackfillBlock(e){this.maxBackfillBlocks=e}getBlockNumber(){return(0,n._)(this,void 0,void 0,(function*(){const e=yield this.provider.send("eth_blockNumber");return(0,n.f)(e)}))}getHeadEventsInRange(e,t){return(0,n._)(this,void 0,void 0,(function*(){if(e>=t)return[];const s=[];for(let o=e;o<t;o++)s.push({method:"eth_getBlockByNumber",params:[(0,n.t)(o),!1]});const i=yield this.provider.sendBatch(s),r=i.reduce(((e,t)=>e.concat(t)),[]);return r.map(y)}))}getReorgHeads(e,t){return(0,n._)(this,void 0,void 0,(function*(){const s=[];for(let i=t.length-1;i>=0;i--){const r=t[i],o=yield this.getBlockByNumber((0,n.f)(r.number));if(I(e),r.hash===o.hash)break;s.push(y(o))}return s.reverse()}))}getBlockByNumber(e){return(0,n._)(this,void 0,void 0,(function*(){return this.provider.send("eth_getBlockByNumber",[(0,n.t)(e),!1])}
1))}getCommonAncestor(e,t){return(0,n._)(this,void 0,void 0,(function*(){let s=yield this.getBlockByNumber((0,n.f)(t[t.length-1].blockNumber));I(e);for(let e=t.length-1;e>=0;e--){const i=t[e];if(i.blockNumber!==s.number&&(s=yield this.getBlockByNumber((0,n.f)(i.blockNumber))),i.blockHash===s.hash)return{blockNumber:(0,n.f)(i.blockNumber),logIndex:(0,n.f)(i.logIndex)}}return{blockNumber:Number.NEGATIVE_INFINITY,logIndex:Number.NEGATIVE_INFINITY}}))}getLogsInRange(e,t,s){return(0,n._)(this,void 0,void 0,(function*(){if(t>=s)return[];const i=Object.assign(Object.assign({},e),{fromBlock:(0,n.t)(t),toBlock:(0,n.t)(s-1)});return this.provider.send("eth_getLogs",[i])}))}}function y(e){const t=Object.assign({},e);return delete t.totalDifficulty,delete t.transactions,delete t.uncles,t}function k(e){return _(e,(e=>e.hash))}function w(e){return _(e,(e=>`${e.blockHash}/${e.logIndex}`))}function _(e,t){const s=new Set,n=[];return e.forEach((e=>{const i=t(e);s.has(i)||(s.add(i),n.push(e))})),n}const E=new Error("Cancelled");function I(e){if(e())throw E}const N="alchemy-pending-transactions";class T{constructor(e,t,s){this.listener=t,this.tag=e,this.once=s,this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter;default:return this.tag}}get type(){return this.tag.split(":")[0]}get hash(){const e=this.tag.split(":");if("tx"!==e[0])throw new Error("Not a transaction event");return e[1]}get filter(){const e=this.tag.split(":");if("filter"!==e[0])throw new Error("Not a transaction event");const t=e[1],s=B(e[2]),n={};return s.length>0&&(n.topics=s),t&&"*"!==t&&(n.address=t),n}pollable(){const e=["block","network","pending","poll"];return this.tag.indexOf(":")>=0||e.indexOf(this.tag)>=0}}class O extends T{get fromAddress(){const e=this.tag.split(":");if(e[0]===N)return e[1]&&"*"!==e[1]?C(e[1]):void 0}get toAddress(){const e=this.tag.split(":");if(e[0]===N)return e[2]&&"*"!==e[2]?C(e[2]):void 0}get hashesOnly(){const e=this.tag.split(":");if(e[0]===N)return e[3]&&"*"!==e[3]?"true"===e[3]:void 0}}function B(e){return""===e?[]:e.split(/&/g).map((e=>{if(""===e)return[];const t=e.split("|").map((e=>"null"===e?null:e));return 1===t.length?t[0]:t}))}function C(e){if(""===e)return;const t=e.split("|");return 1===t.length?t[0]:t}const S=3e4,P=1e4,A=6e4,R=5,L=10;class x extends b{constructor(e,t){var s;const i=r.AlchemyProvider.getApiKey(e.apiKey),c=r.AlchemyProvider.getAlchemyNetwork(e.network),l=r.AlchemyProvider.getAlchemyConnectionInfo(c,i,"wss"),a=`alchemy-sdk-${n.V}`,h=new o.Z(null!==(s=e.url)&&void 0!==s?s:l.url,a,{wsConstructor:null!==t&&void 0!==t?t:j()}),u=n.E[c];super(h,u),this._events=[],this.virtualSubscriptionsById=new Map,this.virtualIdsByPhysicalId=new Map,this.handleMessage=e=>{const t=JSON.parse(e.data);if(!J(t))return;const s=t.params.subscription,n=this.virtualIdsByPhysicalId.get(s);if(!n)return;const i=this.virtualSubscriptionsById.get(n);if("eth_subscribe"===i.method)switch(i.params[0]){case"newHeads":{const e=i,r=t,{isBackfilling:o,backfillBuffer:c}=e,{result:l}=r.params;o?$(c,l):s!==n?this.emitAndRememberEvent(n,l,Y):this.rememberEvent(n,l,Y);break}case"logs":{const e=i,r=t,{isBackfilling:o,backfillBuffer:c}=e,{result:l}=r.params;o?V(c,l):n!==s?this.emitAndRememberEvent(n,l,z):this.rememberEvent(n,l,z);break}}},this.handleReopen=()=>{this.virtualIdsByPhysicalId.clear();const{cancel:e,isCancelled:t}=H();this.cancelBackfill=e;for(const s of this.virtualSubscriptionsById.values())(()=>{(0,n._)(this,void 0,void 0,(function*(){try{yield this.resubscribeAndBackfill(t,s)}catch(se){t()||console.error(`Error while backfilling "${s.params[0]}" subscription. Some events may be missing.`,se)}}))})();this.startHeartbeat()},this.stopHeartbeatAndBackfill=()=>{null!=this.heartbeatIntervalId&&(clearInterval(this.heartbeatIntervalId),this.heartbeatIntervalId=void 0),this.cancelBackfill()},this.apiKey=i,this.backfiller=new v(this),this.addSocketListeners(),this.startHeartbeat(),this.cancelBackfill=n.n}static getNetwork(e){return"string"===typeof e&&e in n.C?n.C[e]:(0,m.H)(e)}on(e,t){return this._addEventListener(e,t,!1)}once(e,t){return this._addEventListener(e,t,!0)}off(e,t){return Q(e)?this._off(e,t):super.off(e,t)}removeAllListeners(e){return void 0!==e&&Q(e)?this._removeAllListeners(e):super.removeAllListeners(e)}listenerCount(e){return void 0!==e&&Q(e)?this._listenerCount(e):super.listenerCount(e)}listeners(e){return void 0!==e&&Q(e)?this._listeners(e):super.listeners(e)}_addEventListener(e,t,s){if(Q(e)){const n=new O(X(e),t,s);return this._events.push(n),this._startEvent(n),this}return super._addEventListener(e,t,s)}_startEvent(e){const t=[N,"block","filter"];t.includes(e.type)?this.customStartEvent(e):super._startEvent(e)}_subscribe(e,t,s,i){return(0,n._)(this,void 0,void 0,(function*(){let n=this._subIds[e];const r=yield this.getBlockNumber();
1null==n&&(n=Promise.all(t).then((e=>this.send("eth_subscribe",e))),this._subIds[e]=n);const o=yield n,c=yield Promise.all(t);this.virtualSubscriptionsById.set(o,{event:i,method:"eth_subscribe",params:c,startingBlockNumber:r,virtualId:o,physicalId:o,sentEvents:[],isBackfilling:!1,backfillBuffer:[]}),this.virtualIdsByPhysicalId.set(o,o),this._subs[o]={tag:e,processFunc:s}}))}emit(e,...t){if(Q(e)){let s=!1;const n=[],i=X(e);return this._events=this._events.filter((e=>e.tag!==i||(setTimeout((()=>{e.listener.apply(this,t)}),0),s=!0,!e.once||(n.push(e),!1)))),n.forEach((e=>{this._stopEvent(e)})),s}return super.emit(e,...t)}sendBatch(e){return(0,n._)(this,void 0,void 0,(function*(){let t=0;const s=e.map((({method:e,params:s})=>({method:e,params:s,jsonrpc:"2.0",id:"alchemy-sdk:"+t++}))),n=yield this.sendBatchConcurrently(s),i=n.find((e=>!!e.error));if(i)throw new Error(i.error.message);return n.sort(((e,t)=>e.id-t.id)).map((e=>e.result))}))}destroy(){return this.removeSocketListeners(),this.stopHeartbeatAndBackfill(),super.destroy()}isCommunityResource(){return this.apiKey===n.D}_stopEvent(e){let t=e.tag;if(e.type===N){if(this._events.filter((e=>e.type===N)).length)return}else if("tx"===e.type){if(this._events.filter((e=>"tx"===e.type)).length)return;t="tx"}else if(this.listenerCount(e.event))return;const s=this._subIds[t];s&&(delete this._subIds[t],s.then((e=>{this._subs[e]&&(delete this._subs[e],this.send("eth_unsubscribe",[e]))})))}addSocketListeners(){this._websocket.addEventListener("message",this.handleMessage),this._websocket.addEventListener("reopen",this.handleReopen),this._websocket.addEventListener("down",this.stopHeartbeatAndBackfill)}removeSocketListeners(){this._websocket.removeEventListener("message",this.handleMessage),this._websocket.removeEventListener("reopen",this.handleReopen),this._websocket.removeEventListener("down",this.stopHeartbeatAndBackfill)}resubscribeAndBackfill(e,t){return(0,n._)(this,void 0,void 0,(function*(){const{virtualId:s,method:n,params:i,sentEvents:r,backfillBuffer:o,startingBlockNumber:c}=t;t.isBackfilling=!0,o.length=0;try{const l=yield this.send(n,i);switch(I(e),t.physicalId=l,this.virtualIdsByPhysicalId.set(l,s),i[0]){case"newHeads":{const t=yield M((()=>q(this.backfiller.getNewHeadsBackfill(e,r,c),A)),R,(()=>!e()));I(e);const n=k([...t,...o]);n.forEach((e=>this.emitNewHeadsEvent(s,e)));break}case"logs":{const t=i[1]||{},n=yield M((()=>q(this.backfiller.getLogsBackfill(e,t,r,c),A)),R,(()=>!e()));I(e);const l=w([...n,...o]);l.forEach((e=>this.emitLogsEvent(s,e)));break}default:break}}finally{t.isBackfilling=!1,o.length=0}}))}emitNewHeadsEvent(e,t){this.emitAndRememberEvent(e,t,Y)}emitLogsEvent(e,t){this.emitAndRememberEvent(e,t,z)}emitAndRememberEvent(e,t,s){this.rememberEvent(e,t,s);const n=this.virtualSubscriptionsById.get(e);n&&this.emitGenericEvent(n,t)}rememberEvent(e,t,s){const n=this.virtualSubscriptionsById.get(e);n&&Z(n.sentEvents,Object.assign({},t),s)}emitGenericEvent(e,t){const s=this.emitProcessFn(e.event);s(t)}startHeartbeat(){null==this.heartbeatIntervalId&&(this.heartbeatIntervalId=setInterval((()=>(0,n._)(this,void 0,void 0,(function*(){try{yield q(this.send("net_version"),P)}catch(e){this._websocket.reconnect()}}))),S))}sendBatchConcurrently(e){return(0,n._)(this,void 0,void 0,(function*(){return Promise.all(e.map((e=>this.send(e.method,e.params))))}))}customStartEvent(e){if(e.type===N){const{fromAddress:t,toAddress:s,hashesOnly:n}=e;this._subscribe(e.tag,["alchemy_pendingTransactions",{fromAddress:t,toAddress:s,hashesOnly:n}],this.emitProcessFn(e),e)}else"block"===e.type?this._subscribe("block",["newHeads"],this.emitProcessFn(e),e):"filter"===e.type&&this._subscribe(e.tag,["logs",this._getFilter(e.filter)],this.emitProcessFn(e),e)}emitProcessFn(e){switch(e.type){case N:const{fromAddress:t,toAddress:s,hashesOnly:n}=e;return e=>this.emit({method:"alchemy_pendingTransactions",fromAddress:t,toAddress:s,hashesOnly:n},e);case"block":return e=>{const t=i.O$.from(e.number).toNumber();this._emitted.block=t,this.emit("block",t)};case"filter":return t=>
1{null==t.removed&&(t.removed=!1),this.emit(e.filter,this.formatter.filterLog(t))};default:throw new Error("Invalid event type to `emitProcessFn()`")}}_off(e,t){if(null==t)return this.removeAllListeners(e);const s=[];let n=!1;const i=X(e);return this._events=this._events.filter((e=>e.tag!==i||e.listener!=t||(!!n||(n=!0,s.push(e),!1)))),s.forEach((e=>{this._stopEvent(e)})),this}_removeAllListeners(e){let t=[];if(null==e)t=this._events,this._events=[];else{const s=X(e);this._events=this._events.filter((e=>e.tag!==s||(t.push(e),!1)))}return t.forEach((e=>{this._stopEvent(e)})),this}_listenerCount(e){if(!e)return this._events.length;const t=X(e);return this._events.filter((e=>e.tag===t)).length}_listeners(e){if(null==e)return this._events.map((e=>e.listener));const t=X(e);return this._events.filter((e=>e.tag===t)).map((e=>e.listener))}}function j(){return W()?s(5840).w3cwebsocket:WebSocket}function W(){return"undefined"!==typeof process&&null!=process&&null!=process.versions&&null!=process.versions.node}function H(){let e=!1;return{cancel:()=>e=!0,isCancelled:()=>e}}const F=1e3,G=2,D=3e4;function M(e,t,s=(()=>!0)){return(0,n._)(this,void 0,void 0,(function*(){let n=0,i=0;while(1)try{return yield e()}catch(se){if(i++,i>=t||!s(se))throw se;if(yield U(n),!s(se))throw se;n=0===n?F:Math.min(D,G*n)}}))}function U(e){return new Promise((t=>setTimeout(t,e)))}function q(e,t){return Promise.race([e,new Promise(((e,s)=>setTimeout((()=>s(new Error("Timeout"))),t)))])}function Y(e){return(0,n.f)(e.number)}function z(e){return(0,n.f)(e.blockNumber)}function K(e){return Array.isArray(e)||"2.0"===e.jsonrpc&&void 0!==e.id}function J(e){return!K(e)}function $(e,t){Z(e,t,Y)}function V(e,t){Z(e,t,z)}function Z(e,t,s){const n=s(t),i=e.findIndex((e=>s(e)>n-L));-1===i?e.length=0:e.splice(0,i),e.push(t)}function Q(e){return"object"===typeof e&&"method"in e}function X(e){if(!Q(e))throw new Error("Event tag requires AlchemyEventType");const t=ee(e.fromAddress),s=ee(e.toAddress),n=te(e.hashesOnly);return N+":"+t+":"+s+":"+n}function ee(e){return void 0===e?"*":Array.isArray(e)?e.join("|"):e}function te(e){return void 0===e?"*":e.toString()}},284:function(e){var t=function(){if("object"===typeof self&&self)return self;if("object"===typeof window&&window)return window;throw new Error("Unable to resolve global `this`")};e.exports=function(){if(this)return this;if("object"===typeof globalThis&&globalThis)return globalThis;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:!0})}catch(e){return t()}try{return __global__||t()}finally{delete Object.prototype.__global__}}()},4178:function(e,t){"use strict";var s="Provided shouldReconnect() returned false. Closing permanently.",n="Provided shouldReconnect() resolved to false. Closing permanently.",i=function(){function e(t,s,n){if(void 0===n&&(n={}),this.url=t,this.onclose=null,this.onerror=null,this.onmessage=null,this.onopen=null,this.ondown=null,this.onreopen=null,this.CONNECTING=e.CONNECTING,this.OPEN=e.OPEN,this.CLOSING=e.CLOSING,this.CLOSED=e.CLOSED,this.hasBeenOpened=!1,this.isClosed=!1,this.messageBuffer=[],this.nextRetryTime=0,this.reconnectCount=0,this.lastKnownExtensions="",this.lastKnownProtocol="",this.listeners={},null==s||"string"===typeof s||Array.isArray(s)?this.protocols=s:n=s,this.options=r(n),!this.options.wsConstructor){if("undefined"===typeof WebSocket)throw new Error("WebSocket not present in global scope and no wsConstructor option was provided.");this.options.wsConstructor=WebSocket}this.openNewWebSocket()}return Object.defineProperty(e.prototype,"binaryType",{get:function(){return this.binaryTypeInternal||"blob"},set:function(e){this.binaryTypeInternal=e,this.ws&&(this.ws.binaryType=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bufferedAmount",{get:function(){var e=this.ws?this.ws.bufferedAmount:0,t=!1;return this.messageBuffer.forEach((function(s){var n=o(s);null!=n?e+=n:t=!0})),t&&this.debugLog("Some buffered data had unknown length. bufferedAmount() return value may be below the correct amount."),e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"extensions",{get:function(){return this.ws?this.ws.extensions:this.lastKnownExtensions},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"protocol",{get:function(){return this.ws?this.ws.protocol:this.lastKnownProtocol},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"readyState",{get:function(){return this.isClosed?e.CLOSED:e.OPEN},enumerable:!0,configurable:!0}),e.prototype.close=function(e,t){this.disposeSocket(e,t),this.shutdown(),this.debugLog("WebSocket permanently closed by client.")},e.prototype.send=function(e){if(this.isClosed)throw new Error("WebSocket is already in CLOSING or CLOSED state.");this.ws&&this.ws.readyState===this.OPEN?this.ws.send(e):this.messageBuffer.push(e)},e.prototype.reconnect=function(){if(this.isClosed)throw new Error("Cannot call reconnect() on socket which is permanently closed.");this.disposeSocket(1e3,"Client requested reconnect."),this.handleClose(void 0)},e.prototype.addEventListener=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},e.prototype.dispatchEvent=function(e){return this.dispatchEventOfType(e.type,e)},e.prototype.removeEventListener=function(e,t){this.listeners[e]&&(this.listeners[e]=this.listeners[e].filter((function(e){return e!==t})))},e.prototype.openNewWebSocket=function(){var e=this;if(!this.isClosed){var t=this.options,s=t.connectTimeout,n=t.wsConstructor;this.debugLog("Opening new WebSocket to "+this.url+".");var i=new n(this.url,this.protocols);
1i.onclose=function(t){return e.handleClose(t)},i.onerror=function(t){return e.handleError(t)},i.onmessage=function(t){return e.handleMessage(t)},i.onopen=function(t){return e.handleOpen(t)},this.connectTimeoutId=setTimeout((function(){e.clearConnectTimeout(),e.disposeSocket(),e.handleClose(void 0)}),s),this.ws=i}},e.prototype.handleOpen=function(e){var t=this;if(this.ws&&!this.isClosed){var s=this.options.allClearResetTime;this.debugLog("WebSocket opened."),null!=this.binaryTypeInternal?this.ws.binaryType=this.binaryTypeInternal:this.binaryTypeInternal=this.ws.binaryType,this.clearConnectTimeout(),this.hasBeenOpened?this.dispatchEventOfType("reopen",e):(this.dispatchEventOfType("open",e),this.hasBeenOpened=!0),this.messageBuffer.forEach((function(e){return t.send(e)})),this.messageBuffer=[],this.allClearTimeoutId=setTimeout((function(){t.clearAllClearTimeout(),t.nextRetryTime=0,t.reconnectCount=0;var e=s/1e3|0;t.debugLog("WebSocket remained open for "+e+" seconds. Resetting retry time and count.")}),s)}},e.prototype.handleMessage=function(e){this.isClosed||this.dispatchEventOfType("message",e)},e.prototype.handleClose=function(e){var t=this;if(!this.isClosed){var i=this.options,r=i.maxReconnectAttempts,o=i.shouldReconnect;if(this.clearConnectTimeout(),this.clearAllClearTimeout(),this.ws&&(this.lastKnownExtensions=this.ws.extensions,this.lastKnownProtocol=this.ws.protocol,this.disposeSocket()),this.dispatchEventOfType("down",e),this.reconnectCount>=r)this.stopReconnecting(e,this.getTooManyFailedReconnectsMessage());else{var c=!e||o(e);"boolean"===typeof c?this.handleWillReconnect(c,e,s):c.then((function(s){t.isClosed||t.handleWillReconnect(s,e,n)}))}}},e.prototype.handleError=function(e){this.dispatchEventOfType("error",e),this.debugLog("WebSocket encountered an error.")},e.prototype.handleWillReconnect=function(e,t,s){e?this.reestablishConnection():this.stopReconnecting(t,s)},e.prototype.reestablishConnection=function(){var e=this,t=this.options,s=t.minReconnectDelay,n=t.maxReconnectDelay,i=t.reconnectBackoffFactor;this.reconnectCount++;var r=this.nextRetryTime;this.nextRetryTime=Math.max(s,Math.min(this.nextRetryTime*i,n)),setTimeout((function(){return e.openNewWebSocket()}),r);var o=r/1e3|0;this.debugLog("WebSocket was closed. Re-opening in "+o+" seconds.")},e.prototype.stopReconnecting=function(e,t){this.debugLog(t),this.shutdown(),e&&this.dispatchEventOfType("close",e)},e.prototype.shutdown=function(){this.isClosed=!0,this.clearAllTimeouts(),this.messageBuffer=[],this.disposeSocket()},e.prototype.disposeSocket=function(e,t){this.ws&&(this.ws.onerror=l,this.ws.onclose=l,this.ws.onmessage=l,this.ws.onopen=l,this.ws.close(e,t),this.ws=void 0)},e.prototype.clearAllTimeouts=function(){this.clearConnectTimeout(),this.clearAllClearTimeout()},e.prototype.clearConnectTimeout=function(){null!=this.connectTimeoutId&&(clearTimeout(this.connectTimeoutId),this.connectTimeoutId=void 0)},e.prototype.clearAllClearTimeout=function(){null!=this.allClearTimeoutId&&(clearTimeout(this.allClearTimeoutId),this.allClearTimeoutId=void 0)},e.prototype.dispatchEventOfType=function(e,t){var s=this;switch(e){case"close":this.onclose&&this.onclose(t);break;case"error":this.onerror&&this.onerror(t);break;case"message":this.onmessage&&this.onmessage(t);break;case"open":this.onopen&&this.onopen(t);break;case"down":this.ondown&&this.ondown(t);break;case"reopen":this.onreopen&&this.onreopen(t);break}return e in this.listeners&&this.listeners[e].slice().forEach((function(e){return s.callListener(e,t)})),!t||!t.defaultPrevented},e.prototype.callListener=function(e,t){"function"===typeof e?e.call(this,t):e.handleEvent.call(this,t)},e.prototype.debugLog=function(e){this.options.debug&&console.log(e)},e.prototype.getTooManyFailedReconnectsMessage=function(){var e=this.options.maxReconnectAttempts;return"Failed to reconnect after "+e+" "+c("attempt",e)+". Closing permanently."},e.DEFAULT_OPTIONS={allClearResetTime:5e3,connectTimeout:5e3,debug:!1,minReconnectDelay:1e3,maxReconnectDelay:3e4,maxReconnectAttempts:Number.POSITIVE_INFINITY,reconnectBackoffFactor:1.5,shouldReconnect:function(){return!0},wsConstructor:void 0},e.CONNECTING=0,e.OPEN=1,e.CLOSING=2,e.CLOSED=3,e}();function r(e){var t={};
1return Object.keys(i.DEFAULT_OPTIONS).forEach((function(s){var n=e[s];t[s]=void 0===n?i.DEFAULT_OPTIONS[s]:n})),t}function o(e){return"string"===typeof e?2*e.length:e instanceof ArrayBuffer?e.byteLength:e instanceof Blob?e.size:void 0}function c(e,t){return 1===t?e:e+"s"}function l(){}t.Z=i},5840:function(e,t,s){var n;if("object"===typeof globalThis)n=globalThis;else try{n=s(284)}catch(c){}finally{if(n||"undefined"===typeof window||(n=window),!n)throw new Error("Could not determine global this")}var i=n.WebSocket||n.MozWebSocket,r=s(9387);function o(e,t){var s;return s=t?new i(e,t):new i(e),s}i&&["CONNECTING","OPEN","CLOSING","CLOSED"].forEach((function(e){Object.defineProperty(o,e,{get:function(){return i[e]}})})),e.exports={w3cwebsocket:i?o:null,version:r}},9387:function(e,t,s){e.exports=s(9794).version},9794:function(e){"use strict";e.exports={version:"1.0.34"}}}]); 2//# sourceMappingURL=717.c86d2a39.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.