@dev.sail.money/sailor 1.3.0-225 → 1.3.0-227
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -0
- package/examples/custom-mandate/.sail/contracts/interfaces/IPermission.sol +4 -0
- package/examples/custom-mandate/README.md +4 -1
- package/examples/permissions/interfaces/IBatchPermission.sol +2 -0
- package/examples/permissions/interfaces/IPermission.sol +4 -0
- package/package.json +7 -1
- package/packages/cli/dist/index.cjs +58 -10
- package/packages/cli/dist/server.cjs +105 -23
- package/packages/sdk/dist/intelligence.d.ts +1 -1
- package/packages/sdk/dist/intelligence.js +1 -1
- package/packages/ui/dist/assets/{add-QIu9SGBU.js → add-DoHGZfJI.js} +2 -2
- package/packages/ui/dist/assets/{all-wallets-2auxp9E5.js → all-wallets-CUKVFyT3.js} +2 -2
- package/packages/ui/dist/assets/{app-store-BVtVvk-F.js → app-store-DyQ4PZOs.js} +1 -1
- package/packages/ui/dist/assets/{apple-Dq7Ppvqv.js → apple-Dc-GOiDW.js} +2 -2
- package/packages/ui/dist/assets/arrow-bottom-C-dI8Oh_.js +8 -0
- package/packages/ui/dist/assets/{arrow-bottom-circle-hkf9bWhW.js → arrow-bottom-circle-BH2LebvP.js} +2 -2
- package/packages/ui/dist/assets/arrow-left-CUIn5NsD.js +8 -0
- package/packages/ui/dist/assets/arrow-right-B-X57DDF.js +8 -0
- package/packages/ui/dist/assets/arrow-top-BNOmzVbg.js +8 -0
- package/packages/ui/dist/assets/{bank-CkRSSgJy.js → bank-Dqcy3Map.js} +2 -2
- package/packages/ui/dist/assets/{basic-D9puI79I.js → basic-CN95kOlB.js} +177 -177
- package/packages/ui/dist/assets/{browser-BC8qo0Bh.js → browser-v-WzD6Au.js} +2 -2
- package/packages/ui/dist/assets/{card-BYuGTxNc.js → card-DJmQXuOi.js} +2 -2
- package/packages/ui/dist/assets/ccip-8oS512uk.js +1 -0
- package/packages/ui/dist/assets/{checkmark-C-MZeapS.js → checkmark-6Rvy6Al7.js} +2 -2
- package/packages/ui/dist/assets/{checkmark-bold-Bs3hadsW.js → checkmark-bold-GYXSMFUr.js} +2 -2
- package/packages/ui/dist/assets/chevron-bottom-BF1Fa2NO.js +8 -0
- package/packages/ui/dist/assets/chevron-left-kj9KjPLp.js +8 -0
- package/packages/ui/dist/assets/chevron-right-CHH0lg7_.js +8 -0
- package/packages/ui/dist/assets/chevron-top-DjHmnG32.js +8 -0
- package/packages/ui/dist/assets/{chrome-store-sDKm_6es.js → chrome-store-KzNe4H9H.js} +2 -2
- package/packages/ui/dist/assets/{clock-BwfFymxk.js → clock-xHvMNQNx.js} +2 -2
- package/packages/ui/dist/assets/{close-BewD5_E0.js → close-nKtgX0WM.js} +2 -2
- package/packages/ui/dist/assets/{coinPlaceholder-DRPvf0NA.js → coinPlaceholder-gnwD3g4G.js} +2 -2
- package/packages/ui/dist/assets/{compass-BHPvd2dw.js → compass-wnLBxh3w.js} +2 -2
- package/packages/ui/dist/assets/{copy-BMv4Y3KF.js → copy-CmLisiOG.js} +2 -2
- package/packages/ui/dist/assets/core-BLOM5s8O.js +907 -0
- package/packages/ui/dist/assets/cursor-DgwjrlpZ.js +3 -0
- package/packages/ui/dist/assets/{cursor-transparent-DT8YBqHU.js → cursor-transparent-CjVDknUI.js} +2 -2
- package/packages/ui/dist/assets/{desktop-BeePUUqi.js → desktop-BSGjR5fT.js} +2 -2
- package/packages/ui/dist/assets/{disconnect-C2qT29qY.js → disconnect-DkOQ_j9U.js} +2 -2
- package/packages/ui/dist/assets/{discord-I4ToELfU.js → discord-DtvZ281_.js} +2 -2
- package/packages/ui/dist/assets/{etherscan-3psXC5Ef.js → etherscan-BB3baLbR.js} +2 -2
- package/packages/ui/dist/assets/events-DQ172AOg.js +1 -0
- package/packages/ui/dist/assets/{exclamation-triangle-BCaWksGJ.js → exclamation-triangle-BrR8a-pR.js} +2 -2
- package/packages/ui/dist/assets/{extension-DfYavvbY.js → extension-BiGAMg97.js} +2 -2
- package/packages/ui/dist/assets/external-link-qUc7QuKA.js +8 -0
- package/packages/ui/dist/assets/{facebook-BSvrXy3w.js → facebook-BuXatc22.js} +2 -2
- package/packages/ui/dist/assets/{farcaster-CcAuzEDi.js → farcaster-USwPlLU8.js} +2 -2
- package/packages/ui/dist/assets/{filters-umCx-UFU.js → filters-BWx3pZxN.js} +2 -2
- package/packages/ui/dist/assets/{github-CBNoBl67.js → github-CUSWD7ff.js} +2 -2
- package/packages/ui/dist/assets/{google-yyR1jNOC.js → google-CxJSLEaz.js} +2 -2
- package/packages/ui/dist/assets/{help-circle-C0WjKnIM.js → help-circle-_8isjSO0.js} +1 -1
- package/packages/ui/dist/assets/{id-BwIK6e_N.js → id-DJCzMfx_.js} +2 -2
- package/packages/ui/dist/assets/{image-D5oAo1Te.js → image-CmG69MZj.js} +2 -2
- package/packages/ui/dist/assets/{index-DMNSiu42.js → index-3YqzzyrK.js} +3 -3
- package/packages/ui/dist/assets/index-B07bCKJ8.css +1 -0
- package/packages/ui/dist/assets/index-BIqjq0q5.js +1 -0
- package/packages/ui/dist/assets/index-BV8s6ez1.js +1 -0
- package/packages/ui/dist/assets/index-D8zwDy7d.js +1780 -0
- package/packages/ui/dist/assets/index-DHVwxjrm.js +47 -0
- package/packages/ui/dist/assets/index-DsxB7ORb.js +16 -0
- package/packages/ui/dist/assets/index.es-Hqwz_Ukd.js +26 -0
- package/packages/ui/dist/assets/{info-CtcvKk8x.js → info-XYctdUoY.js} +2 -2
- package/packages/ui/dist/assets/{info-circle-BIm6XYyt.js → info-circle-D_fYZUhv.js} +2 -2
- package/packages/ui/dist/assets/{lightbulb-CMj21RIi.js → lightbulb-BqKkDThe.js} +2 -2
- package/packages/ui/dist/assets/{mail-C805tcaU.js → mail-CM4laVWT.js} +2 -2
- package/packages/ui/dist/assets/metamask-sdk-8TvB8vxr.js +542 -0
- package/packages/ui/dist/assets/{mobile-BEii3NyZ.js → mobile-C2cl_MIN.js} +2 -2
- package/packages/ui/dist/assets/{more-RSnRt81X.js → more-DOik7ytj.js} +2 -2
- package/packages/ui/dist/assets/{network-placeholder-s9JaqzCQ.js → network-placeholder-CC9Cg0q_.js} +2 -2
- package/packages/ui/dist/assets/{nftPlaceholder-Ccur2yVc.js → nftPlaceholder-Oe_bTYkM.js} +2 -2
- package/packages/ui/dist/assets/{off-DUtG4rlI.js → off-ao0Rdo1E.js} +2 -2
- package/packages/ui/dist/assets/{play-store-Bt2HvO3e.js → play-store-BcQlROdR.js} +2 -2
- package/packages/ui/dist/assets/{plus-BtEzQu0h.js → plus-DSOprccT.js} +2 -2
- package/packages/ui/dist/assets/{qr-code-xbQZ-Nio.js → qr-code-B64-C9CJ.js} +1 -1
- package/packages/ui/dist/assets/{recycle-horizontal-d9pzE6vq.js → recycle-horizontal-BJg7qNO9.js} +2 -2
- package/packages/ui/dist/assets/{refresh-B3-2Sch0.js → refresh-Dexg1q9p.js} +2 -2
- package/packages/ui/dist/assets/{reown-logo-DBkmQAX8.js → reown-logo-D8KP4d24.js} +2 -2
- package/packages/ui/dist/assets/{search-dgDA8Ou5.js → search-CBfhIhB0.js} +2 -2
- package/packages/ui/dist/assets/{secp256k1-C4g4FCze.js → secp256k1-BOKPNuRR.js} +1 -1
- package/packages/ui/dist/assets/{send-CEDXr4l7.js → send-DpJV-P0b.js} +2 -2
- package/packages/ui/dist/assets/{swapHorizontal-Co6_f8oH.js → swapHorizontal-DC-Elc2j.js} +2 -2
- package/packages/ui/dist/assets/{swapHorizontalBold-k4d22FNy.js → swapHorizontalBold-Unn8xI55.js} +2 -2
- package/packages/ui/dist/assets/{swapHorizontalMedium-Des6w_mz.js → swapHorizontalMedium-B58RR8wP.js} +2 -2
- package/packages/ui/dist/assets/{swapHorizontalRoundedBold-CVd4538j.js → swapHorizontalRoundedBold-UTrbE6zM.js} +2 -2
- package/packages/ui/dist/assets/{swapVertical-Cn_eRfv8.js → swapVertical-CLBtBVG1.js} +2 -2
- package/packages/ui/dist/assets/{telegram-BE46RC0s.js → telegram-C_tvCVU8.js} +2 -2
- package/packages/ui/dist/assets/{three-dots-CvqWsUWa.js → three-dots-BIn_IFa0.js} +2 -2
- package/packages/ui/dist/assets/{twitch-9V7YXB0X.js → twitch-BqiEXRul.js} +2 -2
- package/packages/ui/dist/assets/{twitterIcon-DbUxk6yk.js → twitterIcon-CquA5TCG.js} +2 -2
- package/packages/ui/dist/assets/{verify-CQSnwVrh.js → verify-DOUX5_SE.js} +2 -2
- package/packages/ui/dist/assets/{verify-filled-DG_hDTr8.js → verify-filled-nMk53S_a.js} +2 -2
- package/packages/ui/dist/assets/{w3m-modal-BsHGIrg7.js → w3m-modal-B-JVYtbP.js} +1 -1
- package/packages/ui/dist/assets/{wallet-lbVIReb_.js → wallet-BjbzMOXA.js} +2 -2
- package/packages/ui/dist/assets/{wallet-placeholder-C_ndmKAs.js → wallet-placeholder-DPidGoJt.js} +2 -2
- package/packages/ui/dist/assets/{walletconnect-ByDpG-E0.js → walletconnect-Dw14KwDj.js} +3 -3
- package/packages/ui/dist/assets/{warning-circle-hrS3II0d.js → warning-circle-Ewxxj9bx.js} +2 -2
- package/packages/ui/dist/assets/{x-BPMn3x5J.js → x-B5Li_yME.js} +2 -2
- package/packages/ui/dist/index.html +2 -2
- package/templates/default/.agents/skills/sail-mandates/references/examples-index.md +2 -2
- package/templates/default/.agents/skills/sail-servers/SKILL.md +1 -0
- package/templates/default/.env.example +9 -0
- package/templates/default/test/BoundedCallPermission.t.sol +2 -1
- package/packages/ui/dist/assets/arrow-bottom-DpT3R4Rr.js +0 -8
- package/packages/ui/dist/assets/arrow-left-3PhiE4SD.js +0 -8
- package/packages/ui/dist/assets/arrow-right-DUIXJHib.js +0 -8
- package/packages/ui/dist/assets/arrow-top-Cf--02la.js +0 -8
- package/packages/ui/dist/assets/ccip-BS_rjbk9.js +0 -1
- package/packages/ui/dist/assets/chevron-bottom-C8mqtkD4.js +0 -8
- package/packages/ui/dist/assets/chevron-left-Dxj-vVDJ.js +0 -8
- package/packages/ui/dist/assets/chevron-right-BoIrOTtL.js +0 -8
- package/packages/ui/dist/assets/chevron-top-BlgziB_P.js +0 -8
- package/packages/ui/dist/assets/core-BMNH6XFj.js +0 -907
- package/packages/ui/dist/assets/cursor-ir0cjMUl.js +0 -3
- package/packages/ui/dist/assets/events-Cdt6abbf.js +0 -1
- package/packages/ui/dist/assets/external-link-B8uBskz7.js +0 -8
- package/packages/ui/dist/assets/fallback-BSMYROva.js +0 -1
- package/packages/ui/dist/assets/index-B_Gc8xPp.js +0 -1
- package/packages/ui/dist/assets/index-BaEe036r.js +0 -1
- package/packages/ui/dist/assets/index-BuqyrXYX.js +0 -16
- package/packages/ui/dist/assets/index-CKoOBsKn.css +0 -1
- package/packages/ui/dist/assets/index-CPrhuDfP.js +0 -1782
- package/packages/ui/dist/assets/index-DCWU1RuS.js +0 -1
- package/packages/ui/dist/assets/index.es-DImsg59a.js +0 -26
- package/packages/ui/dist/assets/metamask-sdk-DDk4vkrl.js +0 -542
- package/packages/ui/dist/assets/native-CJ5et6AR.js +0 -1
- package/packages/ui/dist/assets/parseSignature-BbS8pxpB.js +0 -1
|
@@ -0,0 +1,542 @@
|
|
|
1
|
+
var Wf=Object.defineProperty;var Gf=(t,e,n)=>e in t?Wf(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Ht=(t,e,n)=>Gf(t,typeof e!="symbol"?e+"":e,n);import{m as ei,P as ma,_ as Yf}from"./index-D8zwDy7d.js";var ti={exports:{}},ac;function Zf(){return ac||(ac=1,(function(t,e){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof ei<"u"&&ei,r=(function(){function o(){this.fetch=!1,this.DOMException=n.DOMException}return o.prototype=n,new o})();(function(o){(function(c){var s=typeof o<"u"&&o||typeof self<"u"&&self||typeof ei<"u"&&ei||{},a={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&(function(){try{return new Blob,!0}catch{return!1}})(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function l(S){return S&&DataView.prototype.isPrototypeOf(S)}if(a.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(S){return S&&u.indexOf(Object.prototype.toString.call(S))>-1};function h(S){if(typeof S!="string"&&(S=String(S)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(S)||S==="")throw new TypeError('Invalid character in header field name: "'+S+'"');return S.toLowerCase()}function f(S){return typeof S!="string"&&(S=String(S)),S}function m(S){var I={next:function(){var j=S.shift();return{done:j===void 0,value:j}}};return a.iterable&&(I[Symbol.iterator]=function(){return I}),I}function g(S){this.map={},S instanceof g?S.forEach(function(I,j){this.append(j,I)},this):Array.isArray(S)?S.forEach(function(I){if(I.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+I.length);this.append(I[0],I[1])},this):S&&Object.getOwnPropertyNames(S).forEach(function(I){this.append(I,S[I])},this)}g.prototype.append=function(S,I){S=h(S),I=f(I);var j=this.map[S];this.map[S]=j?j+", "+I:I},g.prototype.delete=function(S){delete this.map[h(S)]},g.prototype.get=function(S){return S=h(S),this.has(S)?this.map[S]:null},g.prototype.has=function(S){return this.map.hasOwnProperty(h(S))},g.prototype.set=function(S,I){this.map[h(S)]=f(I)},g.prototype.forEach=function(S,I){for(var j in this.map)this.map.hasOwnProperty(j)&&S.call(I,this.map[j],j,this)},g.prototype.keys=function(){var S=[];return this.forEach(function(I,j){S.push(j)}),m(S)},g.prototype.values=function(){var S=[];return this.forEach(function(I){S.push(I)}),m(S)},g.prototype.entries=function(){var S=[];return this.forEach(function(I,j){S.push([j,I])}),m(S)},a.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function w(S){if(!S._noBody){if(S.bodyUsed)return Promise.reject(new TypeError("Already read"));S.bodyUsed=!0}}function p(S){return new Promise(function(I,j){S.onload=function(){I(S.result)},S.onerror=function(){j(S.error)}})}function C(S){var I=new FileReader,j=p(I);return I.readAsArrayBuffer(S),j}function _(S){var I=new FileReader,j=p(I),y=/charset=([A-Za-z0-9_-]+)/.exec(S.type),E=y?y[1]:"utf-8";return I.readAsText(S,E),j}function P(S){for(var I=new Uint8Array(S),j=new Array(I.length),y=0;y<I.length;y++)j[y]=String.fromCharCode(I[y]);return j.join("")}function L(S){if(S.slice)return S.slice(0);var I=new Uint8Array(S.byteLength);return I.set(new Uint8Array(S)),I.buffer}function U(){return this.bodyUsed=!1,this._initBody=function(S){this.bodyUsed=this.bodyUsed,this._bodyInit=S,S?typeof S=="string"?this._bodyText=S:a.blob&&Blob.prototype.isPrototypeOf(S)?this._bodyBlob=S:a.formData&&FormData.prototype.isPrototypeOf(S)?this._bodyFormData=S:a.searchParams&&URLSearchParams.prototype.isPrototypeOf(S)?this._bodyText=S.toString():a.arrayBuffer&&a.blob&&l(S)?(this._bodyArrayBuffer=L(S.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(S)||d(S))?this._bodyArrayBuffer=L(S):this._bodyText=S=Object.prototype.toString.call(S):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof S=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):a.searchParams&&URLSearchParams.prototype.isPrototypeOf(S)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a.blob&&(this.blob=function(){var S=w(this);if(S)return S;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var S=w(this);return S||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(a.blob)return this.blob().then(C);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var S=w(this);if(S)return S;if(this._bodyBlob)return _(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(P(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a.formData&&(this.formData=function(){return this.text().then(N)}),this.json=function(){return this.text().then(JSON.parse)},this}var q=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function F(S){var I=S.toUpperCase();return q.indexOf(I)>-1?I:S}function D(S,I){if(!(this instanceof D))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');I=I||{};var j=I.body;if(S instanceof D){if(S.bodyUsed)throw new TypeError("Already read");this.url=S.url,this.credentials=S.credentials,I.headers||(this.headers=new g(S.headers)),this.method=S.method,this.mode=S.mode,this.signal=S.signal,!j&&S._bodyInit!=null&&(j=S._bodyInit,S.bodyUsed=!0)}else this.url=String(S);if(this.credentials=I.credentials||this.credentials||"same-origin",(I.headers||!this.headers)&&(this.headers=new g(I.headers)),this.method=F(I.method||this.method||"GET"),this.mode=I.mode||this.mode||null,this.signal=I.signal||this.signal||(function(){if("AbortController"in s){var A=new AbortController;return A.signal}})(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&j)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(j),(this.method==="GET"||this.method==="HEAD")&&(I.cache==="no-store"||I.cache==="no-cache")){var y=/([?&])_=[^&]*/;if(y.test(this.url))this.url=this.url.replace(y,"$1_="+new Date().getTime());else{var E=/\?/;this.url+=(E.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}D.prototype.clone=function(){return new D(this,{body:this._bodyInit})};function N(S){var I=new FormData;return S.trim().split("&").forEach(function(j){if(j){var y=j.split("="),E=y.shift().replace(/\+/g," "),A=y.join("=").replace(/\+/g," ");I.append(decodeURIComponent(E),decodeURIComponent(A))}}),I}function H(S){var I=new g,j=S.replace(/\r?\n[\t ]+/g," ");return j.split("\r").map(function(y){return y.indexOf(`
|
|
2
|
+
`)===0?y.substr(1,y.length):y}).forEach(function(y){var E=y.split(":"),A=E.shift().trim();if(A){var T=E.join(":").trim();try{I.append(A,T)}catch(b){console.warn("Response "+b.message)}}}),I}U.call(D.prototype);function $(S,I){if(!(this instanceof $))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(I||(I={}),this.type="default",this.status=I.status===void 0?200:I.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=I.statusText===void 0?"":""+I.statusText,this.headers=new g(I.headers),this.url=I.url||"",this._initBody(S)}U.call($.prototype),$.prototype.clone=function(){return new $(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new g(this.headers),url:this.url})},$.error=function(){var S=new $(null,{status:200,statusText:""});return S.ok=!1,S.status=0,S.type="error",S};var O=[301,302,303,307,308];$.redirect=function(S,I){if(O.indexOf(I)===-1)throw new RangeError("Invalid status code");return new $(null,{status:I,headers:{location:S}})},c.DOMException=s.DOMException;try{new c.DOMException}catch{c.DOMException=function(I,j){this.message=I,this.name=j;var y=Error(I);this.stack=y.stack},c.DOMException.prototype=Object.create(Error.prototype),c.DOMException.prototype.constructor=c.DOMException}function M(S,I){return new Promise(function(j,y){var E=new D(S,I);if(E.signal&&E.signal.aborted)return y(new c.DOMException("Aborted","AbortError"));var A=new XMLHttpRequest;function T(){A.abort()}A.onload=function(){var k={statusText:A.statusText,headers:H(A.getAllResponseHeaders()||"")};E.url.indexOf("file://")===0&&(A.status<200||A.status>599)?k.status=200:k.status=A.status,k.url="responseURL"in A?A.responseURL:k.headers.get("X-Request-URL");var x="response"in A?A.response:A.responseText;setTimeout(function(){j(new $(x,k))},0)},A.onerror=function(){setTimeout(function(){y(new TypeError("Network request failed"))},0)},A.ontimeout=function(){setTimeout(function(){y(new TypeError("Network request timed out"))},0)},A.onabort=function(){setTimeout(function(){y(new c.DOMException("Aborted","AbortError"))},0)};function b(k){try{return k===""&&s.location.href?s.location.href:k}catch{return k}}if(A.open(E.method,b(E.url),!0),E.credentials==="include"?A.withCredentials=!0:E.credentials==="omit"&&(A.withCredentials=!1),"responseType"in A&&(a.blob?A.responseType="blob":a.arrayBuffer&&(A.responseType="arraybuffer")),I&&typeof I.headers=="object"&&!(I.headers instanceof g||s.Headers&&I.headers instanceof s.Headers)){var v=[];Object.getOwnPropertyNames(I.headers).forEach(function(k){v.push(h(k)),A.setRequestHeader(k,f(I.headers[k]))}),E.headers.forEach(function(k,x){v.indexOf(x)===-1&&A.setRequestHeader(x,k)})}else E.headers.forEach(function(k,x){A.setRequestHeader(x,k)});E.signal&&(E.signal.addEventListener("abort",T),A.onreadystatechange=function(){A.readyState===4&&E.signal.removeEventListener("abort",T)}),A.send(typeof E._bodyInit>"u"?null:E._bodyInit)})}return M.polyfill=!0,s.fetch||(s.fetch=M,s.Headers=g,s.Request=D,s.Response=$),c.Headers=g,c.Request=D,c.Response=$,c.fetch=M,c})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=n.fetch?n:r;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(ti,ti.exports)),ti.exports}var Jf=Zf();const Pu=ma(Jf);var ni={exports:{}},Bo,cc;function Xf(){if(cc)return Bo;cc=1;var t=1e3,e=t*60,n=e*60,r=n*24,i=r*7,o=r*365.25;Bo=function(u,d){d=d||{};var h=typeof u;if(h==="string"&&u.length>0)return c(u);if(h==="number"&&isFinite(u))return d.long?a(u):s(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function c(u){if(u=String(u),!(u.length>100)){var d=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(d){var h=parseFloat(d[1]),f=(d[2]||"ms").toLowerCase();switch(f){case"years":case"year":case"yrs":case"yr":case"y":return h*o;case"weeks":case"week":case"w":return h*i;case"days":case"day":case"d":return h*r;case"hours":case"hour":case"hrs":case"hr":case"h":return h*n;case"minutes":case"minute":case"mins":case"min":case"m":return h*e;case"seconds":case"second":case"secs":case"sec":case"s":return h*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return h;default:return}}}}function s(u){var d=Math.abs(u);return d>=r?Math.round(u/r)+"d":d>=n?Math.round(u/n)+"h":d>=e?Math.round(u/e)+"m":d>=t?Math.round(u/t)+"s":u+"ms"}function a(u){var d=Math.abs(u);return d>=r?l(u,d,r,"day"):d>=n?l(u,d,n,"hour"):d>=e?l(u,d,e,"minute"):d>=t?l(u,d,t,"second"):u+" ms"}function l(u,d,h,f){var m=d>=h*1.5;return Math.round(u/h)+" "+f+(m?"s":"")}return Bo}var $o,lc;function Qf(){if(lc)return $o;lc=1;function t(e){r.debug=r,r.default=r,r.coerce=l,r.disable=c,r.enable=o,r.enabled=s,r.humanize=Xf(),r.destroy=u,Object.keys(e).forEach(d=>{r[d]=e[d]}),r.names=[],r.skips=[],r.formatters={};function n(d){let h=0;for(let f=0;f<d.length;f++)h=(h<<5)-h+d.charCodeAt(f),h|=0;return r.colors[Math.abs(h)%r.colors.length]}r.selectColor=n;function r(d){let h,f=null,m,g;function w(...p){if(!w.enabled)return;const C=w,_=Number(new Date),P=_-(h||_);C.diff=P,C.prev=h,C.curr=_,h=_,p[0]=r.coerce(p[0]),typeof p[0]!="string"&&p.unshift("%O");let L=0;p[0]=p[0].replace(/%([a-zA-Z%])/g,(q,F)=>{if(q==="%%")return"%";L++;const D=r.formatters[F];if(typeof D=="function"){const N=p[L];q=D.call(C,N),p.splice(L,1),L--}return q}),r.formatArgs.call(C,p),(C.log||r.log).apply(C,p)}return w.namespace=d,w.useColors=r.useColors(),w.color=r.selectColor(d),w.extend=i,w.destroy=r.destroy,Object.defineProperty(w,"enabled",{enumerable:!0,configurable:!1,get:()=>f!==null?f:(m!==r.namespaces&&(m=r.namespaces,g=r.enabled(d)),g),set:p=>{f=p}}),typeof r.init=="function"&&r.init(w),w}function i(d,h){const f=r(this.namespace+(typeof h>"u"?":":h)+d);return f.log=this.log,f}function o(d){r.save(d),r.namespaces=d,r.names=[],r.skips=[];let h;const f=(typeof d=="string"?d:"").split(/[\s,]+/),m=f.length;for(h=0;h<m;h++)f[h]&&(d=f[h].replace(/\*/g,".*?"),d[0]==="-"?r.skips.push(new RegExp("^"+d.slice(1)+"$")):r.names.push(new RegExp("^"+d+"$")))}function c(){const d=[...r.names.map(a),...r.skips.map(a).map(h=>"-"+h)].join(",");return r.enable(""),d}function s(d){if(d[d.length-1]==="*")return!0;let h,f;for(h=0,f=r.skips.length;h<f;h++)if(r.skips[h].test(d))return!1;for(h=0,f=r.names.length;h<f;h++)if(r.names[h].test(d))return!0;return!1}function a(d){return d.toString().substring(2,d.toString().length-2).replace(/\.\*\?$/,"*")}function l(d){return d instanceof Error?d.stack||d.message:d}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}return $o=t,$o}var uc;function ep(){return uc||(uc=1,(function(t,e){var n={};e.formatArgs=i,e.save=o,e.load=c,e.useColors=r,e.storage=s(),e.destroy=(()=>{let l=!1;return()=>{l||(l=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function i(l){if(l[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+l[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const u="color: "+this.color;l.splice(1,0,u,"color: inherit");let d=0,h=0;l[0].replace(/%[a-zA-Z%]/g,f=>{f!=="%%"&&(d++,f==="%c"&&(h=d))}),l.splice(h,0,u)}e.log=console.debug||console.log||(()=>{});function o(l){try{l?e.storage.setItem("debug",l):e.storage.removeItem("debug")}catch{}}function c(){let l;try{l=e.storage.getItem("debug")}catch{}return!l&&typeof process<"u"&&"env"in process&&(l=n.DEBUG),l}function s(){try{return localStorage}catch{}}t.exports=Qf()(e);const{formatters:a}=t.exports;a.j=function(l){try{return JSON.stringify(l)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}})(ni,ni.exports)),ni.exports}var tp=ep();const Je=ma(tp);var Ko,dc;function np(){if(dc)return Ko;dc=1;var t=Object.defineProperty,e=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,i=(D,N)=>{for(var H in N)t(D,H,{get:N[H],enumerable:!0})},o=(D,N,H,$)=>{if(N&&typeof N=="object"||typeof N=="function")for(let O of n(N))!r.call(D,O)&&O!==H&&t(D,O,{get:()=>N[O],enumerable:!($=e(N,O))||$.enumerable});return D},c=D=>o(t({},"__esModule",{value:!0}),D),s={};i(s,{createFinalURL:()=>U,createPathBasedClient:()=>g,createQuerySerializer:()=>_,default:()=>d,defaultBodySerializer:()=>L,defaultPathSerializer:()=>P,mergeHeaders:()=>q,randomID:()=>u,removeTrailingSlash:()=>F,serializeArrayParam:()=>C,serializeObjectParam:()=>p,serializePrimitiveParam:()=>w,wrapAsPathBasedClient:()=>m}),Ko=c(s);var a=/\{[^{}]+\}/g,l=()=>{var D,N;return typeof process=="object"&&Number.parseInt((N=(D=process==null?void 0:process.versions)==null?void 0:D.node)==null?void 0:N.substring(0,2))>=18&&process.versions.undici};function u(){return Math.random().toString(36).slice(2,11)}function d(D){let{baseUrl:N="",Request:H=globalThis.Request,fetch:$=globalThis.fetch,querySerializer:O,bodySerializer:M,headers:S,requestInitExt:I=void 0,...j}={...D};I=l()?I:void 0,N=F(N);const y=[];async function E(A,T){const{baseUrl:b,fetch:v=$,Request:k=H,headers:x,params:R={},parseAs:B="json",querySerializer:K,bodySerializer:z=M??L,body:V,...Z}=T||{};let Q=N;b&&(Q=F(b)??N);let ne=typeof O=="function"?O:_(O);K&&(ne=typeof K=="function"?K:_({...typeof O=="object"?O:{},...K}));const oe=V===void 0?void 0:z(V,q(S,x,R.header)),ue=q(oe===void 0||oe instanceof FormData?{}:{"Content-Type":"application/json"},S,x,R.header),re={redirect:"follow",...j,...Z,body:oe,headers:ue};let ie,le,se=new H(U(A,{baseUrl:Q,params:R,querySerializer:ne}),re),fe;for(const ce in Z)ce in se||(se[ce]=Z[ce]);if(y.length){ie=u(),le=Object.freeze({baseUrl:Q,fetch:v,parseAs:B,querySerializer:ne,bodySerializer:z});for(const ce of y)if(ce&&typeof ce=="object"&&typeof ce.onRequest=="function"){const de=await ce.onRequest({request:se,schemaPath:A,params:R,options:le,id:ie});if(de)if(de instanceof H)se=de;else if(de instanceof Response){fe=de;break}else throw new Error("onRequest: must return new Request() or Response() when modifying the request")}}if(!fe){try{fe=await v(se,I)}catch(ce){let de=ce;if(y.length)for(let me=y.length-1;me>=0;me--){const Ae=y[me];if(Ae&&typeof Ae=="object"&&typeof Ae.onError=="function"){const Ie=await Ae.onError({request:se,error:de,schemaPath:A,params:R,options:le,id:ie});if(Ie){if(Ie instanceof Response){de=void 0,fe=Ie;break}if(Ie instanceof Error){de=Ie;continue}throw new Error("onError: must return new Response() or instance of Error")}}}if(de)throw de}if(y.length)for(let ce=y.length-1;ce>=0;ce--){const de=y[ce];if(de&&typeof de=="object"&&typeof de.onResponse=="function"){const me=await de.onResponse({request:se,response:fe,schemaPath:A,params:R,options:le,id:ie});if(me){if(!(me instanceof Response))throw new Error("onResponse: must return new Response() when modifying the response");fe=me}}}}if(fe.status===204||se.method==="HEAD"||fe.headers.get("Content-Length")==="0")return fe.ok?{data:void 0,response:fe}:{error:void 0,response:fe};if(fe.ok)return B==="stream"?{data:fe.body,response:fe}:{data:await fe[B](),response:fe};let ve=await fe.text();try{ve=JSON.parse(ve)}catch{}return{error:ve,response:fe}}return{request(A,T,b){return E(T,{...b,method:A.toUpperCase()})},GET(A,T){return E(A,{...T,method:"GET"})},PUT(A,T){return E(A,{...T,method:"PUT"})},POST(A,T){return E(A,{...T,method:"POST"})},DELETE(A,T){return E(A,{...T,method:"DELETE"})},OPTIONS(A,T){return E(A,{...T,method:"OPTIONS"})},HEAD(A,T){return E(A,{...T,method:"HEAD"})},PATCH(A,T){return E(A,{...T,method:"PATCH"})},TRACE(A,T){return E(A,{...T,method:"TRACE"})},use(...A){for(const T of A)if(T){if(typeof T!="object"||!("onRequest"in T||"onResponse"in T||"onError"in T))throw new Error("Middleware must be an object with one of `onRequest()`, `onResponse() or `onError()`");y.push(T)}},eject(...A){for(const T of A){const b=y.indexOf(T);b!==-1&&y.splice(b,1)}}}}var h=class{constructor(D,N){Ht(this,"GET",D=>this.client.GET(this.url,D));Ht(this,"PUT",D=>this.client.PUT(this.url,D));Ht(this,"POST",D=>this.client.POST(this.url,D));Ht(this,"DELETE",D=>this.client.DELETE(this.url,D));Ht(this,"OPTIONS",D=>this.client.OPTIONS(this.url,D));Ht(this,"HEAD",D=>this.client.HEAD(this.url,D));Ht(this,"PATCH",D=>this.client.PATCH(this.url,D));Ht(this,"TRACE",D=>this.client.TRACE(this.url,D));this.client=D,this.url=N}},f=class{constructor(){this.client=null}get(D,N){const H=new h(D,N);return this.client[N]=H,H}};function m(D){const N=new f,H=new Proxy(D,N);function $(){}$.prototype=H;const O=new $;return N.client=O,O}function g(D){return m(d(D))}function w(D,N,H){if(N==null)return"";if(typeof N=="object")throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${D}=${(H==null?void 0:H.allowReserved)===!0?N:encodeURIComponent(N)}`}function p(D,N,H){if(!N||typeof N!="object")return"";const $=[],O={simple:",",label:".",matrix:";"}[H.style]||"&";if(H.style!=="deepObject"&&H.explode===!1){for(const I in N)$.push(I,H.allowReserved===!0?N[I]:encodeURIComponent(N[I]));const S=$.join(",");switch(H.style){case"form":return`${D}=${S}`;case"label":return`.${S}`;case"matrix":return`;${D}=${S}`;default:return S}}for(const S in N){const I=H.style==="deepObject"?`${D}[${S}]`:S;$.push(w(I,N[S],H))}const M=$.join(O);return H.style==="label"||H.style==="matrix"?`${O}${M}`:M}function C(D,N,H){if(!Array.isArray(N))return"";if(H.explode===!1){const M={form:",",spaceDelimited:"%20",pipeDelimited:"|"}[H.style]||",",S=(H.allowReserved===!0?N:N.map(I=>encodeURIComponent(I))).join(M);switch(H.style){case"simple":return S;case"label":return`.${S}`;case"matrix":return`;${D}=${S}`;default:return`${D}=${S}`}}const $={simple:",",label:".",matrix:";"}[H.style]||"&",O=[];for(const M of N)H.style==="simple"||H.style==="label"?O.push(H.allowReserved===!0?M:encodeURIComponent(M)):O.push(w(D,M,H));return H.style==="label"||H.style==="matrix"?`${$}${O.join($)}`:O.join($)}function _(D){return function(H){const $=[];if(H&&typeof H=="object")for(const O in H){const M=H[O];if(M!=null){if(Array.isArray(M)){if(M.length===0)continue;$.push(C(O,M,{style:"form",explode:!0,...D==null?void 0:D.array,allowReserved:(D==null?void 0:D.allowReserved)||!1}));continue}if(typeof M=="object"){$.push(p(O,M,{style:"deepObject",explode:!0,...D==null?void 0:D.object,allowReserved:(D==null?void 0:D.allowReserved)||!1}));continue}$.push(w(O,M,D))}}return $.join("&")}}function P(D,N){let H=D;for(const $ of D.match(a)??[]){let O=$.substring(1,$.length-1),M=!1,S="simple";if(O.endsWith("*")&&(M=!0,O=O.substring(0,O.length-1)),O.startsWith(".")?(S="label",O=O.substring(1)):O.startsWith(";")&&(S="matrix",O=O.substring(1)),!N||N[O]===void 0||N[O]===null)continue;const I=N[O];if(Array.isArray(I)){H=H.replace($,C(O,I,{style:S,explode:M}));continue}if(typeof I=="object"){H=H.replace($,p(O,I,{style:S,explode:M}));continue}if(S==="matrix"){H=H.replace($,`;${w(O,I)}`);continue}H=H.replace($,S==="label"?`.${encodeURIComponent(I)}`:encodeURIComponent(I))}return H}function L(D,N){return D instanceof FormData?D:N&&(N.get instanceof Function?N.get("Content-Type")??N.get("content-type"):N["Content-Type"]??N["content-type"])==="application/x-www-form-urlencoded"?new URLSearchParams(D).toString():JSON.stringify(D)}function U(D,N){var O;let H=`${N.baseUrl}${D}`;(O=N.params)!=null&&O.path&&(H=P(H,N.params.path));let $=N.querySerializer(N.params.query??{});return $.startsWith("?")&&($=$.substring(1)),$&&(H+=`?${$}`),H}function q(...D){const N=new Headers;for(const H of D){if(!H||typeof H!="object")continue;const $=H instanceof Headers?H.entries():Object.entries(H);for(const[O,M]of $)if(M===null)N.delete(O);else if(Array.isArray(M))for(const S of M)N.append(O,S);else M!==void 0&&N.set(O,M)}return N}function F(D){return D.endsWith("/")?D.substring(0,D.length-1):D}return Ko}var jo,hc;function rp(){if(hc)return jo;hc=1;var t={},e=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,o=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,s=(U,q)=>{for(var F in q)n(U,F,{get:q[F],enumerable:!0})},a=(U,q,F,D)=>{if(q&&typeof q=="object"||typeof q=="function")for(let N of i(q))!c.call(U,N)&&N!==F&&n(U,N,{get:()=>q[N],enumerable:!(D=r(q,N))||D.enumerable});return U},l=(U,q,F)=>(F=U!=null?e(o(U)):{},a(!U||!U.__esModule?n(F,"default",{value:U,enumerable:!0}):F,U)),u=U=>a(n({},"__esModule",{value:!0}),U),d={};s(d,{analytics:()=>L}),jo=u(d);var h=l(np()),f=class{constructor(U){this.batch=[],this.maxTimeoutMs=3e4,this.timeoutId=null,this.isSending=!1,this.batchSize=U.batchSize,this.baseTimeoutMs=U.baseTimeoutMs,this.currentTimeoutMs=U.baseTimeoutMs,this.sendFn=U.sendFn}enqueue(U){this.batch.push(U),this.schedule()}schedule(){this.batch.length>0&&!this.timeoutId&&(this.timeoutId=setTimeout(()=>{this.timeoutId=null,this.flush()},this.currentTimeoutMs))}async flush(){if(this.isSending||this.batch.length===0)return;this.isSending=!0;const U=[...this.batch.slice(0,this.batchSize)];this.batch=this.batch.slice(this.batchSize);try{await this.sendFn(U),this.currentTimeoutMs=this.baseTimeoutMs}catch(q){console.error("Sender: Failed to send batch",q),this.batch=[...U,...this.batch],this.currentTimeoutMs=Math.min(this.currentTimeoutMs*2,this.maxTimeoutMs)}finally{this.isSending=!1,this.schedule()}}},m=f,g=class{constructor(U){this.enabled=!1,this.properties={};const q=(0,h.default)({baseUrl:U}),F=async D=>{const N=await q.POST("/v1/events",{body:D});if(N.response.status!==200)throw new Error(N.error)};this.sender=new m({batchSize:100,baseTimeoutMs:200,sendFn:F})}enable(){this.enabled=!0}setGlobalProperty(U,q){this.properties[U]=q}track(U,q){if(!this.enabled)return;const F={name:U,...this.properties,...q};this.sender.enqueue(F)}},w=g,p,C;typeof process<"u"&&t&&(p=(C=t.METAMASK_ANALYTICS_ENDPOINT)!=null?C:t.NEXT_PUBLIC_METAMASK_ANALYTICS_ENDPOINT);var _=p??"https://mm-sdk-analytics.api.cx.metamask.io/",P=new w(_),L=P;return jo}var Re=rp(),Uo={exports:{}};/*!
|
|
3
|
+
* EventEmitter2
|
|
4
|
+
* https://github.com/hij1nx/EventEmitter2
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2013 hij1nx
|
|
7
|
+
* Licensed under the MIT license.
|
|
8
|
+
*/var fc;function ip(){return fc||(fc=1,(function(t,e){(function(n){var r=Object.hasOwnProperty,i=Array.isArray?Array.isArray:function(E){return Object.prototype.toString.call(E)==="[object Array]"},o=10,c=typeof process=="object"&&typeof process.nextTick=="function",s=typeof Symbol=="function",a=typeof Reflect=="object",l=typeof setImmediate=="function",u=l?setImmediate:setTimeout,d=s?a&&typeof Reflect.ownKeys=="function"?Reflect.ownKeys:function(y){var E=Object.getOwnPropertyNames(y);return E.push.apply(E,Object.getOwnPropertySymbols(y)),E}:Object.keys;function h(){this._events={},this._conf&&f.call(this,this._conf)}function f(y){y&&(this._conf=y,y.delimiter&&(this.delimiter=y.delimiter),y.maxListeners!==n&&(this._maxListeners=y.maxListeners),y.wildcard&&(this.wildcard=y.wildcard),y.newListener&&(this._newListener=y.newListener),y.removeListener&&(this._removeListener=y.removeListener),y.verboseMemoryLeak&&(this.verboseMemoryLeak=y.verboseMemoryLeak),y.ignoreErrors&&(this.ignoreErrors=y.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function m(y,E){var A="(node) warning: possible EventEmitter memory leak detected. "+y+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(A+=" Event name: "+E+"."),typeof process<"u"&&process.emitWarning){var T=new Error(A);T.name="MaxListenersExceededWarning",T.emitter=this,T.count=y,process.emitWarning(T)}else console.error(A),console.trace&&console.trace()}var g=function(y,E,A){var T=arguments.length;switch(T){case 0:return[];case 1:return[y];case 2:return[y,E];case 3:return[y,E,A];default:for(var b=new Array(T);T--;)b[T]=arguments[T];return b}};function w(y,E){for(var A={},T,b=y.length,v=0,k=0;k<b;k++)T=y[k],A[T]=k<v?E[k]:n;return A}function p(y,E,A){this._emitter=y,this._target=E,this._listeners={},this._listenersCount=0;var T,b;if((A.on||A.off)&&(T=A.on,b=A.off),E.addEventListener?(T=E.addEventListener,b=E.removeEventListener):E.addListener?(T=E.addListener,b=E.removeListener):E.on&&(T=E.on,b=E.off),!T&&!b)throw Error("target does not implement any known event API");if(typeof T!="function")throw TypeError("on method must be a function");if(typeof b!="function")throw TypeError("off method must be a function");this._on=T,this._off=b;var v=y._observers;v?v.push(this):y._observers=[this]}Object.assign(p.prototype,{subscribe:function(y,E,A){var T=this,b=this._target,v=this._emitter,k=this._listeners,x=function(){var R=g.apply(null,arguments),B={data:R,name:E,original:y};if(A){var K=A.call(b,B);K!==!1&&v.emit.apply(v,[B.name].concat(R));return}v.emit.apply(v,[E].concat(R))};if(k[y])throw Error("Event '"+y+"' is already listening");this._listenersCount++,v._newListener&&v._removeListener&&!T._onNewListener?(this._onNewListener=function(R){R===E&&k[y]===null&&(k[y]=x,T._on.call(b,y,x))},v.on("newListener",this._onNewListener),this._onRemoveListener=function(R){R===E&&!v.hasListeners(R)&&k[y]&&(k[y]=null,T._off.call(b,y,x))},k[y]=null,v.on("removeListener",this._onRemoveListener)):(k[y]=x,T._on.call(b,y,x))},unsubscribe:function(y){var E=this,A=this._listeners,T=this._emitter,b,v,k=this._off,x=this._target,R;if(y&&typeof y!="string")throw TypeError("event must be a string");function B(){E._onNewListener&&(T.off("newListener",E._onNewListener),T.off("removeListener",E._onRemoveListener),E._onNewListener=null,E._onRemoveListener=null);var K=F.call(T,E);T._observers.splice(K,1)}if(y){if(b=A[y],!b)return;k.call(x,y,b),delete A[y],--this._listenersCount||B()}else{for(v=d(A),R=v.length;R-- >0;)y=v[R],k.call(x,y,A[y]);this._listeners={},this._listenersCount=0,B()}}});function C(y,E,A,T){var b=Object.assign({},E);if(!y)return b;if(typeof y!="object")throw TypeError("options must be an object");var v=Object.keys(y),k=v.length,x,R,B;function K(V){throw Error('Invalid "'+x+'" option value'+(V?". Reason: "+V:""))}for(var z=0;z<k;z++){if(x=v[z],!r.call(E,x))throw Error('Unknown "'+x+'" option');R=y[x],R!==n&&(B=A[x],b[x]=B?B(R,K):R)}return b}function _(y,E){return(typeof y!="function"||!y.hasOwnProperty("prototype"))&&E("value must be a constructor"),y}function P(y){var E="value must be type of "+y.join("|"),A=y.length,T=y[0],b=y[1];return A===1?function(v,k){if(typeof v===T)return v;k(E)}:A===2?function(v,k){var x=typeof v;if(x===T||x===b)return v;k(E)}:function(v,k){for(var x=typeof v,R=A;R-- >0;)if(x===y[R])return v;k(E)}}var L=P(["function"]),U=P(["object","function"]);function q(y,E,A){var T,b,v=0,k,x=new y(function(R,B,K){A=C(A,{timeout:0,overload:!1},{timeout:function(Q,ne){return Q*=1,(typeof Q!="number"||Q<0||!Number.isFinite(Q))&&ne("timeout must be a positive number"),Q}}),T=!A.overload&&typeof y.prototype.cancel=="function"&&typeof K=="function";function z(){b&&(b=null),v&&(clearTimeout(v),v=0)}var V=function(Q){z(),R(Q)},Z=function(Q){z(),B(Q)};T?E(V,Z,K):(b=[function(Q){Z(Q||Error("canceled"))}],E(V,Z,function(Q){if(k)throw Error("Unable to subscribe on cancel event asynchronously");if(typeof Q!="function")throw TypeError("onCancel callback must be a function");b.push(Q)}),k=!0),A.timeout>0&&(v=setTimeout(function(){var Q=Error("timeout");Q.code="ETIMEDOUT",v=0,x.cancel(Q),B(Q)},A.timeout))});return T||(x.cancel=function(R){if(b){for(var B=b.length,K=1;K<B;K++)b[K](R);b[0](R),b=null}}),x}function F(y){var E=this._observers;if(!E)return-1;for(var A=E.length,T=0;T<A;T++)if(E[T]._target===y)return T;return-1}function D(y,E,A,T,b){if(!A)return null;if(T===0){var v=typeof E;if(v==="string"){var k,x,R=0,B=0,K=this.delimiter,z=K.length;if((x=E.indexOf(K))!==-1){k=new Array(5);do k[R++]=E.slice(B,x),B=x+z;while((x=E.indexOf(K,B))!==-1);k[R++]=E.slice(B),E=k,b=R}else E=[E],b=1}else v==="object"?b=E.length:(E=[E],b=1)}var V=null,Z,Q,ne,oe,ue,re=E[T],ie=E[T+1],le,se;if(T===b)A._listeners&&(typeof A._listeners=="function"?(y&&y.push(A._listeners),V=[A]):(y&&y.push.apply(y,A._listeners),V=[A]));else if(re==="*"){for(le=d(A),x=le.length;x-- >0;)Z=le[x],Z!=="_listeners"&&(se=D(y,E,A[Z],T+1,b),se&&(V?V.push.apply(V,se):V=se));return V}else if(re==="**"){for(ue=T+1===b||T+2===b&&ie==="*",ue&&A._listeners&&(V=D(y,E,A,b,b)),le=d(A),x=le.length;x-- >0;)Z=le[x],Z!=="_listeners"&&(Z==="*"||Z==="**"?(A[Z]._listeners&&!ue&&(se=D(y,E,A[Z],b,b),se&&(V?V.push.apply(V,se):V=se)),se=D(y,E,A[Z],T,b)):Z===ie?se=D(y,E,A[Z],T+2,b):se=D(y,E,A[Z],T,b),se&&(V?V.push.apply(V,se):V=se));return V}else A[re]&&(V=D(y,E,A[re],T+1,b));if(Q=A["*"],Q&&D(y,E,Q,T+1,b),ne=A["**"],ne)if(T<b)for(ne._listeners&&D(y,E,ne,b,b),le=d(ne),x=le.length;x-- >0;)Z=le[x],Z!=="_listeners"&&(Z===ie?D(y,E,ne[Z],T+2,b):Z===re?D(y,E,ne[Z],T+1,b):(oe={},oe[Z]=ne[Z],D(y,E,{"**":oe},T+1,b)));else ne._listeners?D(y,E,ne,b,b):ne["*"]&&ne["*"]._listeners&&D(y,E,ne["*"],b,b);return V}function N(y,E,A){var T=0,b=0,v,k=this.delimiter,x=k.length,R;if(typeof y=="string")if((v=y.indexOf(k))!==-1){R=new Array(5);do R[T++]=y.slice(b,v),b=v+x;while((v=y.indexOf(k,b))!==-1);R[T++]=y.slice(b)}else R=[y],T=1;else R=y,T=y.length;if(T>1){for(v=0;v+1<T;v++)if(R[v]==="**"&&R[v+1]==="**")return}var B=this.listenerTree,K;for(v=0;v<T;v++)if(K=R[v],B=B[K]||(B[K]={}),v===T-1)return B._listeners?(typeof B._listeners=="function"&&(B._listeners=[B._listeners]),A?B._listeners.unshift(E):B._listeners.push(E),!B._listeners.warned&&this._maxListeners>0&&B._listeners.length>this._maxListeners&&(B._listeners.warned=!0,m.call(this,B._listeners.length,K))):B._listeners=E,!0;return!0}function H(y,E,A,T){for(var b=d(y),v=b.length,k,x,R,B=y._listeners,K;v-- >0;)x=b[v],k=y[x],x==="_listeners"?R=A:R=A?A.concat(x):[x],K=T||typeof x=="symbol",B&&E.push(K?R:R.join(this.delimiter)),typeof k=="object"&&H.call(this,k,E,R,K);return E}function $(y){for(var E=d(y),A=E.length,T,b,v;A-- >0;)b=E[A],T=y[b],T&&(v=!0,b!=="_listeners"&&!$(T)&&delete y[b]);return v}function O(y,E,A){this.emitter=y,this.event=E,this.listener=A}O.prototype.off=function(){return this.emitter.off(this.event,this.listener),this};function M(y,E,A){if(A===!0)b=!0;else if(A===!1)T=!0;else{if(!A||typeof A!="object")throw TypeError("options should be an object or true");var T=A.async,b=A.promisify,v=A.nextTick,k=A.objectify}if(T||v||b){var x=E,R=E._origin||E;if(v&&!c)throw Error("process.nextTick is not supported");b===n&&(b=E.constructor.name==="AsyncFunction"),E=function(){var B=arguments,K=this,z=this.event;return b?v?Promise.resolve():new Promise(function(V){u(V)}).then(function(){return K.event=z,x.apply(K,B)}):(v?process.nextTick:u)(function(){K.event=z,x.apply(K,B)})},E._async=!0,E._origin=R}return[E,k?new O(this,y,E):this]}function S(y){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,f.call(this,y)}S.EventEmitter2=S,S.prototype.listenTo=function(y,E,A){if(typeof y!="object")throw TypeError("target musts be an object");var T=this;A=C(A,{on:n,off:n,reducers:n},{on:L,off:L,reducers:U});function b(v){if(typeof v!="object")throw TypeError("events must be an object");var k=A.reducers,x=F.call(T,y),R;x===-1?R=new p(T,y,A):R=T._observers[x];for(var B=d(v),K=B.length,z,V=typeof k=="function",Z=0;Z<K;Z++)z=B[Z],R.subscribe(z,v[z]||z,V?k:k&&k[z])}return i(E)?b(w(E)):b(typeof E=="string"?w(E.split(/\s+/)):E),this},S.prototype.stopListeningTo=function(y,E){var A=this._observers;if(!A)return!1;var T=A.length,b,v=!1;if(y&&typeof y!="object")throw TypeError("target should be an object");for(;T-- >0;)b=A[T],(!y||b._target===y)&&(b.unsubscribe(E),v=!0);return v},S.prototype.delimiter=".",S.prototype.setMaxListeners=function(y){y!==n&&(this._maxListeners=y,this._conf||(this._conf={}),this._conf.maxListeners=y)},S.prototype.getMaxListeners=function(){return this._maxListeners},S.prototype.event="",S.prototype.once=function(y,E,A){return this._once(y,E,!1,A)},S.prototype.prependOnceListener=function(y,E,A){return this._once(y,E,!0,A)},S.prototype._once=function(y,E,A,T){return this._many(y,1,E,A,T)},S.prototype.many=function(y,E,A,T){return this._many(y,E,A,!1,T)},S.prototype.prependMany=function(y,E,A,T){return this._many(y,E,A,!0,T)},S.prototype._many=function(y,E,A,T,b){var v=this;if(typeof A!="function")throw new Error("many only accepts instances of Function");function k(){return--E===0&&v.off(y,k),A.apply(this,arguments)}return k._origin=A,this._on(y,k,T,b)},S.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||h.call(this);var y=arguments[0],E,A=this.wildcard,T,b,v,k,x;if(y==="newListener"&&!this._newListener&&!this._events.newListener)return!1;if(A&&(E=y,y!=="newListener"&&y!=="removeListener"&&typeof y=="object")){if(b=y.length,s){for(v=0;v<b;v++)if(typeof y[v]=="symbol"){x=!0;break}}x||(y=y.join(this.delimiter))}var R=arguments.length,B;if(this._all&&this._all.length)for(B=this._all.slice(),v=0,b=B.length;v<b;v++)switch(this.event=y,R){case 1:B[v].call(this,y);break;case 2:B[v].call(this,y,arguments[1]);break;case 3:B[v].call(this,y,arguments[1],arguments[2]);break;default:B[v].apply(this,arguments)}if(A)B=[],D.call(this,B,E,this.listenerTree,0,b);else if(B=this._events[y],typeof B=="function"){switch(this.event=y,R){case 1:B.call(this);break;case 2:B.call(this,arguments[1]);break;case 3:B.call(this,arguments[1],arguments[2]);break;default:for(T=new Array(R-1),k=1;k<R;k++)T[k-1]=arguments[k];B.apply(this,T)}return!0}else B&&(B=B.slice());if(B&&B.length){if(R>3)for(T=new Array(R-1),k=1;k<R;k++)T[k-1]=arguments[k];for(v=0,b=B.length;v<b;v++)switch(this.event=y,R){case 1:B[v].call(this);break;case 2:B[v].call(this,arguments[1]);break;case 3:B[v].call(this,arguments[1],arguments[2]);break;default:B[v].apply(this,T)}return!0}else if(!this.ignoreErrors&&!this._all&&y==="error")throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");return!!this._all},S.prototype.emitAsync=function(){if(!this._events&&!this._all)return!1;this._events||h.call(this);var y=arguments[0],E=this.wildcard,A,T,b,v,k,x;if(y==="newListener"&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);if(E&&(A=y,y!=="newListener"&&y!=="removeListener"&&typeof y=="object")){if(v=y.length,s){for(k=0;k<v;k++)if(typeof y[k]=="symbol"){T=!0;break}}T||(y=y.join(this.delimiter))}var R=[],B=arguments.length,K;if(this._all)for(k=0,v=this._all.length;k<v;k++)switch(this.event=y,B){case 1:R.push(this._all[k].call(this,y));break;case 2:R.push(this._all[k].call(this,y,arguments[1]));break;case 3:R.push(this._all[k].call(this,y,arguments[1],arguments[2]));break;default:R.push(this._all[k].apply(this,arguments))}if(E?(K=[],D.call(this,K,A,this.listenerTree,0)):K=this._events[y],typeof K=="function")switch(this.event=y,B){case 1:R.push(K.call(this));break;case 2:R.push(K.call(this,arguments[1]));break;case 3:R.push(K.call(this,arguments[1],arguments[2]));break;default:for(b=new Array(B-1),x=1;x<B;x++)b[x-1]=arguments[x];R.push(K.apply(this,b))}else if(K&&K.length){if(K=K.slice(),B>3)for(b=new Array(B-1),x=1;x<B;x++)b[x-1]=arguments[x];for(k=0,v=K.length;k<v;k++)switch(this.event=y,B){case 1:R.push(K[k].call(this));break;case 2:R.push(K[k].call(this,arguments[1]));break;case 3:R.push(K[k].call(this,arguments[1],arguments[2]));break;default:R.push(K[k].apply(this,b))}}else if(!this.ignoreErrors&&!this._all&&y==="error")return arguments[1]instanceof Error?Promise.reject(arguments[1]):Promise.reject("Uncaught, unspecified 'error' event.");return Promise.all(R)},S.prototype.on=function(y,E,A){return this._on(y,E,!1,A)},S.prototype.prependListener=function(y,E,A){return this._on(y,E,!0,A)},S.prototype.onAny=function(y){return this._onAny(y,!1)},S.prototype.prependAny=function(y){return this._onAny(y,!0)},S.prototype.addListener=S.prototype.on,S.prototype._onAny=function(y,E){if(typeof y!="function")throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),E?this._all.unshift(y):this._all.push(y),this},S.prototype._on=function(y,E,A,T){if(typeof y=="function")return this._onAny(y,E),this;if(typeof E!="function")throw new Error("on only accepts instances of Function");this._events||h.call(this);var b=this,v;return T!==n&&(v=M.call(this,y,E,T),E=v[0],b=v[1]),this._newListener&&this.emit("newListener",y,E),this.wildcard?(N.call(this,y,E,A),b):(this._events[y]?(typeof this._events[y]=="function"&&(this._events[y]=[this._events[y]]),A?this._events[y].unshift(E):this._events[y].push(E),!this._events[y].warned&&this._maxListeners>0&&this._events[y].length>this._maxListeners&&(this._events[y].warned=!0,m.call(this,this._events[y].length,y))):this._events[y]=E,b)},S.prototype.off=function(y,E){if(typeof E!="function")throw new Error("removeListener only takes instances of Function");var A,T=[];if(this.wildcard){var b=typeof y=="string"?y.split(this.delimiter):y.slice();if(T=D.call(this,null,b,this.listenerTree,0),!T)return this}else{if(!this._events[y])return this;A=this._events[y],T.push({_listeners:A})}for(var v=0;v<T.length;v++){var k=T[v];if(A=k._listeners,i(A)){for(var x=-1,R=0,B=A.length;R<B;R++)if(A[R]===E||A[R].listener&&A[R].listener===E||A[R]._origin&&A[R]._origin===E){x=R;break}if(x<0)continue;return this.wildcard?k._listeners.splice(x,1):this._events[y].splice(x,1),A.length===0&&(this.wildcard?delete k._listeners:delete this._events[y]),this._removeListener&&this.emit("removeListener",y,E),this}else(A===E||A.listener&&A.listener===E||A._origin&&A._origin===E)&&(this.wildcard?delete k._listeners:delete this._events[y],this._removeListener&&this.emit("removeListener",y,E))}return this.listenerTree&&$(this.listenerTree),this},S.prototype.offAny=function(y){var E=0,A=0,T;if(y&&this._all&&this._all.length>0){for(T=this._all,E=0,A=T.length;E<A;E++)if(y===T[E])return T.splice(E,1),this._removeListener&&this.emit("removeListenerAny",y),this}else{if(T=this._all,this._removeListener)for(E=0,A=T.length;E<A;E++)this.emit("removeListenerAny",T[E]);this._all=[]}return this},S.prototype.removeListener=S.prototype.off,S.prototype.removeAllListeners=function(y){if(y===n)return!this._events||h.call(this),this;if(this.wildcard){var E=D.call(this,null,y,this.listenerTree,0),A,T;if(!E)return this;for(T=0;T<E.length;T++)A=E[T],A._listeners=null;this.listenerTree&&$(this.listenerTree)}else this._events&&(this._events[y]=null);return this},S.prototype.listeners=function(y){var E=this._events,A,T,b,v,k;if(y===n){if(this.wildcard)throw Error("event name required for wildcard emitter");if(!E)return[];for(A=d(E),v=A.length,b=[];v-- >0;)T=E[A[v]],typeof T=="function"?b.push(T):b.push.apply(b,T);return b}else{if(this.wildcard){if(k=this.listenerTree,!k)return[];var x=[],R=typeof y=="string"?y.split(this.delimiter):y.slice();return D.call(this,x,R,k,0),x}return E?(T=E[y],T?typeof T=="function"?[T]:T:[]):[]}},S.prototype.eventNames=function(y){var E=this._events;return this.wildcard?H.call(this,this.listenerTree,[],null,y):E?d(E):[]},S.prototype.listenerCount=function(y){return this.listeners(y).length},S.prototype.hasListeners=function(y){if(this.wildcard){var E=[],A=typeof y=="string"?y.split(this.delimiter):y.slice();return D.call(this,E,A,this.listenerTree,0),E.length>0}var T=this._events,b=this._all;return!!(b&&b.length||T&&(y===n?d(T).length:T[y]))},S.prototype.listenersAny=function(){return this._all?this._all:[]},S.prototype.waitFor=function(y,E){var A=this,T=typeof E;return T==="number"?E={timeout:E}:T==="function"&&(E={filter:E}),E=C(E,{timeout:0,filter:n,handleError:!1,Promise,overload:!1},{filter:L,Promise:_}),q(E.Promise,function(b,v,k){function x(){var R=E.filter;if(!(R&&!R.apply(A,arguments)))if(A.off(y,x),E.handleError){var B=arguments[0];B?v(B):b(g.apply(null,arguments).slice(1))}else b(g.apply(null,arguments))}k(function(){A.off(y,x)}),A._on(y,x,!1)},{timeout:E.timeout,overload:E.overload})};function I(y,E,A){A=C(A,{Promise,timeout:0,overload:!1},{Promise:_});var T=A.Promise;return q(T,function(b,v,k){var x;if(typeof y.addEventListener=="function"){x=function(){b(g.apply(null,arguments))},k(function(){y.removeEventListener(E,x)}),y.addEventListener(E,x,{once:!0});return}var R=function(){B&&y.removeListener("error",B),b(g.apply(null,arguments))},B;E!=="error"&&(B=function(K){y.removeListener(E,R),v(K)},y.once("error",B)),k(function(){B&&y.removeListener("error",B),y.removeListener(E,R)}),y.once(E,R)},{timeout:A.timeout,overload:A.overload})}var j=S.prototype;Object.defineProperties(S,{defaultMaxListeners:{get:function(){return j._maxListeners},set:function(y){if(typeof y!="number"||y<0||Number.isNaN(y))throw TypeError("n must be a non-negative number");j._maxListeners=y},enumerable:!0},once:{value:I,writable:!0,configurable:!0}}),Object.defineProperties(j,{_maxListeners:{value:o,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),t.exports=S})()})(Uo)),Uo.exports}var _o=ip();const op=ma(_o);var ri,sp=new Uint8Array(16);function ap(){if(!ri&&(ri=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!ri))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ri(sp)}const cp=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Os(t){return typeof t=="string"&&cp.test(t)}var Ke=[];for(var Ho=0;Ho<256;++Ho)Ke.push((Ho+256).toString(16).substr(1));function lp(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(Ke[t[e+0]]+Ke[t[e+1]]+Ke[t[e+2]]+Ke[t[e+3]]+"-"+Ke[t[e+4]]+Ke[t[e+5]]+"-"+Ke[t[e+6]]+Ke[t[e+7]]+"-"+Ke[t[e+8]]+Ke[t[e+9]]+"-"+Ke[t[e+10]]+Ke[t[e+11]]+Ke[t[e+12]]+Ke[t[e+13]]+Ke[t[e+14]]+Ke[t[e+15]]).toLowerCase();if(!Os(n))throw TypeError("Stringified UUID is invalid");return n}function yn(t,e,n){t=t||{};var r=t.random||(t.rng||ap)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,lp(r)}const jt=Object.create(null);jt.open="0";jt.close="1";jt.ping="2";jt.pong="3";jt.message="4";jt.upgrade="5";jt.noop="6";const Ti=Object.create(null);Object.keys(jt).forEach(t=>{Ti[jt[t]]=t});const Ps={type:"error",data:"parser error"},Iu=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Lu=typeof ArrayBuffer=="function",Nu=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,ga=({type:t,data:e},n,r)=>Iu&&e instanceof Blob?n?r(e):pc(e,r):Lu&&(e instanceof ArrayBuffer||Nu(e))?n?r(e):pc(new Blob([e]),r):r(jt[t]+(e||"")),pc=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)};function mc(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let Fo;function up(t,e){if(Iu&&t.data instanceof Blob)return t.data.arrayBuffer().then(mc).then(e);if(Lu&&(t.data instanceof ArrayBuffer||Nu(t.data)))return e(mc(t.data));ga(t,!1,n=>{Fo||(Fo=new TextEncoder),e(Fo.encode(n))})}const gc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Er=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<gc.length;t++)Er[gc.charCodeAt(t)]=t;const dp=t=>{let e=t.length*.75,n=t.length,r,i=0,o,c,s,a;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const l=new ArrayBuffer(e),u=new Uint8Array(l);for(r=0;r<n;r+=4)o=Er[t.charCodeAt(r)],c=Er[t.charCodeAt(r+1)],s=Er[t.charCodeAt(r+2)],a=Er[t.charCodeAt(r+3)],u[i++]=o<<2|c>>4,u[i++]=(c&15)<<4|s>>2,u[i++]=(s&3)<<6|a&63;return l},hp=typeof ArrayBuffer=="function",ya=(t,e)=>{if(typeof t!="string")return{type:"message",data:Du(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:fp(t.substring(1),e)}:Ti[n]?t.length>1?{type:Ti[n],data:t.substring(1)}:{type:Ti[n]}:Ps},fp=(t,e)=>{if(hp){const n=dp(t);return Du(n,e)}else return{base64:!0,data:t}},Du=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},Bu="",pp=(t,e)=>{const n=t.length,r=new Array(n);let i=0;t.forEach((o,c)=>{ga(o,!1,s=>{r[c]=s,++i===n&&e(r.join(Bu))})})},mp=(t,e)=>{const n=t.split(Bu),r=[];for(let i=0;i<n.length;i++){const o=ya(n[i],e);if(r.push(o),o.type==="error")break}return r};function gp(){return new TransformStream({transform(t,e){up(t,n=>{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const o=new DataView(i.buffer);o.setUint8(0,126),o.setUint16(1,r)}else{i=new Uint8Array(9);const o=new DataView(i.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(r))}t.data&&typeof t.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(n)})}})}let qo;function ii(t){return t.reduce((e,n)=>e+n.length,0)}function oi(t,e){if(t[0].length===e)return t.shift();const n=new Uint8Array(e);let r=0;for(let i=0;i<e;i++)n[i]=t[0][r++],r===t[0].length&&(t.shift(),r=0);return t.length&&r<t[0].length&&(t[0]=t[0].slice(r)),n}function yp(t,e){qo||(qo=new TextDecoder);const n=[];let r=0,i=-1,o=!1;return new TransformStream({transform(c,s){for(n.push(c);;){if(r===0){if(ii(n)<1)break;const a=oi(n,1);o=(a[0]&128)===128,i=a[0]&127,i<126?r=3:i===126?r=1:r=2}else if(r===1){if(ii(n)<2)break;const a=oi(n,2);i=new DataView(a.buffer,a.byteOffset,a.length).getUint16(0),r=3}else if(r===2){if(ii(n)<8)break;const a=oi(n,8),l=new DataView(a.buffer,a.byteOffset,a.length),u=l.getUint32(0);if(u>Math.pow(2,21)-1){s.enqueue(Ps);break}i=u*Math.pow(2,32)+l.getUint32(4),r=3}else{if(ii(n)<i)break;const a=oi(n,i);s.enqueue(ya(o?a:qo.decode(a),e)),r=0}if(i===0||i>t){s.enqueue(Ps);break}}}})}const $u=4;function Pe(t){if(t)return vp(t)}function vp(t){for(var e in Pe.prototype)t[e]=Pe.prototype[e];return t}Pe.prototype.on=Pe.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};Pe.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this};Pe.prototype.off=Pe.prototype.removeListener=Pe.prototype.removeAllListeners=Pe.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===e||r.fn===e){n.splice(i,1);break}return n.length===0&&delete this._callbacks["$"+t],this};Pe.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),n=this._callbacks["$"+t],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,e)}return this};Pe.prototype.emitReserved=Pe.prototype.emit;Pe.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};Pe.prototype.hasListeners=function(t){return!!this.listeners(t).length};const So=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0),vt=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),bp="arraybuffer";function Ku(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const wp=vt.setTimeout,Ep=vt.clearTimeout;function Co(t,e){e.useNativeTimers?(t.setTimeoutFn=wp.bind(vt),t.clearTimeoutFn=Ep.bind(vt)):(t.setTimeoutFn=vt.setTimeout.bind(vt),t.clearTimeoutFn=vt.clearTimeout.bind(vt))}const _p=1.33;function Sp(t){return typeof t=="string"?Cp(t):Math.ceil((t.byteLength||t.size)*_p)}function Cp(t){let e=0,n=0;for(let r=0,i=t.length;r<i;r++)e=t.charCodeAt(r),e<128?n+=1:e<2048?n+=2:e<55296||e>=57344?n+=3:(r++,n+=4);return n}function ju(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function kp(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function Ap(t){let e={},n=t.split("&");for(let r=0,i=n.length;r<i;r++){let o=n[r].split("=");e[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return e}class xp extends Error{constructor(e,n,r){super(e),this.description=n,this.context=r,this.type="TransportError"}}class va extends Pe{constructor(e){super(),this.writable=!1,Co(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,n,r){return super.emitReserved("error",new xp(e,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const n=ya(e,this.socket.binaryType);this.onPacket(n)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,n={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const n=kp(e);return n.length?"?"+n:""}}class Tp extends va{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const n=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};mp(e,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,pp(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=ju()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}}let Uu=!1;try{Uu=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Mp=Uu;function Rp(){}class Op extends Tp{constructor(e){if(super(e),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||r!==e.port}}doWrite(e,n){const r=this.request({method:"POST",data:e});r.on("success",n),r.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=e}}class Bt extends Pe{constructor(e,n,r){super(),this.createRequest=e,Co(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var e;const n=Ku(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=Bt.requestsCount++,Bt.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Rp,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Bt.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Bt.requestsCount=0;Bt.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",yc);else if(typeof addEventListener=="function"){const t="onpagehide"in vt?"pagehide":"unload";addEventListener(t,yc,!1)}}function yc(){for(let t in Bt.requests)Bt.requests.hasOwnProperty(t)&&Bt.requests[t].abort()}const Pp=(function(){const t=Hu({xdomain:!1});return t&&t.responseType!==null})();class Ip extends Op{constructor(e){super(e);const n=e&&e.forceBase64;this.supportsBinary=Pp&&!n}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Bt(Hu,this.uri(),e)}}function Hu(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Mp))return new XMLHttpRequest}catch{}if(!e)try{return new vt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Fu=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Lp extends va{get name(){return"websocket"}doOpen(){const e=this.uri(),n=this.opts.protocols,r=Fu?{}:Ku(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],i=n===e.length-1;ga(r,this.supportsBinary,o=>{try{this.doWrite(r,o)}catch{}i&&So(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=ju()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}}const zo=vt.WebSocket||vt.MozWebSocket;class Np extends Lp{createSocket(e,n,r){return Fu?new zo(e,n,r):n?new zo(e,n):new zo(e)}doWrite(e,n){this.ws.send(n)}}class Dp extends va{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const n=yp(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(n).getReader(),i=gp();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();const o=()=>{r.read().then(({done:s,value:a})=>{s||(this.onPacket(a),o())}).catch(s=>{})};o();const c={type:"open"};this.query.sid&&(c.data=`{"sid":"${this.query.sid}"}`),this._writer.write(c).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],i=n===e.length-1;this._writer.write(r).then(()=>{i&&So(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const Bp={websocket:Np,webtransport:Dp,polling:Ip},$p=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Kp=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Is(t){if(t.length>8e3)throw"URI too long";const e=t,n=t.indexOf("["),r=t.indexOf("]");n!=-1&&r!=-1&&(t=t.substring(0,n)+t.substring(n,r).replace(/:/g,";")+t.substring(r,t.length));let i=$p.exec(t||""),o={},c=14;for(;c--;)o[Kp[c]]=i[c]||"";return n!=-1&&r!=-1&&(o.source=e,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=jp(o,o.path),o.queryKey=Up(o,o.query),o}function jp(t,e){const n=/\/{2,9}/g,r=e.replace(n,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function Up(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}const Ls=typeof addEventListener=="function"&&typeof removeEventListener=="function",Mi=[];Ls&&addEventListener("offline",()=>{Mi.forEach(t=>t())},!1);class _n extends Pe{constructor(e,n){if(super(),this.binaryType=bp,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(n=e,e=null),e){const r=Is(e);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=Is(n.host).host);Co(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const i=r.prototype.name;this.transports.push(i),this._transportsByName[i]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Ap(this.opts.query)),Ls&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Mi.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=$u,n.transport=e,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&_n.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(e);n.open(),this.setTransport(n)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",_n.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=e.data,this._onError(n);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const i=this.writeBuffer[r].data;if(i&&(n+=Sp(i)),r>0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,So(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,n,r){return this._sendPacket("message",e,n,r),this}send(e,n,r){return this._sendPacket("message",e,n,r),this}_sendPacket(e,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const o={type:e,data:n,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}_onError(e){if(_n.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Ls&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=Mi.indexOf(this._offlineEventListener);r!==-1&&Mi.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this._prevBufferLen=0}}}_n.protocol=$u;class Hp extends _n{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let n=this.createTransport(e),r=!1;_n.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",d=>{if(!r)if(d.type==="pong"&&d.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;_n.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(u(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const h=new Error("probe error");h.transport=n.name,this.emitReserved("upgradeError",h)}}))};function o(){r||(r=!0,u(),n.close(),n=null)}const c=d=>{const h=new Error("probe error: "+d);h.transport=n.name,o(),this.emitReserved("upgradeError",h)};function s(){c("transport closed")}function a(){c("socket closed")}function l(d){n&&d.name!==n.name&&o()}const u=()=>{n.removeListener("open",i),n.removeListener("error",c),n.removeListener("close",s),this.off("close",a),this.off("upgrading",l)};n.once("open",i),n.once("error",c),n.once("close",s),this.once("close",a),this.once("upgrading",l),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const n=[];for(let r=0;r<e.length;r++)~this.transports.indexOf(e[r])&&n.push(e[r]);return n}}let Fp=class extends Hp{constructor(e,n={}){const r=typeof e=="object"?e:n;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(i=>Bp[i]).filter(i=>!!i)),super(e,r)}};function qp(t,e="",n){let r=t;n=n||typeof location<"u"&&location,t==null&&(t=n.protocol+"//"+n.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=n.protocol+t:t=n.host+t),/^(https?|wss?):\/\//.test(t)||(typeof n<"u"?t=n.protocol+"//"+t:t="https://"+t),r=Is(t)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const o=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+o+":"+r.port+e,r.href=r.protocol+"://"+o+(n&&n.port===r.port?"":":"+r.port),r}const zp=typeof ArrayBuffer=="function",Vp=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,qu=Object.prototype.toString,Wp=typeof Blob=="function"||typeof Blob<"u"&&qu.call(Blob)==="[object BlobConstructor]",Gp=typeof File=="function"||typeof File<"u"&&qu.call(File)==="[object FileConstructor]";function ba(t){return zp&&(t instanceof ArrayBuffer||Vp(t))||Wp&&t instanceof Blob||Gp&&t instanceof File}function Ri(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n<r;n++)if(Ri(t[n]))return!0;return!1}if(ba(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return Ri(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&Ri(t[n]))return!0;return!1}function Yp(t){const e=[],n=t.data,r=t;return r.data=Ns(n,e),r.attachments=e.length,{packet:r,buffers:e}}function Ns(t,e){if(!t)return t;if(ba(t)){const n={_placeholder:!0,num:e.length};return e.push(t),n}else if(Array.isArray(t)){const n=new Array(t.length);for(let r=0;r<t.length;r++)n[r]=Ns(t[r],e);return n}else if(typeof t=="object"&&!(t instanceof Date)){const n={};for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=Ns(t[r],e));return n}return t}function Zp(t,e){return t.data=Ds(t.data,e),delete t.attachments,t}function Ds(t,e){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]=Ds(t[n],e);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=Ds(t[n],e));return t}const Jp=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var be;(function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"})(be||(be={}));class Xp{constructor(e){this.replacer=e}encode(e){return(e.type===be.EVENT||e.type===be.ACK)&&Ri(e)?this.encodeAsBinary({type:e.type===be.EVENT?be.BINARY_EVENT:be.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let n=""+e.type;return(e.type===be.BINARY_EVENT||e.type===be.BINARY_ACK)&&(n+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(n+=e.nsp+","),e.id!=null&&(n+=e.id),e.data!=null&&(n+=JSON.stringify(e.data,this.replacer)),n}encodeAsBinary(e){const n=Yp(e),r=this.encodeAsString(n.packet),i=n.buffers;return i.unshift(r),i}}class wa extends Pe{constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof e=="function"?{reviver:e}:e)}add(e){let n;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(e);const r=n.type===be.BINARY_EVENT;r||n.type===be.BINARY_ACK?(n.type=r?be.EVENT:be.ACK,this.reconstructor=new Qp(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(ba(e)||e.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(e),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let n=0;const r={type:Number(e.charAt(0))};if(be[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===be.BINARY_EVENT||r.type===be.BINARY_ACK){const o=n+1;for(;e.charAt(++n)!=="-"&&n!=e.length;);const c=e.substring(o,n);if(c!=Number(c)||e.charAt(n)!=="-")throw new Error("Illegal attachments");const s=Number(c);if(!e0(s)||s<0)throw new Error("Illegal attachments");if(s>this.opts.maxAttachments)throw new Error("too many attachments");r.attachments=s}if(e.charAt(n+1)==="/"){const o=n+1;for(;++n&&!(e.charAt(n)===","||n===e.length););r.nsp=e.substring(o,n)}else r.nsp="/";const i=e.charAt(n+1);if(i!==""&&Number(i)==i){const o=n+1;for(;++n;){const c=e.charAt(n);if(c==null||Number(c)!=c){--n;break}if(n===e.length)break}r.id=Number(e.substring(o,n+1))}if(e.charAt(++n)){const o=this.tryParse(e.substr(n));if(wa.isPayloadValid(r.type,o))r.data=o;else throw new Error("invalid payload")}return r}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch{return!1}}static isPayloadValid(e,n){switch(e){case be.CONNECT:return vc(n);case be.DISCONNECT:return n===void 0;case be.CONNECT_ERROR:return typeof n=="string"||vc(n);case be.EVENT:case be.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&Jp.indexOf(n[0])===-1);case be.ACK:case be.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Qp{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const n=Zp(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const e0=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};function vc(t){return Object.prototype.toString.call(t)==="[object Object]"}const t0=Object.freeze(Object.defineProperty({__proto__:null,Decoder:wa,Encoder:Xp,get PacketType(){return be}},Symbol.toStringTag,{value:"Module"}));function _t(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const n0=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class zu extends Pe{constructor(e,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[_t(e,"open",this.onopen.bind(this)),_t(e,"packet",this.onpacket.bind(this)),_t(e,"error",this.onerror.bind(this)),_t(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...n){var r,i,o;if(n0.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(n.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const c={type:be.EVENT,data:n};if(c.options={},c.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const u=this.ids++,d=n.pop();this._registerAckCallback(u,d),c.id=u}const s=(i=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||i===void 0?void 0:i.writable,a=this.connected&&!(!((o=this.io.engine)===null||o===void 0)&&o._hasPingExpired());return this.flags.volatile&&!s||(a?(this.notifyOutgoingListeners(c),this.packet(c)):this.sendBuffer.push(c)),this.flags={},this}_registerAckCallback(e,n){var r;const i=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(i===void 0){this.acks[e]=n;return}const o=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let s=0;s<this.sendBuffer.length;s++)this.sendBuffer[s].id===e&&this.sendBuffer.splice(s,1);n.call(this,new Error("operation has timed out"))},i),c=(...s)=>{this.io.clearTimeoutFn(o),n.apply(this,s)};c.withError=!0,this.acks[e]=c}emitWithAck(e,...n){return new Promise((r,i)=>{const o=(c,s)=>c?i(c):r(s);o.withError=!0,n.push(o),this.emit(e,...n)})}_addToQueue(e){let n;typeof e[e.length-1]=="function"&&(n=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...o)=>(this._queue[0],i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...o)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!e||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:be.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(r=>String(r.id)===e)){const r=this.acks[e];delete this.acks[e],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case be.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case be.EVENT:case be.BINARY_EVENT:this.onevent(e);break;case be.ACK:case be.BINARY_ACK:this.onack(e);break;case be.DISCONNECT:this.ondisconnect();break;case be.CONNECT_ERROR:this.destroy();const r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){const n=e.data||[];e.id!=null&&n.push(this.ack(e.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:be.ACK,id:e,data:i}))}}onack(e){const n=this.acks[e.id];typeof n=="function"&&(delete this.acks[e.id],n.withError&&e.data.unshift(null),n.apply(this,e.data))}onconnect(e,n){this.id=e,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:be.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,e.data)}}}function dr(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}dr.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=(Math.floor(e*10)&1)==0?t-n:t+n}return Math.min(t,this.max)|0};dr.prototype.reset=function(){this.attempts=0};dr.prototype.setMin=function(t){this.ms=t};dr.prototype.setMax=function(t){this.max=t};dr.prototype.setJitter=function(t){this.jitter=t};class Bs extends Pe{constructor(e,n){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(n=e,e=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,Co(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new dr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const i=n.parser||t0;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var n;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(n=this.backoff)===null||n===void 0||n.setMin(e),this)}randomizationFactor(e){var n;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(n=this.backoff)===null||n===void 0||n.setJitter(e),this)}reconnectionDelayMax(e){var n;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(n=this.backoff)===null||n===void 0||n.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Fp(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=_t(n,"open",function(){r.onopen(),e&&e()}),o=s=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",s),e?e(s):this.maybeReconnectOnOpen()},c=_t(n,"error",o);if(this._timeout!==!1){const s=this._timeout,a=this.setTimeoutFn(()=>{i(),o(new Error("timeout")),n.close()},s);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}return this.subs.push(i),this.subs.push(c),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(_t(e,"ping",this.onping.bind(this)),_t(e,"data",this.ondata.bind(this)),_t(e,"error",this.onerror.bind(this)),_t(e,"close",this.onclose.bind(this)),_t(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(n){this.onclose("parse error",n)}}ondecoded(e){So(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,n){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new zu(this,e,n),this.nsps[e]=r),r}_destroy(e){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(e){const n=this.encoder.encode(e);for(let r=0;r<n.length;r++)this.engine.write(n[r],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const mr={};function Oi(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=qp(t,e.path||"/socket.io"),r=n.source,i=n.id,o=n.path,c=mr[i]&&o in mr[i].nsps,s=e.forceNew||e["force new connection"]||e.multiplex===!1||c;let a;return s?a=new Bs(r,e):(mr[i]||(mr[i]=new Bs(r,e)),a=mr[i]),n.query&&!e.query&&(e.query=n.queryKey),a.socket(n.path,e)}Object.assign(Oi,{Manager:Bs,Socket:zu,io:Oi,connect:Oi});function J(t,e,n,r){return new(n||(n=Promise))((function(i,o){function c(l){try{a(r.next(l))}catch(u){o(u)}}function s(l){try{a(r.throw(l))}catch(u){o(u)}}function a(l){var u;l.done?i(l.value):(u=l.value,u instanceof n?u:new n((function(d){d(u)}))).then(c,s)}a((r=r.apply(t,e||[])).next())}))}var Xe=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},Rt=[],mt=[],r0=typeof Uint8Array<"u"?Uint8Array:Array,Ea=!1;function Vu(){Ea=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0;e<64;++e)Rt[e]=t[e],mt[t.charCodeAt(e)]=e;mt[45]=62,mt[95]=63}function i0(t,e,n){for(var r,i,o=[],c=e;c<n;c+=3)r=(t[c]<<16)+(t[c+1]<<8)+t[c+2],o.push(Rt[(i=r)>>18&63]+Rt[i>>12&63]+Rt[i>>6&63]+Rt[63&i]);return o.join("")}function bc(t){var e;Ea||Vu();for(var n=t.length,r=n%3,i="",o=[],c=16383,s=0,a=n-r;s<a;s+=c)o.push(i0(t,s,s+c>a?a:s+c));return r===1?(e=t[n-1],i+=Rt[e>>2],i+=Rt[e<<4&63],i+="=="):r===2&&(e=(t[n-2]<<8)+t[n-1],i+=Rt[e>>10],i+=Rt[e>>4&63],i+=Rt[e<<2&63],i+="="),o.push(i),o.join("")}function si(t,e,n,r,i){var o,c,s=8*i-r-1,a=(1<<s)-1,l=a>>1,u=-7,d=n?i-1:0,h=n?-1:1,f=t[e+d];for(d+=h,o=f&(1<<-u)-1,f>>=-u,u+=s;u>0;o=256*o+t[e+d],d+=h,u-=8);for(c=o&(1<<-u)-1,o>>=-u,u+=r;u>0;c=256*c+t[e+d],d+=h,u-=8);if(o===0)o=1-l;else{if(o===a)return c?NaN:1/0*(f?-1:1);c+=Math.pow(2,r),o-=l}return(f?-1:1)*c*Math.pow(2,o-r)}function Wu(t,e,n,r,i,o){var c,s,a,l=8*o-i-1,u=(1<<l)-1,d=u>>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,m=r?1:-1,g=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,c=u):(c=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-c))<1&&(c--,a*=2),(e+=c+d>=1?h/a:h*Math.pow(2,1-d))*a>=2&&(c++,a/=2),c+d>=u?(s=0,c=u):c+d>=1?(s=(e*a-1)*Math.pow(2,i),c+=d):(s=e*Math.pow(2,d-1)*Math.pow(2,i),c=0));i>=8;t[n+f]=255&s,f+=m,s/=256,i-=8);for(c=c<<i|s,l+=i;l>0;t[n+f]=255&c,f+=m,c/=256,l-=8);t[n+f-m]|=128*g}var o0={}.toString,Gu=Array.isArray||function(t){return o0.call(t)=="[object Array]"};X.TYPED_ARRAY_SUPPORT=Xe.TYPED_ARRAY_SUPPORT===void 0||Xe.TYPED_ARRAY_SUPPORT;var s0=Yi();function Yi(){return X.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Yt(t,e){if(Yi()<e)throw new RangeError("Invalid typed array length");return X.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=X.prototype:(t===null&&(t=new X(e)),t.length=e),t}function X(t,e,n){if(!(X.TYPED_ARRAY_SUPPORT||this instanceof X))return new X(t,e,n);if(typeof t=="number"){if(typeof e=="string")throw new Error("If encoding is specified then the first argument must be a string");return $s(this,t)}return Yu(this,t,e,n)}function Yu(t,e,n,r){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer?(function(i,o,c,s){if(o.byteLength,c<0||o.byteLength<c)throw new RangeError("'offset' is out of bounds");if(o.byteLength<c+(s||0))throw new RangeError("'length' is out of bounds");return o=c===void 0&&s===void 0?new Uint8Array(o):s===void 0?new Uint8Array(o,c):new Uint8Array(o,c,s),X.TYPED_ARRAY_SUPPORT?(i=o).__proto__=X.prototype:i=Vo(i,o),i})(t,e,n,r):typeof e=="string"?(function(i,o,c){if(typeof c=="string"&&c!==""||(c="utf8"),!X.isEncoding(c))throw new TypeError('"encoding" must be a valid string encoding');var s=0|Ju(o,c);i=Yt(i,s);var a=i.write(o,c);return a!==s&&(i=i.slice(0,a)),i})(t,e,n):(function(i,o){if(Ot(o)){var c=0|_a(o.length);return(i=Yt(i,c)).length===0||o.copy(i,0,0,c),i}if(o){if(typeof ArrayBuffer<"u"&&o.buffer instanceof ArrayBuffer||"length"in o)return typeof o.length!="number"||(s=o.length)!=s?Yt(i,0):Vo(i,o);if(o.type==="Buffer"&&Gu(o.data))return Vo(i,o.data)}var s;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")})(t,e)}function Zu(t){if(typeof t!="number")throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function $s(t,e){if(Zu(e),t=Yt(t,e<0?0:0|_a(e)),!X.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function Vo(t,e){var n=e.length<0?0:0|_a(e.length);t=Yt(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function _a(t){if(t>=Yi())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Yi().toString(16)+" bytes");return 0|t}function Ot(t){return!(t==null||!t._isBuffer)}function Ju(t,e){if(Ot(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var n=t.length;if(n===0)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return Zi(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return td(t).length;default:if(r)return Zi(t).length;e=(""+e).toLowerCase(),r=!0}}function a0(t,e,n){var r=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return g0(this,e,n);case"utf8":case"utf-8":return Qu(this,e,n);case"ascii":return p0(this,e,n);case"latin1":case"binary":return m0(this,e,n);case"base64":return f0(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return y0(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function Tn(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function wc(t,e,n,r,i){if(t.length===0)return-1;if(typeof n=="string"?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if(typeof e=="string"&&(e=X.from(e,r)),Ot(e))return e.length===0?-1:Ec(t,e,n,r,i);if(typeof e=="number")return e&=255,X.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):Ec(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function Ec(t,e,n,r,i){var o,c=1,s=t.length,a=e.length;if(r!==void 0&&((r=String(r).toLowerCase())==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(t.length<2||e.length<2)return-1;c=2,s/=2,a/=2,n/=2}function l(f,m){return c===1?f[m]:f.readUInt16BE(m*c)}if(i){var u=-1;for(o=n;o<s;o++)if(l(t,o)===l(e,u===-1?0:o-u)){if(u===-1&&(u=o),o-u+1===a)return u*c}else u!==-1&&(o-=o-u),u=-1}else for(n+a>s&&(n=s-a),o=n;o>=0;o--){for(var d=!0,h=0;h<a;h++)if(l(t,o+h)!==l(e,h)){d=!1;break}if(d)return o}return-1}function c0(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var c=0;c<r;++c){var s=parseInt(e.substr(2*c,2),16);if(isNaN(s))return c;t[n+c]=s}return c}function l0(t,e,n,r){return ko(Zi(e,t.length-n),t,n,r)}function Xu(t,e,n,r){return ko((function(i){for(var o=[],c=0;c<i.length;++c)o.push(255&i.charCodeAt(c));return o})(e),t,n,r)}function u0(t,e,n,r){return Xu(t,e,n,r)}function d0(t,e,n,r){return ko(td(e),t,n,r)}function h0(t,e,n,r){return ko((function(i,o){for(var c,s,a,l=[],u=0;u<i.length&&!((o-=2)<0);++u)s=(c=i.charCodeAt(u))>>8,a=c%256,l.push(a),l.push(s);return l})(e,t.length-n),t,n,r)}function f0(t,e,n){return e===0&&n===t.length?bc(t):bc(t.slice(e,n))}function Qu(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var o,c,s,a,l=t[i],u=null,d=l>239?4:l>223?3:l>191?2:1;if(i+d<=n)switch(d){case 1:l<128&&(u=l);break;case 2:(192&(o=t[i+1]))==128&&(a=(31&l)<<6|63&o)>127&&(u=a);break;case 3:o=t[i+1],c=t[i+2],(192&o)==128&&(192&c)==128&&(a=(15&l)<<12|(63&o)<<6|63&c)>2047&&(a<55296||a>57343)&&(u=a);break;case 4:o=t[i+1],c=t[i+2],s=t[i+3],(192&o)==128&&(192&c)==128&&(192&s)==128&&(a=(15&l)<<18|(63&o)<<12|(63&c)<<6|63&s)>65535&&a<1114112&&(u=a)}u===null?(u=65533,d=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),i+=d}return(function(h){var f=h.length;if(f<=_c)return String.fromCharCode.apply(String,h);for(var m="",g=0;g<f;)m+=String.fromCharCode.apply(String,h.slice(g,g+=_c));return m})(r)}X.poolSize=8192,X._augment=function(t){return t.__proto__=X.prototype,t},X.from=function(t,e,n){return Yu(null,t,e,n)},X.TYPED_ARRAY_SUPPORT&&(X.prototype.__proto__=Uint8Array.prototype,X.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&X[Symbol.species]),X.alloc=function(t,e,n){return(function(r,i,o,c){return Zu(i),i<=0?Yt(r,i):o!==void 0?typeof c=="string"?Yt(r,i).fill(o,c):Yt(r,i).fill(o):Yt(r,i)})(null,t,e,n)},X.allocUnsafe=function(t){return $s(null,t)},X.allocUnsafeSlow=function(t){return $s(null,t)},X.isBuffer=nd,X.compare=function(t,e){if(!Ot(t)||!Ot(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},X.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},X.concat=function(t,e){if(!Gu(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return X.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=X.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){var o=t[n];if(!Ot(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},X.byteLength=Ju,X.prototype._isBuffer=!0,X.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)Tn(this,e,e+1);return this},X.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)Tn(this,e,e+3),Tn(this,e+1,e+2);return this},X.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)Tn(this,e,e+7),Tn(this,e+1,e+6),Tn(this,e+2,e+5),Tn(this,e+3,e+4);return this},X.prototype.toString=function(){var t=0|this.length;return t===0?"":arguments.length===0?Qu(this,0,t):a0.apply(this,arguments)},X.prototype.equals=function(t){if(!Ot(t))throw new TypeError("Argument must be a Buffer");return this===t||X.compare(this,t)===0},X.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},X.prototype.compare=function(t,e,n,r,i){if(!Ot(t))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),n===void 0&&(n=t?t.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(r>>>=0),c=(n>>>=0)-(e>>>=0),s=Math.min(o,c),a=this.slice(r,i),l=t.slice(e,n),u=0;u<s;++u)if(a[u]!==l[u]){o=a[u],c=l[u];break}return o<c?-1:c<o?1:0},X.prototype.includes=function(t,e,n){return this.indexOf(t,e,n)!==-1},X.prototype.indexOf=function(t,e,n){return wc(this,t,e,n,!0)},X.prototype.lastIndexOf=function(t,e,n){return wc(this,t,e,n,!1)},X.prototype.write=function(t,e,n,r){if(e===void 0)r="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,r===void 0&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((n===void 0||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return c0(this,t,e,n);case"utf8":case"utf-8":return l0(this,t,e,n);case"ascii":return Xu(this,t,e,n);case"latin1":case"binary":return u0(this,t,e,n);case"base64":return d0(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return h0(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},X.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var _c=4096;function p0(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function m0(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function g0(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=e;o<n;++o)i+=b0(t[o]);return i}function y0(t,e,n){for(var r=t.slice(e,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function Le(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function Qe(t,e,n,r,i,o){if(!Ot(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function ai(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-n,2);i<o;++i)t[n+i]=(e&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function ci(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-n,4);i<o;++i)t[n+i]=e>>>8*(r?i:3-i)&255}function ed(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Sc(t,e,n,r,i){return i||ed(t,0,n,4),Wu(t,e,n,r,23,4),n+4}function Cc(t,e,n,r,i){return i||ed(t,0,n,8),Wu(t,e,n,r,52,8),n+8}X.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=e===void 0?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),X.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=X.prototype;else{var i=e-t;n=new X(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+t]}return n},X.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||Le(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r},X.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||Le(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},X.prototype.readUInt8=function(t,e){return e||Le(t,1,this.length),this[t]},X.prototype.readUInt16LE=function(t,e){return e||Le(t,2,this.length),this[t]|this[t+1]<<8},X.prototype.readUInt16BE=function(t,e){return e||Le(t,2,this.length),this[t]<<8|this[t+1]},X.prototype.readUInt32LE=function(t,e){return e||Le(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},X.prototype.readUInt32BE=function(t,e){return e||Le(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},X.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||Le(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*e)),r},X.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||Le(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},X.prototype.readInt8=function(t,e){return e||Le(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},X.prototype.readInt16LE=function(t,e){e||Le(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},X.prototype.readInt16BE=function(t,e){e||Le(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},X.prototype.readInt32LE=function(t,e){return e||Le(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},X.prototype.readInt32BE=function(t,e){return e||Le(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},X.prototype.readFloatLE=function(t,e){return e||Le(t,4,this.length),si(this,t,!0,23,4)},X.prototype.readFloatBE=function(t,e){return e||Le(t,4,this.length),si(this,t,!1,23,4)},X.prototype.readDoubleLE=function(t,e){return e||Le(t,8,this.length),si(this,t,!0,52,8)},X.prototype.readDoubleBE=function(t,e){return e||Le(t,8,this.length),si(this,t,!1,52,8)},X.prototype.writeUIntLE=function(t,e,n,r){t=+t,e|=0,n|=0,r||Qe(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},X.prototype.writeUIntBE=function(t,e,n,r){t=+t,e|=0,n|=0,r||Qe(this,t,e,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},X.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||Qe(this,t,e,1,255,0),X.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},X.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||Qe(this,t,e,2,65535,0),X.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):ai(this,t,e,!0),e+2},X.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||Qe(this,t,e,2,65535,0),X.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):ai(this,t,e,!1),e+2},X.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||Qe(this,t,e,4,4294967295,0),X.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):ci(this,t,e,!0),e+4},X.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||Qe(this,t,e,4,4294967295,0),X.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):ci(this,t,e,!1),e+4},X.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);Qe(this,t,e,n,i-1,-i)}var o=0,c=1,s=0;for(this[e]=255&t;++o<n&&(c*=256);)t<0&&s===0&&this[e+o-1]!==0&&(s=1),this[e+o]=(t/c>>0)-s&255;return e+n},X.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);Qe(this,t,e,n,i-1,-i)}var o=n-1,c=1,s=0;for(this[e+o]=255&t;--o>=0&&(c*=256);)t<0&&s===0&&this[e+o+1]!==0&&(s=1),this[e+o]=(t/c>>0)-s&255;return e+n},X.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||Qe(this,t,e,1,127,-128),X.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},X.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||Qe(this,t,e,2,32767,-32768),X.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):ai(this,t,e,!0),e+2},X.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||Qe(this,t,e,2,32767,-32768),X.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):ai(this,t,e,!1),e+2},X.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||Qe(this,t,e,4,2147483647,-2147483648),X.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):ci(this,t,e,!0),e+4},X.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||Qe(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),X.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):ci(this,t,e,!1),e+4},X.prototype.writeFloatLE=function(t,e,n){return Sc(this,t,e,!0,n)},X.prototype.writeFloatBE=function(t,e,n){return Sc(this,t,e,!1,n)},X.prototype.writeDoubleLE=function(t,e,n){return Cc(this,t,e,!0,n)},X.prototype.writeDoubleBE=function(t,e,n){return Cc(this,t,e,!1,n)},X.prototype.copy=function(t,e,n,r){if(n||(n=0),r||r===0||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i,o=r-n;if(this===t&&n<e&&e<r)for(i=o-1;i>=0;--i)t[i+e]=this[i+n];else if(o<1e3||!X.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+o),e);return o},X.prototype.fill=function(t,e,n,r){if(typeof t=="string"){if(typeof e=="string"?(r=e,e=0,n=this.length):typeof n=="string"&&(r=n,n=this.length),t.length===1){var i=t.charCodeAt(0);i<256&&(t=i)}if(r!==void 0&&typeof r!="string")throw new TypeError("encoding must be a string");if(typeof r=="string"&&!X.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else typeof t=="number"&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var o;if(e>>>=0,n=n===void 0?this.length:n>>>0,t||(t=0),typeof t=="number")for(o=e;o<n;++o)this[o]=t;else{var c=Ot(t)?t:Zi(new X(t,r).toString()),s=c.length;for(o=0;o<n-e;++o)this[o+e]=c[o%s]}return this};var v0=/[^+\/0-9A-Za-z-_]/g;function b0(t){return t<16?"0"+t.toString(16):t.toString(16)}function Zi(t,e){var n;e=e||1/0;for(var r=t.length,i=null,o=[],c=0;c<r;++c){if((n=t.charCodeAt(c))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(c+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function td(t){return(function(e){var n,r,i,o,c,s;Ea||Vu();var a=e.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");c=e[a-2]==="="?2:e[a-1]==="="?1:0,s=new r0(3*a/4-c),i=c>0?a-4:a;var l=0;for(n=0,r=0;n<i;n+=4,r+=3)o=mt[e.charCodeAt(n)]<<18|mt[e.charCodeAt(n+1)]<<12|mt[e.charCodeAt(n+2)]<<6|mt[e.charCodeAt(n+3)],s[l++]=o>>16&255,s[l++]=o>>8&255,s[l++]=255&o;return c===2?(o=mt[e.charCodeAt(n)]<<2|mt[e.charCodeAt(n+1)]>>4,s[l++]=255&o):c===1&&(o=mt[e.charCodeAt(n)]<<10|mt[e.charCodeAt(n+1)]<<4|mt[e.charCodeAt(n+2)]>>2,s[l++]=o>>8&255,s[l++]=255&o),s})((function(e){if((e=(function(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")})(e).replace(v0,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e})(t))}function ko(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function nd(t){return t!=null&&(!!t._isBuffer||kc(t)||(function(e){return typeof e.readFloatLE=="function"&&typeof e.slice=="function"&&kc(e.slice(0,0))})(t))}function kc(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}var w0=Object.freeze({__proto__:null,Buffer:X,INSPECT_MAX_BYTES:50,SlowBuffer:function(t){return+t!=t&&(t=0),X.alloc(+t)},isBuffer:nd,kMaxLength:s0}),bt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ao(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Yr(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach((function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})})),n}var Wn={},ut={},ze={};function Ji(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`positive integer expected, not ${t}`)}function rd(t){if(typeof t!="boolean")throw new Error(`boolean expected, not ${t}`)}function id(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function Sa(t,...e){if(!id(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function od(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("hash must be wrapped by utils.wrapConstructor");Ji(t.outputLen),Ji(t.blockLen)}function sd(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function ad(t,e){Sa(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}Object.defineProperty(ze,"__esModule",{value:!0}),ze.isBytes=id,ze.number=Ji,ze.bool=rd,ze.bytes=Sa,ze.hash=od,ze.exists=sd,ze.output=ad;const E0={number:Ji,bool:rd,bytes:Sa,hash:od,exists:sd,output:ad};ze.default=E0,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.wrapCipher=t.Hash=t.nextTick=t.isLE=t.createView=t.u32=t.u16=t.u8=void 0,t.bytesToHex=r,t.hexToBytes=c,t.hexToNumber=s,t.bytesToNumberBE=function(d){return s(r(d))},t.numberToBytesBE=function(d,h){return c(d.toString(16).padStart(2*h,"0"))},t.asyncLoop=async function(d,h,f){let m=Date.now();for(let g=0;g<d;g++){f(g);const w=Date.now()-m;w>=0&&w<h||(await(0,t.nextTick)(),m+=w)}},t.utf8ToBytes=a,t.bytesToUtf8=function(d){return new TextDecoder().decode(d)},t.toBytes=function(d){if(typeof d=="string")d=a(d);else{if(!(0,e.isBytes)(d))throw new Error("Uint8Array expected, got "+typeof d);d=u(d)}return d},t.concatBytes=function(...d){let h=0;for(let m=0;m<d.length;m++){const g=d[m];(0,e.bytes)(g),h+=g.length}const f=new Uint8Array(h);for(let m=0,g=0;m<d.length;m++){const w=d[m];f.set(w,g),g+=w.length}return f},t.checkOpts=function(d,h){if(h==null||typeof h!="object")throw new Error("options must be defined");return Object.assign(d,h)},t.equalBytes=function(d,h){if(d.length!==h.length)return!1;let f=0;for(let m=0;m<d.length;m++)f|=d[m]^h[m];return f===0},t.setBigUint64=l,t.u64Lengths=function(d,h){const f=new Uint8Array(16),m=(0,t.createView)(f);return l(m,0,BigInt(h?h.length:0),!0),l(m,8,BigInt(d.length),!0),f},t.isAligned32=function(d){return d.byteOffset%4==0},t.copyBytes=u,t.clean=function(...d){for(let h=0;h<d.length;h++)d[h].fill(0)};const e=ze;if(t.u8=d=>new Uint8Array(d.buffer,d.byteOffset,d.byteLength),t.u16=d=>new Uint16Array(d.buffer,d.byteOffset,Math.floor(d.byteLength/2)),t.u32=d=>new Uint32Array(d.buffer,d.byteOffset,Math.floor(d.byteLength/4)),t.createView=d=>new DataView(d.buffer,d.byteOffset,d.byteLength),t.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,!t.isLE)throw new Error("Non little-endian hardware is not supported");const n=Array.from({length:256},((d,h)=>h.toString(16).padStart(2,"0")));function r(d){(0,e.bytes)(d);let h="";for(let f=0;f<d.length;f++)h+=n[d[f]];return h}const i={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function o(d){return d>=i._0&&d<=i._9?d-i._0:d>=i._A&&d<=i._F?d-(i._A-10):d>=i._a&&d<=i._f?d-(i._a-10):void 0}function c(d){if(typeof d!="string")throw new Error("hex string expected, got "+typeof d);const h=d.length,f=h/2;if(h%2)throw new Error("padded hex string expected, got unpadded hex of length "+h);const m=new Uint8Array(f);for(let g=0,w=0;g<f;g++,w+=2){const p=o(d.charCodeAt(w)),C=o(d.charCodeAt(w+1));if(p===void 0||C===void 0){const _=d[w]+d[w+1];throw new Error('hex string expected, got non-hex character "'+_+'" at index '+w)}m[g]=16*p+C}return m}function s(d){if(typeof d!="string")throw new Error("hex string expected, got "+typeof d);return BigInt(d===""?"0":`0x${d}`)}function a(d){if(typeof d!="string")throw new Error("string expected, got "+typeof d);return new Uint8Array(new TextEncoder().encode(d))}t.nextTick=async()=>{},t.Hash=class{};function l(d,h,f,m){if(typeof d.setBigUint64=="function")return d.setBigUint64(h,f,m);const g=BigInt(32),w=BigInt(4294967295),p=Number(f>>g&w),C=Number(f&w),_=m?4:0,P=m?0:4;d.setUint32(h+_,p,m),d.setUint32(h+P,C,m)}function u(d){return Uint8Array.from(d)}t.wrapCipher=(d,h)=>(Object.assign(h,d),h)})(ut);var Lr={},Ne={};Object.defineProperty(Ne,"__esModule",{value:!0}),Ne.AEAD_TAG_LENGTH=Ne.XCHACHA20_NONCE_LENGTH=Ne.CURVE25519_PUBLIC_KEY_SIZE=Ne.ETH_PUBLIC_KEY_SIZE=Ne.UNCOMPRESSED_PUBLIC_KEY_SIZE=Ne.COMPRESSED_PUBLIC_KEY_SIZE=Ne.SECRET_KEY_LENGTH=void 0,Ne.SECRET_KEY_LENGTH=32,Ne.COMPRESSED_PUBLIC_KEY_SIZE=33,Ne.UNCOMPRESSED_PUBLIC_KEY_SIZE=65,Ne.ETH_PUBLIC_KEY_SIZE=64,Ne.CURVE25519_PUBLIC_KEY_SIZE=32,Ne.XCHACHA20_NONCE_LENGTH=24,Ne.AEAD_TAG_LENGTH=16,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ephemeralKeySize=t.symmetricNonceLength=t.symmetricAlgorithm=t.isHkdfKeyCompressed=t.isEphemeralKeyCompressed=t.ellipticCurve=t.ECIES_CONFIG=void 0;var e=Ne,n=function(){this.ellipticCurve="secp256k1",this.isEphemeralKeyCompressed=!1,this.isHkdfKeyCompressed=!1,this.symmetricAlgorithm="aes-256-gcm",this.symmetricNonceLength=16};t.ECIES_CONFIG=new n,t.ellipticCurve=function(){return t.ECIES_CONFIG.ellipticCurve},t.isEphemeralKeyCompressed=function(){return t.ECIES_CONFIG.isEphemeralKeyCompressed},t.isHkdfKeyCompressed=function(){return t.ECIES_CONFIG.isHkdfKeyCompressed},t.symmetricAlgorithm=function(){return t.ECIES_CONFIG.symmetricAlgorithm},t.symmetricNonceLength=function(){return t.ECIES_CONFIG.symmetricNonceLength},t.ephemeralKeySize=function(){var r={secp256k1:t.ECIES_CONFIG.isEphemeralKeyCompressed?e.COMPRESSED_PUBLIC_KEY_SIZE:e.UNCOMPRESSED_PUBLIC_KEY_SIZE,x25519:e.CURVE25519_PUBLIC_KEY_SIZE,ed25519:e.CURVE25519_PUBLIC_KEY_SIZE};if(t.ECIES_CONFIG.ellipticCurve in r)return r[t.ECIES_CONFIG.ellipticCurve];throw new Error("Not implemented")}})(Lr);var Wo={},Xi={},xo={},cd={},Ca={},li={};Object.defineProperty(li,"__esModule",{value:!0}),li.crypto=void 0,li.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.gcm=t.ctr=t.cbc=t.utils=void 0,t.randomBytes=i,t.getWebcryptoSubtle=o,t.managedNonce=function(a){return(0,n.number)(a.nonceLength),(l,...u)=>({encrypt(d,...h){const{nonceLength:f}=a,m=i(f),g=a(l,m,...u).encrypt(d,...h),w=(0,r.concatBytes)(m,g);return g.fill(0),w},decrypt(d,...h){const{nonceLength:f}=a,m=d.subarray(0,f),g=d.subarray(f);return a(l,m,...u).decrypt(g,...h)}})};const e=li,n=ze,r=ut;function i(a=32){if(e.crypto&&typeof e.crypto.getRandomValues=="function")return e.crypto.getRandomValues(new Uint8Array(a));if(e.crypto&&typeof e.crypto.randomBytes=="function")return e.crypto.randomBytes(a);throw new Error("crypto.getRandomValues must be defined")}function o(){if(e.crypto&&typeof e.crypto.subtle=="object"&&e.crypto.subtle!=null)return e.crypto.subtle;throw new Error("crypto.subtle must be defined")}t.utils={async encrypt(a,l,u,d){const h=o(),f=await h.importKey("raw",a,l,!0,["encrypt"]),m=await h.encrypt(u,f,d);return new Uint8Array(m)},async decrypt(a,l,u,d){const h=o(),f=await h.importKey("raw",a,l,!0,["decrypt"]),m=await h.decrypt(u,f,d);return new Uint8Array(m)}};const c={CBC:"AES-CBC",CTR:"AES-CTR",GCM:"AES-GCM"};function s(a){return(l,u,d)=>{(0,n.bytes)(l),(0,n.bytes)(u);const h={name:a,length:8*l.length},f=(function(m,g,w){if(m===c.CBC)return{name:c.CBC,iv:g};if(m===c.CTR)return{name:c.CTR,counter:g,length:64};if(m===c.GCM)return w?{name:c.GCM,iv:g,additionalData:w}:{name:c.GCM,iv:g};throw new Error("unknown aes block mode")})(a,u,d);return{encrypt:m=>((0,n.bytes)(m),t.utils.encrypt(l,h,f,m)),decrypt:m=>((0,n.bytes)(m),t.utils.decrypt(l,h,f,m))}}}t.cbc=s(c.CBC),t.ctr=s(c.CTR),t.gcm=s(c.GCM)})(Ca);var ld={},De={},Zt={},ct={};function Qi(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`positive integer expected, not ${t}`)}function ud(t){if(typeof t!="boolean")throw new Error(`boolean expected, not ${t}`)}function dd(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function ka(t,...e){if(!dd(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function hd(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Qi(t.outputLen),Qi(t.blockLen)}function fd(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function pd(t,e){ka(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}Object.defineProperty(ct,"__esModule",{value:!0}),ct.isBytes=dd,ct.number=Qi,ct.bool=ud,ct.bytes=ka,ct.hash=hd,ct.exists=fd,ct.output=pd;const _0={number:Qi,bool:ud,bytes:ka,hash:hd,exists:fd,output:pd};ct.default=_0;var tn={},ui={};Object.defineProperty(ui,"__esModule",{value:!0}),ui.crypto=void 0,ui.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Hash=t.nextTick=t.byteSwapIfBE=t.byteSwap=t.isLE=t.rotl=t.rotr=t.createView=t.u32=t.u8=void 0,t.isBytes=function(l){return l instanceof Uint8Array||l!=null&&typeof l=="object"&&l.constructor.name==="Uint8Array"},t.byteSwap32=function(l){for(let u=0;u<l.length;u++)l[u]=(0,t.byteSwap)(l[u])},t.bytesToHex=function(l){(0,n.bytes)(l);let u="";for(let d=0;d<l.length;d++)u+=r[l[d]];return u},t.hexToBytes=function(l){if(typeof l!="string")throw new Error("hex string expected, got "+typeof l);const u=l.length,d=u/2;if(u%2)throw new Error("padded hex string expected, got unpadded hex of length "+u);const h=new Uint8Array(d);for(let f=0,m=0;f<d;f++,m+=2){const g=o(l.charCodeAt(m)),w=o(l.charCodeAt(m+1));if(g===void 0||w===void 0){const p=l[m]+l[m+1];throw new Error('hex string expected, got non-hex character "'+p+'" at index '+m)}h[f]=16*g+w}return h},t.asyncLoop=async function(l,u,d){let h=Date.now();for(let f=0;f<l;f++){d(f);const m=Date.now()-h;m>=0&&m<u||(await(0,t.nextTick)(),h+=m)}},t.utf8ToBytes=c,t.toBytes=s,t.concatBytes=function(...l){let u=0;for(let h=0;h<l.length;h++){const f=l[h];(0,n.bytes)(f),u+=f.length}const d=new Uint8Array(u);for(let h=0,f=0;h<l.length;h++){const m=l[h];d.set(m,f),f+=m.length}return d},t.checkOpts=function(l,u){if(u!==void 0&&a.call(u)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(l,u)},t.wrapConstructor=function(l){const u=h=>l().update(s(h)).digest(),d=l();return u.outputLen=d.outputLen,u.blockLen=d.blockLen,u.create=()=>l(),u},t.wrapConstructorWithOpts=function(l){const u=(h,f)=>l(f).update(s(h)).digest(),d=l({});return u.outputLen=d.outputLen,u.blockLen=d.blockLen,u.create=h=>l(h),u},t.wrapXOFConstructorWithOpts=function(l){const u=(h,f)=>l(f).update(s(h)).digest(),d=l({});return u.outputLen=d.outputLen,u.blockLen=d.blockLen,u.create=h=>l(h),u},t.randomBytes=function(l=32){if(e.crypto&&typeof e.crypto.getRandomValues=="function")return e.crypto.getRandomValues(new Uint8Array(l));if(e.crypto&&typeof e.crypto.randomBytes=="function")return e.crypto.randomBytes(l);throw new Error("crypto.getRandomValues must be defined")};const e=ui,n=ct;t.u8=l=>new Uint8Array(l.buffer,l.byteOffset,l.byteLength),t.u32=l=>new Uint32Array(l.buffer,l.byteOffset,Math.floor(l.byteLength/4)),t.createView=l=>new DataView(l.buffer,l.byteOffset,l.byteLength),t.rotr=(l,u)=>l<<32-u|l>>>u,t.rotl=(l,u)=>l<<u|l>>>32-u>>>0,t.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,t.byteSwap=l=>l<<24&4278190080|l<<8&16711680|l>>>8&65280|l>>>24&255,t.byteSwapIfBE=t.isLE?l=>l:l=>(0,t.byteSwap)(l);const r=Array.from({length:256},((l,u)=>u.toString(16).padStart(2,"0"))),i={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function o(l){return l>=i._0&&l<=i._9?l-i._0:l>=i._A&&l<=i._F?l-(i._A-10):l>=i._a&&l<=i._f?l-(i._a-10):void 0}function c(l){if(typeof l!="string")throw new Error("utf8ToBytes expected string, got "+typeof l);return new Uint8Array(new TextEncoder().encode(l))}function s(l){return typeof l=="string"&&(l=c(l)),(0,n.bytes)(l),l}t.nextTick=async()=>{},t.Hash=class{clone(){return this._cloneInto()}};const a={}.toString})(tn),Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.HashMD=Zt.Maj=Zt.Chi=void 0;const Go=ct,gr=tn;Zt.Chi=(t,e,n)=>t&e^~t&n;Zt.Maj=(t,e,n)=>t&e^t&n^e&n;Zt.HashMD=class extends gr.Hash{constructor(t,e,n,r){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=(0,gr.createView)(this.buffer)}update(t){(0,Go.exists)(this);const{view:e,buffer:n,blockLen:r}=this,i=(t=(0,gr.toBytes)(t)).length;for(let o=0;o<i;){const c=Math.min(r-this.pos,i-o);if(c!==r)n.set(t.subarray(o,o+c),this.pos),this.pos+=c,o+=c,this.pos===r&&(this.process(e,0),this.pos=0);else{const s=(0,gr.createView)(t);for(;r<=i-o;o+=r)this.process(s,o)}}return this.length+=t.length,this.roundClean(),this}digestInto(t){(0,Go.exists)(this),(0,Go.output)(t,this),this.finished=!0;const{buffer:e,view:n,blockLen:r,isLE:i}=this;let{pos:o}=this;e[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>r-o&&(this.process(n,0),o=0);for(let u=o;u<r;u++)e[u]=0;(function(u,d,h,f){if(typeof u.setBigUint64=="function")return u.setBigUint64(d,h,f);const m=BigInt(32),g=BigInt(4294967295),w=Number(h>>m&g),p=Number(h&g),C=f?4:0,_=f?0:4;u.setUint32(d+C,w,f),u.setUint32(d+_,p,f)})(n,r-8,BigInt(8*this.length),i),this.process(n,0);const c=(0,gr.createView)(t),s=this.outputLen;if(s%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const a=s/4,l=this.get();if(a>l.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<a;u++)c.setUint32(4*u,l[u],i)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:n,length:r,finished:i,destroyed:o,pos:c}=this;return t.length=r,t.pos=c,t.finished=i,t.destroyed=o,r%e&&t.buffer.set(n),t}};var pe={};Object.defineProperty(pe,"__esModule",{value:!0}),pe.add5L=pe.add5H=pe.add4H=pe.add4L=pe.add3H=pe.add3L=pe.rotlBL=pe.rotlBH=pe.rotlSL=pe.rotlSH=pe.rotr32L=pe.rotr32H=pe.rotrBL=pe.rotrBH=pe.rotrSL=pe.rotrSH=pe.shrSL=pe.shrSH=pe.toBig=void 0,pe.fromBig=Aa,pe.split=md,pe.add=Md;const di=BigInt(2**32-1),Ks=BigInt(32);function Aa(t,e=!1){return e?{h:Number(t&di),l:Number(t>>Ks&di)}:{h:0|Number(t>>Ks&di),l:0|Number(t&di)}}function md(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let i=0;i<t.length;i++){const{h:o,l:c}=Aa(t[i],e);[n[i],r[i]]=[o,c]}return[n,r]}const gd=(t,e)=>BigInt(t>>>0)<<Ks|BigInt(e>>>0);pe.toBig=gd;const yd=(t,e,n)=>t>>>n;pe.shrSH=yd;const vd=(t,e,n)=>t<<32-n|e>>>n;pe.shrSL=vd;const bd=(t,e,n)=>t>>>n|e<<32-n;pe.rotrSH=bd;const wd=(t,e,n)=>t<<32-n|e>>>n;pe.rotrSL=wd;const Ed=(t,e,n)=>t<<64-n|e>>>n-32;pe.rotrBH=Ed;const _d=(t,e,n)=>t>>>n-32|e<<64-n;pe.rotrBL=_d;const Sd=(t,e)=>e;pe.rotr32H=Sd;const Cd=(t,e)=>t;pe.rotr32L=Cd;const kd=(t,e,n)=>t<<n|e>>>32-n;pe.rotlSH=kd;const Ad=(t,e,n)=>e<<n|t>>>32-n;pe.rotlSL=Ad;const xd=(t,e,n)=>e<<n-32|t>>>64-n;pe.rotlBH=xd;const Td=(t,e,n)=>t<<n-32|e>>>64-n;function Md(t,e,n,r){const i=(e>>>0)+(r>>>0);return{h:t+n+(i/2**32|0)|0,l:0|i}}pe.rotlBL=Td;const Rd=(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0);pe.add3L=Rd;const Od=(t,e,n,r)=>e+n+r+(t/2**32|0)|0;pe.add3H=Od;const Pd=(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0);pe.add4L=Pd;const Id=(t,e,n,r,i)=>e+n+r+i+(t/2**32|0)|0;pe.add4H=Id;const Ld=(t,e,n,r,i)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(i>>>0);pe.add5L=Ld;const Nd=(t,e,n,r,i,o)=>e+n+r+i+o+(t/2**32|0)|0;pe.add5H=Nd;const S0={fromBig:Aa,split:md,toBig:gd,shrSH:yd,shrSL:vd,rotrSH:bd,rotrSL:wd,rotrBH:Ed,rotrBL:_d,rotr32H:Sd,rotr32L:Cd,rotlSH:kd,rotlSL:Ad,rotlBH:xd,rotlBL:Td,add:Md,add3L:Rd,add3H:Od,add4L:Pd,add4H:Id,add5H:Nd,add5L:Ld};pe.default=S0,Object.defineProperty(De,"__esModule",{value:!0}),De.sha384=De.sha512_256=De.sha512_224=De.sha512=De.SHA384=De.SHA512_256=De.SHA512_224=De.SHA512=void 0;const C0=Zt,ge=pe,hi=tn,[k0,A0]=ge.default.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((t=>BigInt(t)))),nn=new Uint32Array(80),rn=new Uint32Array(80);class Zr extends C0.HashMD{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:n,Bh:r,Bl:i,Ch:o,Cl:c,Dh:s,Dl:a,Eh:l,El:u,Fh:d,Fl:h,Gh:f,Gl:m,Hh:g,Hl:w}=this;return[e,n,r,i,o,c,s,a,l,u,d,h,f,m,g,w]}set(e,n,r,i,o,c,s,a,l,u,d,h,f,m,g,w){this.Ah=0|e,this.Al=0|n,this.Bh=0|r,this.Bl=0|i,this.Ch=0|o,this.Cl=0|c,this.Dh=0|s,this.Dl=0|a,this.Eh=0|l,this.El=0|u,this.Fh=0|d,this.Fl=0|h,this.Gh=0|f,this.Gl=0|m,this.Hh=0|g,this.Hl=0|w}process(e,n){for(let _=0;_<16;_++,n+=4)nn[_]=e.getUint32(n),rn[_]=e.getUint32(n+=4);for(let _=16;_<80;_++){const P=0|nn[_-15],L=0|rn[_-15],U=ge.default.rotrSH(P,L,1)^ge.default.rotrSH(P,L,8)^ge.default.shrSH(P,L,7),q=ge.default.rotrSL(P,L,1)^ge.default.rotrSL(P,L,8)^ge.default.shrSL(P,L,7),F=0|nn[_-2],D=0|rn[_-2],N=ge.default.rotrSH(F,D,19)^ge.default.rotrBH(F,D,61)^ge.default.shrSH(F,D,6),H=ge.default.rotrSL(F,D,19)^ge.default.rotrBL(F,D,61)^ge.default.shrSL(F,D,6),$=ge.default.add4L(q,H,rn[_-7],rn[_-16]),O=ge.default.add4H($,U,N,nn[_-7],nn[_-16]);nn[_]=0|O,rn[_]=0|$}let{Ah:r,Al:i,Bh:o,Bl:c,Ch:s,Cl:a,Dh:l,Dl:u,Eh:d,El:h,Fh:f,Fl:m,Gh:g,Gl:w,Hh:p,Hl:C}=this;for(let _=0;_<80;_++){const P=ge.default.rotrSH(d,h,14)^ge.default.rotrSH(d,h,18)^ge.default.rotrBH(d,h,41),L=ge.default.rotrSL(d,h,14)^ge.default.rotrSL(d,h,18)^ge.default.rotrBL(d,h,41),U=d&f^~d&g,q=h&m^~h&w,F=ge.default.add5L(C,L,q,A0[_],rn[_]),D=ge.default.add5H(F,p,P,U,k0[_],nn[_]),N=0|F,H=ge.default.rotrSH(r,i,28)^ge.default.rotrBH(r,i,34)^ge.default.rotrBH(r,i,39),$=ge.default.rotrSL(r,i,28)^ge.default.rotrBL(r,i,34)^ge.default.rotrBL(r,i,39),O=r&o^r&s^o&s,M=i&c^i&a^c&a;p=0|g,C=0|w,g=0|f,w=0|m,f=0|d,m=0|h,{h:d,l:h}=ge.default.add(0|l,0|u,0|D,0|N),l=0|s,u=0|a,s=0|o,a=0|c,o=0|r,c=0|i;const S=ge.default.add3L(N,$,M);r=ge.default.add3H(S,D,H,O),i=0|S}({h:r,l:i}=ge.default.add(0|this.Ah,0|this.Al,0|r,0|i)),{h:o,l:c}=ge.default.add(0|this.Bh,0|this.Bl,0|o,0|c),{h:s,l:a}=ge.default.add(0|this.Ch,0|this.Cl,0|s,0|a),{h:l,l:u}=ge.default.add(0|this.Dh,0|this.Dl,0|l,0|u),{h:d,l:h}=ge.default.add(0|this.Eh,0|this.El,0|d,0|h),{h:f,l:m}=ge.default.add(0|this.Fh,0|this.Fl,0|f,0|m),{h:g,l:w}=ge.default.add(0|this.Gh,0|this.Gl,0|g,0|w),{h:p,l:C}=ge.default.add(0|this.Hh,0|this.Hl,0|p,0|C),this.set(r,i,o,c,s,a,l,u,d,h,f,m,g,w,p,C)}roundClean(){nn.fill(0),rn.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}De.SHA512=Zr;class Dd extends Zr{constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}}De.SHA512_224=Dd;class Bd extends Zr{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}De.SHA512_256=Bd;class Ac extends Zr{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}De.SHA384=Ac,De.sha512=(0,hi.wrapConstructor)((()=>new Zr)),De.sha512_224=(0,hi.wrapConstructor)((()=>new Dd)),De.sha512_256=(0,hi.wrapConstructor)((()=>new Bd)),De.sha384=(0,hi.wrapConstructor)((()=>new Ac));var js={},Yn={},Ce={},ye={};Object.defineProperty(ye,"__esModule",{value:!0}),ye.notImplemented=ye.bitMask=void 0,ye.isBytes=eo,ye.abytes=to,ye.abool=function(t,e){if(typeof e!="boolean")throw new Error(`${t} must be valid boolean, got "${e}".`)},ye.bytesToHex=Yo,ye.numberToHexUnpadded=xc,ye.hexToNumber=Zo,ye.hexToBytes=Ii,ye.bytesToNumberBE=function(t){return Zo(Yo(t))},ye.bytesToNumberLE=function(t){return to(t),Zo(Yo(Uint8Array.from(t).reverse()))},ye.numberToBytesBE=Mc,ye.numberToBytesLE=function(t,e){return Mc(t,e).reverse()},ye.numberToVarBytesBE=function(t){return Ii(xc(t))},ye.ensureBytes=function(t,e,n){let r;if(typeof e=="string")try{r=Ii(e)}catch(o){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${o}`)}else{if(!eo(e))throw new Error(`${t} must be hex string or Uint8Array`);r=Uint8Array.from(e)}const i=r.length;if(typeof n=="number"&&i!==n)throw new Error(`${t} expected ${n} bytes, got ${i}`);return r},ye.concatBytes=Rc,ye.equalBytes=function(t,e){if(t.length!==e.length)return!1;let n=0;for(let r=0;r<t.length;r++)n|=t[r]^e[r];return n===0},ye.utf8ToBytes=function(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))},ye.inRange=Oc,ye.aInRange=function(t,e,n,r){if(!Oc(e,n,r))throw new Error(`expected valid ${t}: ${n} <= n < ${r}, got ${typeof e} ${e}`)},ye.bitLen=function(t){let e;for(e=0;t>Us;t>>=Pi,e+=1);return e},ye.bitGet=function(t,e){return t>>BigInt(e)&Pi},ye.bitSet=function(t,e,n){return t|(n?Pi:Us)<<BigInt(e)},ye.createHmacDrbg=function(t,e,n){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=Xo(t),i=Xo(t),o=0;const c=()=>{r.fill(1),i.fill(0),o=0},s=(...u)=>n(i,r,...u),a=(u=Xo())=>{i=s(Pc([0]),u),r=s(),u.length!==0&&(i=s(Pc([1]),u),r=s())},l=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let u=0;const d=[];for(;u<e;){r=s();const h=r.slice();d.push(h),u+=r.length}return Rc(...d)};return(u,d)=>{let h;for(c(),a(u);!(h=d(l()));)a();return c(),h}},ye.validateObject=function(t,e,n={}){const r=(i,o,c)=>{const s=M0[o];if(typeof s!="function")throw new Error(`Invalid validator "${o}", expected function`);const a=t[i];if(!(c&&a===void 0||s(a,t)))throw new Error(`Invalid param ${String(i)}=${a} (${typeof a}), expected ${o}`)};for(const[i,o]of Object.entries(e))r(i,o,!1);for(const[i,o]of Object.entries(n))r(i,o,!0);return t},ye.memoized=function(t){const e=new WeakMap;return(n,...r)=>{const i=e.get(n);if(i!==void 0)return i;const o=t(n,...r);return e.set(n,o),o}};const Us=BigInt(0),Pi=BigInt(1),x0=BigInt(2);function eo(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function to(t){if(!eo(t))throw new Error("Uint8Array expected")}const T0=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function Yo(t){to(t);let e="";for(let n=0;n<t.length;n++)e+=T0[t[n]];return e}function xc(t){const e=t.toString(16);return 1&e.length?`0${e}`:e}function Zo(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}const Ft={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function Tc(t){return t>=Ft._0&&t<=Ft._9?t-Ft._0:t>=Ft._A&&t<=Ft._F?t-(Ft._A-10):t>=Ft._a&&t<=Ft._f?t-(Ft._a-10):void 0}function Ii(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length,n=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(n);for(let i=0,o=0;i<n;i++,o+=2){const c=Tc(t.charCodeAt(o)),s=Tc(t.charCodeAt(o+1));if(c===void 0||s===void 0){const a=t[o]+t[o+1];throw new Error('hex string expected, got non-hex character "'+a+'" at index '+o)}r[i]=16*c+s}return r}function Mc(t,e){return Ii(t.toString(16).padStart(2*e,"0"))}function Rc(...t){let e=0;for(let r=0;r<t.length;r++){const i=t[r];to(i),e+=i.length}const n=new Uint8Array(e);for(let r=0,i=0;r<t.length;r++){const o=t[r];n.set(o,i),i+=o.length}return n}const Jo=t=>typeof t=="bigint"&&Us<=t;function Oc(t,e,n){return Jo(t)&&Jo(e)&&Jo(n)&&e<=t&&t<n}ye.bitMask=t=>(x0<<BigInt(t-1))-Pi;const Xo=t=>new Uint8Array(t),Pc=t=>Uint8Array.from(t),M0={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||eo(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};ye.notImplemented=()=>{throw new Error("not implemented")},Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.isNegativeLE=void 0,Ce.mod=st,Ce.pow=$d,Ce.pow2=function(t,e,n){let r=t;for(;e-- >Be;)r*=r,r%=n;return r},Ce.invert=fi,Ce.tonelliShanks=Kd,Ce.FpSqrt=Nc,Ce.validateField=function(t){const e=O0.reduce(((n,r)=>(n[r]="function",n)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"});return(0,it.validateObject)(t,e)},Ce.FpPow=Dc,Ce.FpInvertBatch=Bc,Ce.FpDiv=function(t,e,n){return t.mul(e,typeof n=="bigint"?fi(n,t.ORDER):t.inv(n))},Ce.FpLegendre=$c,Ce.FpIsSquare=function(t){const e=$c(t.ORDER);return n=>{const r=e(t,n);return t.eql(r,t.ZERO)||t.eql(r,t.ONE)}},Ce.nLength=Qo,Ce.Field=function(t,e,n=!1,r={}){if(t<=Be)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:o}=Qo(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const c=Nc(t),s=Object.freeze({ORDER:t,BITS:i,BYTES:o,MASK:(0,it.bitMask)(i),ZERO:Be,ONE:ke,create:a=>st(a,t),isValid:a=>{if(typeof a!="bigint")throw new Error("Invalid field element: expected bigint, got "+typeof a);return Be<=a&&a<t},is0:a=>a===Be,isOdd:a=>(a&ke)===ke,neg:a=>st(-a,t),eql:(a,l)=>a===l,sqr:a=>st(a*a,t),add:(a,l)=>st(a+l,t),sub:(a,l)=>st(a-l,t),mul:(a,l)=>st(a*l,t),pow:(a,l)=>Dc(s,a,l),div:(a,l)=>st(a*fi(l,t),t),sqrN:a=>a*a,addN:(a,l)=>a+l,subN:(a,l)=>a-l,mulN:(a,l)=>a*l,inv:a=>fi(a,t),sqrt:r.sqrt||(a=>c(s,a)),invertBatch:a=>Bc(s,a),cmov:(a,l,u)=>u?l:a,toBytes:a=>n?(0,it.numberToBytesLE)(a,o):(0,it.numberToBytesBE)(a,o),fromBytes:a=>{if(a.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${a.length}`);return n?(0,it.bytesToNumberLE)(a):(0,it.bytesToNumberBE)(a)}});return Object.freeze(s)},Ce.FpSqrtOdd=function(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const n=t.sqrt(e);return t.isOdd(n)?n:t.neg(n)},Ce.FpSqrtEven=function(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const n=t.sqrt(e);return t.isOdd(n)?t.neg(n):n},Ce.hashToPrivateScalar=function(t,e,n=!1){t=(0,it.ensureBytes)("privateHash",t);const r=t.length,i=Qo(e).nByteLength+8;if(i<24||r<i||r>1024)throw new Error(`hashToPrivateScalar: expected ${i}-1024 bytes of input, got ${r}`);const o=n?(0,it.bytesToNumberLE)(t):(0,it.bytesToNumberBE)(t);return st(o,e-ke)+ke},Ce.getFieldBytesLength=Fs,Ce.getMinHashLength=Kc,Ce.mapHashToField=function(t,e,n=!1){const r=t.length,i=Fs(e),o=Kc(e);if(r<16||r<o||r>1024)throw new Error(`expected ${o}-1024 bytes of input, got ${r}`);const c=st(n?(0,it.bytesToNumberBE)(t):(0,it.bytesToNumberLE)(t),e-ke)+ke;return n?(0,it.numberToBytesLE)(c,i):(0,it.numberToBytesBE)(c,i)};const it=ye,Be=BigInt(0),ke=BigInt(1),vn=BigInt(2),R0=BigInt(3),Hs=BigInt(4),Ic=BigInt(5),Lc=BigInt(8);function st(t,e){const n=t%e;return n>=Be?n:e+n}function $d(t,e,n){if(n<=Be||e<Be)throw new Error("Expected power/modulo > 0");if(n===ke)return Be;let r=ke;for(;e>Be;)e&ke&&(r=r*t%n),t=t*t%n,e>>=ke;return r}function fi(t,e){if(t===Be||e<=Be)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=st(t,e),r=e,i=Be,o=ke;for(;n!==Be;){const c=r%n,s=i-o*(r/n);r=n,n=c,i=o,o=s}if(r!==ke)throw new Error("invert: does not exist");return st(i,e)}function Kd(t){const e=(t-ke)/vn;let n,r,i;for(n=t-ke,r=0;n%vn===Be;n/=vn,r++);for(i=vn;i<t&&$d(i,e,t)!==t-ke;i++);if(r===1){const c=(t+ke)/Hs;return function(s,a){const l=s.pow(a,c);if(!s.eql(s.sqr(l),a))throw new Error("Cannot find square root");return l}}const o=(n+ke)/vn;return function(c,s){if(c.pow(s,e)===c.neg(c.ONE))throw new Error("Cannot find square root");let a=r,l=c.pow(c.mul(c.ONE,i),n),u=c.pow(s,o),d=c.pow(s,n);for(;!c.eql(d,c.ONE);){if(c.eql(d,c.ZERO))return c.ZERO;let h=1;for(let m=c.sqr(d);h<a&&!c.eql(m,c.ONE);h++)m=c.sqr(m);const f=c.pow(l,ke<<BigInt(a-h-1));l=c.sqr(f),u=c.mul(u,f),d=c.mul(d,l),a=h}return u}}function Nc(t){if(t%Hs===R0){const e=(t+ke)/Hs;return function(n,r){const i=n.pow(r,e);if(!n.eql(n.sqr(i),r))throw new Error("Cannot find square root");return i}}if(t%Lc===Ic){const e=(t-Ic)/Lc;return function(n,r){const i=n.mul(r,vn),o=n.pow(i,e),c=n.mul(r,o),s=n.mul(n.mul(c,vn),o),a=n.mul(c,n.sub(s,n.ONE));if(!n.eql(n.sqr(a),r))throw new Error("Cannot find square root");return a}}return Kd(t)}BigInt(9),BigInt(16);Ce.isNegativeLE=(t,e)=>(st(t,e)&ke)===ke;const O0=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Dc(t,e,n){if(n<Be)throw new Error("Expected power > 0");if(n===Be)return t.ONE;if(n===ke)return e;let r=t.ONE,i=e;for(;n>Be;)n&ke&&(r=t.mul(r,i)),i=t.sqr(i),n>>=ke;return r}function Bc(t,e){const n=new Array(e.length),r=e.reduce(((o,c,s)=>t.is0(c)?o:(n[s]=o,t.mul(o,c))),t.ONE),i=t.inv(r);return e.reduceRight(((o,c,s)=>t.is0(c)?o:(n[s]=t.mul(o,n[s]),t.mul(o,c))),i),n}function $c(t){const e=(t-ke)/vn;return(n,r)=>n.pow(r,e)}function Qo(t,e){const n=e!==void 0?e:t.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function Fs(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function Kc(t){const e=Fs(t);return e+Math.ceil(e/2)}Object.defineProperty(Yn,"__esModule",{value:!0}),Yn.wNAF=function(t,e){const n=(o,c)=>{const s=c.negate();return o?s:c},r=o=>{if(!Number.isSafeInteger(o)||o<=0||o>e)throw new Error(`Wrong window size=${o}, should be [1..${e}]`)},i=o=>(r(o),{windows:Math.ceil(e/o)+1,windowSize:2**(o-1)});return{constTimeNegate:n,unsafeLadder(o,c){let s=t.ZERO,a=o;for(;c>P0;)c&es&&(s=s.add(a)),a=a.double(),c>>=es;return s},precomputeWindow(o,c){const{windows:s,windowSize:a}=i(c),l=[];let u=o,d=u;for(let h=0;h<s;h++){d=u,l.push(d);for(let f=1;f<a;f++)d=d.add(u),l.push(d);u=d.double()}return l},wNAF(o,c,s){const{windows:a,windowSize:l}=i(o);let u=t.ZERO,d=t.BASE;const h=BigInt(2**o-1),f=2**o,m=BigInt(o);for(let g=0;g<a;g++){const w=g*l;let p=Number(s&h);s>>=m,p>l&&(p-=f,s+=es);const C=w,_=w+Math.abs(p)-1,P=g%2!=0,L=p<0;p===0?d=d.add(n(P,c[C])):u=u.add(n(L,c[_]))}return{p:u,f:d}},wNAFCached(o,c,s){const a=Hc.get(o)||1;let l=ts.get(o);return l||(l=this.precomputeWindow(o,a),a!==1&&ts.set(o,s(l))),this.wNAF(a,l,c)},setWindowSize(o,c){r(c),Hc.set(o,c),ts.delete(o)}}},Yn.pippenger=function(t,e,n,r){if(!Array.isArray(n)||!Array.isArray(r)||r.length!==n.length)throw new Error("arrays of points and scalars must have equal length");r.forEach(((u,d)=>{if(!e.isValid(u))throw new Error(`wrong scalar at index ${d}`)})),n.forEach(((u,d)=>{if(!(u instanceof t))throw new Error(`wrong point at index ${d}`)}));const i=(0,Uc.bitLen)(BigInt(n.length)),o=i>12?i-3:i>4?i-2:i?2:1,c=(1<<o)-1,s=new Array(c+1).fill(t.ZERO),a=Math.floor((e.BITS-1)/o)*o;let l=t.ZERO;for(let u=a;u>=0;u-=o){s.fill(t.ZERO);for(let h=0;h<r.length;h++){const f=r[h],m=Number(f>>BigInt(u)&BigInt(c));s[m]=s[m].add(n[h])}let d=t.ZERO;for(let h=s.length-1,f=t.ZERO;h>0;h--)f=f.add(s[h]),d=d.add(f);if(l=l.add(d),u!==0)for(let h=0;h<o;h++)l=l.double()}return l},Yn.validateBasic=function(t){return(0,jc.validateField)(t.Fp),(0,Uc.validateObject)(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,jc.nLength)(t.n,t.nBitLength),...t,p:t.Fp.ORDER})};const jc=Ce,Uc=ye,P0=BigInt(0),es=BigInt(1),ts=new WeakMap,Hc=new WeakMap;Object.defineProperty(js,"__esModule",{value:!0}),js.twistedEdwards=function(t){const e=(function(O){const M=(0,ns.validateBasic)(O);return et.validateObject(O,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...M})})(t),{Fp:n,n:r,prehash:i,hash:o,randomBytes:c,nByteLength:s,h:a}=e,l=pi<<BigInt(8*s)-tt,u=n.create,d=(0,Fc.Field)(e.n,e.nBitLength),h=e.uvRatio||((O,M)=>{try{return{isValid:!0,value:n.sqrt(O*n.inv(M))}}catch{return{isValid:!1,value:wt}}}),f=e.adjustScalarBytes||(O=>O),m=e.domain||((O,M,S)=>{if((0,ot.abool)("phflag",S),M.length||S)throw new Error("Contexts/pre-hash are not supported");return O});function g(O,M){et.aInRange("coordinate "+O,M,wt,l)}function w(O){if(!(O instanceof _))throw new Error("ExtendedPoint expected")}const p=(0,ot.memoized)(((O,M)=>{const{ex:S,ey:I,ez:j}=O,y=O.is0();M==null&&(M=y?I0:n.inv(j));const E=u(S*M),A=u(I*M),T=u(j*M);if(y)return{x:wt,y:tt};if(T!==tt)throw new Error("invZ was invalid");return{x:E,y:A}})),C=(0,ot.memoized)((O=>{const{a:M,d:S}=e;if(O.is0())throw new Error("bad point: ZERO");const{ex:I,ey:j,ez:y,et:E}=O,A=u(I*I),T=u(j*j),b=u(y*y),v=u(b*b),k=u(A*M);if(u(b*u(k+T))!==u(v+u(S*u(A*T))))throw new Error("bad point: equation left != right (1)");if(u(I*j)!==u(y*E))throw new Error("bad point: equation left != right (2)");return!0}));class _{constructor(M,S,I,j){this.ex=M,this.ey=S,this.ez=I,this.et=j,g("x",M),g("y",S),g("z",I),g("t",j),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(M){if(M instanceof _)throw new Error("extended point not allowed");const{x:S,y:I}=M||{};return g("x",S),g("y",I),new _(S,I,tt,u(S*I))}static normalizeZ(M){const S=n.invertBatch(M.map((I=>I.ez)));return M.map(((I,j)=>I.toAffine(S[j]))).map(_.fromAffine)}static msm(M,S){return(0,ns.pippenger)(_,d,M,S)}_setWindowSize(M){U.setWindowSize(this,M)}assertValidity(){C(this)}equals(M){w(M);const{ex:S,ey:I,ez:j}=this,{ex:y,ey:E,ez:A}=M,T=u(S*A),b=u(y*j),v=u(I*A),k=u(E*j);return T===b&&v===k}is0(){return this.equals(_.ZERO)}negate(){return new _(u(-this.ex),this.ey,this.ez,u(-this.et))}double(){const{a:M}=e,{ex:S,ey:I,ez:j}=this,y=u(S*S),E=u(I*I),A=u(pi*u(j*j)),T=u(M*y),b=S+I,v=u(u(b*b)-y-E),k=T+E,x=k-A,R=T-E,B=u(v*x),K=u(k*R),z=u(v*R),V=u(x*k);return new _(B,K,V,z)}add(M){w(M);const{a:S,d:I}=e,{ex:j,ey:y,ez:E,et:A}=this,{ex:T,ey:b,ez:v,et:k}=M;if(S===BigInt(-1)){const ie=u((y-j)*(b+T)),le=u((y+j)*(b-T)),se=u(le-ie);if(se===wt)return this.double();const fe=u(E*pi*k),ve=u(A*pi*v),ce=ve+fe,de=le+ie,me=ve-fe,Ae=u(ce*se),Ie=u(de*me),Lo=u(ce*me),No=u(se*de);return new _(Ae,Ie,No,Lo)}const x=u(j*T),R=u(y*b),B=u(A*I*k),K=u(E*v),z=u((j+y)*(T+b)-x-R),V=K-B,Z=K+B,Q=u(R-S*x),ne=u(z*V),oe=u(Z*Q),ue=u(z*Q),re=u(V*Z);return new _(ne,oe,re,ue)}subtract(M){return this.add(M.negate())}wNAF(M){return U.wNAFCached(this,M,_.normalizeZ)}multiply(M){const S=M;et.aInRange("scalar",S,tt,r);const{p:I,f:j}=this.wNAF(S);return _.normalizeZ([I,j])[0]}multiplyUnsafe(M){const S=M;return et.aInRange("scalar",S,wt,r),S===wt?L:this.equals(L)||S===tt?this:this.equals(P)?this.wNAF(S).p:U.unsafeLadder(this,S)}isSmallOrder(){return this.multiplyUnsafe(a).is0()}isTorsionFree(){return U.unsafeLadder(this,r).is0()}toAffine(M){return p(this,M)}clearCofactor(){const{h:M}=e;return M===tt?this:this.multiplyUnsafe(M)}static fromHex(M,S=!1){const{d:I,a:j}=e,y=n.BYTES;M=(0,ot.ensureBytes)("pointHex",M,y),(0,ot.abool)("zip215",S);const E=M.slice(),A=M[y-1];E[y-1]=-129&A;const T=et.bytesToNumberLE(E),b=S?l:n.ORDER;et.aInRange("pointHex.y",T,wt,b);const v=u(T*T),k=u(v-tt),x=u(I*v-j);let{isValid:R,value:B}=h(k,x);if(!R)throw new Error("Point.fromHex: invalid y coordinate");const K=(B&tt)===tt,z=(128&A)!=0;if(!S&&B===wt&&z)throw new Error("Point.fromHex: x=0 and x_0=1");return z!==K&&(B=u(-B)),_.fromAffine({x:B,y:T})}static fromPrivateKey(M){return D(M).point}toRawBytes(){const{x:M,y:S}=this.toAffine(),I=et.numberToBytesLE(S,n.BYTES);return I[I.length-1]|=M&tt?128:0,I}toHex(){return et.bytesToHex(this.toRawBytes())}}_.BASE=new _(e.Gx,e.Gy,tt,u(e.Gx*e.Gy)),_.ZERO=new _(wt,tt,tt,wt);const{BASE:P,ZERO:L}=_,U=(0,ns.wNAF)(_,8*s);function q(O){return(0,Fc.mod)(O,r)}function F(O){return q(et.bytesToNumberLE(O))}function D(O){const M=s;O=(0,ot.ensureBytes)("private key",O,M);const S=(0,ot.ensureBytes)("hashed private key",o(O),2*M),I=f(S.slice(0,M)),j=S.slice(M,2*M),y=F(I),E=P.multiply(y),A=E.toRawBytes();return{head:I,prefix:j,scalar:y,point:E,pointBytes:A}}function N(O=new Uint8Array,...M){const S=et.concatBytes(...M);return F(o(m(S,(0,ot.ensureBytes)("context",O),!!i)))}const H=L0;return P._setWindowSize(8),{CURVE:e,getPublicKey:function(O){return D(O).pointBytes},sign:function(O,M,S={}){O=(0,ot.ensureBytes)("message",O),i&&(O=i(O));const{prefix:I,scalar:j,pointBytes:y}=D(M),E=N(S.context,I,O),A=P.multiply(E).toRawBytes(),T=q(E+N(S.context,A,y,O)*j);et.aInRange("signature.s",T,wt,r);const b=et.concatBytes(A,et.numberToBytesLE(T,n.BYTES));return(0,ot.ensureBytes)("result",b,2*s)},verify:function(O,M,S,I=H){const{context:j,zip215:y}=I,E=n.BYTES;O=(0,ot.ensureBytes)("signature",O,2*E),M=(0,ot.ensureBytes)("message",M),y!==void 0&&(0,ot.abool)("zip215",y),i&&(M=i(M));const A=et.bytesToNumberLE(O.slice(E,2*E));let T,b,v;try{T=_.fromHex(S,y),b=_.fromHex(O.slice(0,E),y),v=P.multiplyUnsafe(A)}catch{return!1}if(!y&&T.isSmallOrder())return!1;const k=N(j,b.toRawBytes(),T.toRawBytes(),M);return b.add(T.multiplyUnsafe(k)).subtract(v).clearCofactor().equals(_.ZERO)},ExtendedPoint:_,utils:{getExtendedPublicKey:D,randomPrivateKey:()=>c(n.BYTES),precompute:(O=8,M=_.BASE)=>(M._setWindowSize(O),M.multiply(BigInt(3)),M)}}};const ns=Yn,Fc=Ce,et=ye,ot=ye,wt=BigInt(0),tt=BigInt(1),pi=BigInt(2),I0=BigInt(8),L0={zip215:!0};var hn={};Object.defineProperty(hn,"__esModule",{value:!0}),hn.expand_message_xmd=jd,hn.expand_message_xof=Ud,hn.hash_to_field=rs,hn.isogenyMap=function(t,e){const n=e.map((r=>Array.from(r).reverse()));return(r,i)=>{const[o,c,s,a]=n.map((l=>l.reduce(((u,d)=>t.add(t.mul(u,r),d)))));return r=t.div(o,c),i=t.mul(i,t.div(s,a)),{x:r,y:i}}},hn.createHasher=function(t,e,n){if(typeof e!="function")throw new Error("mapToCurve() must be defined");return{hashToCurve(r,i){const o=rs(r,2,{...n,DST:n.DST,...i}),c=t.fromAffine(e(o[0])),s=t.fromAffine(e(o[1])),a=c.add(s).clearCofactor();return a.assertValidity(),a},encodeToCurve(r,i){const o=rs(r,1,{...n,DST:n.encodeDST,...i}),c=t.fromAffine(e(o[0])).clearCofactor();return c.assertValidity(),c},mapToCurve(r){if(!Array.isArray(r))throw new Error("mapToCurve: expected array of bigints");for(const o of r)if(typeof o!="bigint")throw new Error(`mapToCurve: expected array of bigints, got ${o} in array`);const i=t.fromAffine(e(r)).clearCofactor();return i.assertValidity(),i}}};const N0=Ce,qe=ye,D0=qe.bytesToNumberBE;function fn(t,e){if(Nr(t),Nr(e),t<0||t>=1<<8*e)throw new Error(`bad I2OSP call: value=${t} length=${e}`);const n=Array.from({length:e}).fill(0);for(let r=e-1;r>=0;r--)n[r]=255&t,t>>>=8;return new Uint8Array(n)}function B0(t,e){const n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t[r]^e[r];return n}function Nr(t){if(!Number.isSafeInteger(t))throw new Error("number expected")}function jd(t,e,n,r){(0,qe.abytes)(t),(0,qe.abytes)(e),Nr(n),e.length>255&&(e=r((0,qe.concatBytes)((0,qe.utf8ToBytes)("H2C-OVERSIZE-DST-"),e)));const{outputLen:i,blockLen:o}=r,c=Math.ceil(n/i);if(n>65535||c>255)throw new Error("expand_message_xmd: invalid lenInBytes");const s=(0,qe.concatBytes)(e,fn(e.length,1)),a=fn(0,o),l=fn(n,2),u=new Array(c),d=r((0,qe.concatBytes)(a,t,l,fn(0,1),s));u[0]=r((0,qe.concatBytes)(d,fn(1,1),s));for(let h=1;h<=c;h++){const f=[B0(d,u[h-1]),fn(h+1,1),s];u[h]=r((0,qe.concatBytes)(...f))}return(0,qe.concatBytes)(...u).slice(0,n)}function Ud(t,e,n,r,i){if((0,qe.abytes)(t),(0,qe.abytes)(e),Nr(n),e.length>255){const o=Math.ceil(2*r/8);e=i.create({dkLen:o}).update((0,qe.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(e).digest()}if(n>65535||e.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return i.create({dkLen:n}).update(t).update(fn(n,2)).update(e).update(fn(e.length,1)).digest()}function rs(t,e,n){(0,qe.validateObject)(n,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:r,k:i,m:o,hash:c,expand:s,DST:a}=n;(0,qe.abytes)(t),Nr(e);const l=typeof a=="string"?(0,qe.utf8ToBytes)(a):a,u=r.toString(2).length,d=Math.ceil((u+i)/8),h=e*o*d;let f;if(s==="xmd")f=jd(t,l,h,c);else if(s==="xof")f=Ud(t,l,h,i,c);else{if(s!=="_internal_pass")throw new Error('expand must be "xmd" or "xof"');f=t}const m=new Array(e);for(let g=0;g<e;g++){const w=new Array(o);for(let p=0;p<o;p++){const C=d*(p+g*o),_=f.subarray(C,C+d);w[p]=(0,N0.mod)(D0(_),r)}m[g]=w}return m}var qs={};Object.defineProperty(qs,"__esModule",{value:!0}),qs.montgomery=function(t){const e=(function(g){return(0,on.validateObject)(g,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...g})})(t),{P:n}=e,r=g=>(0,qc.mod)(g,n),i=e.montgomeryBits,o=Math.ceil(i/8),c=e.nByteLength,s=e.adjustScalarBytes||(g=>g),a=e.powPminus2||(g=>(0,qc.pow)(g,n-BigInt(2),n));function l(g,w,p){const C=r(g*(w-p));return[w=r(w-C),p=r(p+C)]}const u=(e.a-BigInt(2))/BigInt(4);function d(g){return(0,on.numberToBytesLE)(r(g),o)}function h(g,w){const p=(function(P){const L=(0,on.ensureBytes)("u coordinate",P,o);return c===32&&(L[31]&=127),(0,on.bytesToNumberLE)(L)})(w),C=(function(P){const L=(0,on.ensureBytes)("scalar",P),U=L.length;if(U!==o&&U!==c)throw new Error(`Expected ${o} or ${c} bytes, got ${U}`);return(0,on.bytesToNumberLE)(s(L))})(g),_=(function(P,L){(0,on.aInRange)("u",P,Fn,n),(0,on.aInRange)("scalar",L,Fn,n);const U=L,q=P;let F,D=is,N=Fn,H=P,$=is,O=Fn;for(let S=BigInt(i-1);S>=Fn;S--){const I=U>>S&is;O^=I,F=l(O,D,H),D=F[0],H=F[1],F=l(O,N,$),N=F[0],$=F[1],O=I;const j=D+N,y=r(j*j),E=D-N,A=r(E*E),T=y-A,b=H+$,v=r((H-$)*j),k=r(b*E),x=v+k,R=v-k;H=r(x*x),$=r(q*r(R*R)),D=r(y*A),N=r(T*(y+r(u*T)))}F=l(O,D,H),D=F[0],H=F[1],F=l(O,N,$),N=F[0],$=F[1];const M=a(N);return r(D*M)})(p,C);if(_===Fn)throw new Error("Invalid private or public key received");return d(_)}const f=d(e.Gu);function m(g){return h(g,f)}return{scalarMult:h,scalarMultBase:m,getSharedSecret:(g,w)=>h(g,w),getPublicKey:g=>m(g),utils:{randomPrivateKey:()=>e.randomBytes(e.nByteLength)},GuBytes:f}};const qc=Ce,on=ye,Fn=BigInt(0),is=BigInt(1);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.hash_to_ristretto255=t.hashToRistretto255=t.RistrettoPoint=t.encodeToCurve=t.hashToCurve=t.edwardsToMontgomery=t.x25519=t.ed25519ph=t.ed25519ctx=t.ed25519=t.ED25519_TORSION_SUBGROUP=void 0,t.edwardsToMontgomeryPub=U,t.edwardsToMontgomeryPriv=function(k){const x=P.hash(k.subarray(0,32));return P.adjustScalarBytes(x).subarray(0,32)};const e=De,n=tn,r=js,i=hn,o=Ce,c=qs,s=ye,a=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),l=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),u=BigInt(0),d=BigInt(1),h=BigInt(2),f=BigInt(3),m=BigInt(5),g=BigInt(8);function w(k){const x=BigInt(10),R=BigInt(20),B=BigInt(40),K=BigInt(80),z=a,V=k*k%z*k%z,Z=(0,o.pow2)(V,h,z)*V%z,Q=(0,o.pow2)(Z,d,z)*k%z,ne=(0,o.pow2)(Q,m,z)*Q%z,oe=(0,o.pow2)(ne,x,z)*ne%z,ue=(0,o.pow2)(oe,R,z)*oe%z,re=(0,o.pow2)(ue,B,z)*ue%z,ie=(0,o.pow2)(re,K,z)*re%z,le=(0,o.pow2)(ie,K,z)*re%z,se=(0,o.pow2)(le,x,z)*ne%z;return{pow_p_5_8:(0,o.pow2)(se,h,z)*k%z,b2:V}}function p(k){return k[0]&=248,k[31]&=127,k[31]|=64,k}function C(k,x){const R=a,B=(0,o.mod)(x*x*x,R),K=w(k*(0,o.mod)(B*B*x,R)).pow_p_5_8;let z=(0,o.mod)(k*B*K,R);const V=(0,o.mod)(x*z*z,R),Z=z,Q=(0,o.mod)(z*l,R),ne=V===k,oe=V===(0,o.mod)(-k,R),ue=V===(0,o.mod)(-k*l,R);return ne&&(z=Z),(oe||ue)&&(z=Q),(0,o.isNegativeLE)(z,R)&&(z=(0,o.mod)(-z,R)),{isValid:ne||oe,value:z}}t.ED25519_TORSION_SUBGROUP=["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"];const _=(0,o.Field)(a,void 0,!0),P={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:_,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:g,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:e.sha512,randomBytes:n.randomBytes,adjustScalarBytes:p,uvRatio:C};function L(k,x,R){if(x.length>255)throw new Error("Context is too big");return(0,n.concatBytes)((0,n.utf8ToBytes)("SigEd25519 no Ed25519 collisions"),new Uint8Array([R?1:0,x.length]),x,k)}function U(k){const{y:x}=t.ed25519.ExtendedPoint.fromHex(k),R=BigInt(1);return _.toBytes(_.create((R+x)*_.inv(R-x)))}t.ed25519=(0,r.twistedEdwards)(P),t.ed25519ctx=(0,r.twistedEdwards)({...P,domain:L}),t.ed25519ph=(0,r.twistedEdwards)(Object.assign({},P,{domain:L,prehash:e.sha512})),t.x25519=(0,c.montgomery)({P:a,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:k=>{const x=a,{pow_p_5_8:R,b2:B}=w(k);return(0,o.mod)((0,o.pow2)(R,f,x)*B,x)},adjustScalarBytes:p,randomBytes:n.randomBytes}),t.edwardsToMontgomery=U;const q=(_.ORDER+f)/g,F=_.pow(h,q),D=_.sqrt(_.neg(_.ONE)),N=(0,o.FpSqrtEven)(_,_.neg(BigInt(486664)));function H(k){const{xMn:x,xMd:R,yMn:B,yMd:K}=(function(re){const ie=(_.ORDER-m)/g,le=BigInt(486662);let se=_.sqr(re);se=_.mul(se,h);let fe=_.add(se,_.ONE),ve=_.neg(le),ce=_.sqr(fe),de=_.mul(ce,fe),me=_.mul(se,le);me=_.mul(me,ve),me=_.add(me,ce),me=_.mul(me,ve);let Ae=_.sqr(de);ce=_.sqr(Ae),Ae=_.mul(Ae,de),Ae=_.mul(Ae,me),ce=_.mul(ce,Ae);let Ie=_.pow(ce,ie);Ie=_.mul(Ie,Ae);let Lo=_.mul(Ie,D);ce=_.sqr(Ie),ce=_.mul(ce,de);let No=_.eql(ce,me),sc=_.cmov(Lo,Ie,No),jf=_.mul(ve,se),fr=_.mul(Ie,re);fr=_.mul(fr,F);let Uf=_.mul(fr,D),Hf=_.mul(me,se);ce=_.sqr(fr),ce=_.mul(ce,de);let Ff=_.eql(ce,Hf),qf=_.cmov(Uf,fr,Ff);ce=_.sqr(sc),ce=_.mul(ce,de);let Do=_.eql(ce,me),zf=_.cmov(jf,ve,Do),pr=_.cmov(qf,sc,Do),Vf=_.isOdd(pr);return pr=_.cmov(pr,_.neg(pr),Do!==Vf),{xMn:zf,xMd:fe,yMn:pr,yMd:d}})(k);let z=_.mul(x,K);z=_.mul(z,N);let V=_.mul(R,B),Z=_.sub(x,R),Q=_.add(x,R),ne=_.mul(V,Q),oe=_.eql(ne,_.ZERO);z=_.cmov(z,_.ZERO,oe),V=_.cmov(V,_.ONE,oe),Z=_.cmov(Z,_.ONE,oe),Q=_.cmov(Q,_.ONE,oe);const ue=_.invertBatch([V,Q]);return{x:_.mul(z,ue[0]),y:_.mul(Z,ue[1])}}const $=(0,i.createHasher)(t.ed25519.ExtendedPoint,(k=>H(k[0])),{DST:"edwards25519_XMD:SHA-512_ELL2_RO_",encodeDST:"edwards25519_XMD:SHA-512_ELL2_NU_",p:_.ORDER,m:1,k:128,expand:"xmd",hash:e.sha512});function O(k){if(!(k instanceof v))throw new Error("RistrettoPoint expected")}t.hashToCurve=$.hashToCurve,t.encodeToCurve=$.encodeToCurve;const M=l,S=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),I=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),j=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),y=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),E=k=>C(d,k),A=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),T=k=>t.ed25519.CURVE.Fp.create((0,s.bytesToNumberLE)(k)&A);function b(k){const{d:x}=t.ed25519.CURVE,R=t.ed25519.CURVE.Fp.ORDER,B=t.ed25519.CURVE.Fp.create,K=B(M*k*k),z=B((K+d)*j);let V=BigInt(-1);const Z=B((V-x*K)*B(K+x));let{isValid:Q,value:ne}=C(z,Z),oe=B(ne*k);(0,o.isNegativeLE)(oe,R)||(oe=B(-oe)),Q||(ne=oe),Q||(V=K);const ue=B(V*(K-d)*y-Z),re=ne*ne,ie=B((ne+ne)*Z),le=B(ue*S),se=B(d-re),fe=B(d+re);return new t.ed25519.ExtendedPoint(B(ie*fe),B(se*le),B(le*fe),B(ie*se))}class v{constructor(x){this.ep=x}static fromAffine(x){return new v(t.ed25519.ExtendedPoint.fromAffine(x))}static hashToCurve(x){x=(0,s.ensureBytes)("ristrettoHash",x,64);const R=b(T(x.slice(0,32))),B=b(T(x.slice(32,64)));return new v(R.add(B))}static fromHex(x){x=(0,s.ensureBytes)("ristrettoHex",x,32);const{a:R,d:B}=t.ed25519.CURVE,K=t.ed25519.CURVE.Fp.ORDER,z=t.ed25519.CURVE.Fp.create,V="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",Z=T(x);if(!(0,s.equalBytes)((0,s.numberToBytesLE)(Z,32),x)||(0,o.isNegativeLE)(Z,K))throw new Error(V);const Q=z(Z*Z),ne=z(d+R*Q),oe=z(d-R*Q),ue=z(ne*ne),re=z(oe*oe),ie=z(R*B*ue-re),{isValid:le,value:se}=E(z(ie*re)),fe=z(se*oe),ve=z(se*fe*ie);let ce=z((Z+Z)*fe);(0,o.isNegativeLE)(ce,K)&&(ce=z(-ce));const de=z(ne*ve),me=z(ce*de);if(!le||(0,o.isNegativeLE)(me,K)||de===u)throw new Error(V);return new v(new t.ed25519.ExtendedPoint(ce,de,d,me))}toRawBytes(){let{ex:x,ey:R,ez:B,et:K}=this.ep;const z=t.ed25519.CURVE.Fp.ORDER,V=t.ed25519.CURVE.Fp.create,Z=V(V(B+R)*V(B-R)),Q=V(x*R),ne=V(Q*Q),{value:oe}=E(V(Z*ne)),ue=V(oe*Z),re=V(oe*Q),ie=V(ue*re*K);let le;if((0,o.isNegativeLE)(K*ie,z)){let fe=V(R*M),ve=V(x*M);x=fe,R=ve,le=V(ue*I)}else le=re;(0,o.isNegativeLE)(x*ie,z)&&(R=V(-R));let se=V((B-R)*le);return(0,o.isNegativeLE)(se,z)&&(se=V(-se)),(0,s.numberToBytesLE)(se,32)}toHex(){return(0,s.bytesToHex)(this.toRawBytes())}toString(){return this.toHex()}equals(x){O(x);const{ex:R,ey:B}=this.ep,{ex:K,ey:z}=x.ep,V=t.ed25519.CURVE.Fp.create,Z=V(R*z)===V(B*K),Q=V(B*z)===V(R*K);return Z||Q}add(x){return O(x),new v(this.ep.add(x.ep))}subtract(x){return O(x),new v(this.ep.subtract(x.ep))}multiply(x){return new v(this.ep.multiply(x))}multiplyUnsafe(x){return new v(this.ep.multiplyUnsafe(x))}double(){return new v(this.ep.double())}negate(){return new v(this.ep.negate())}}t.RistrettoPoint=(v.BASE||(v.BASE=new v(t.ed25519.ExtendedPoint.BASE)),v.ZERO||(v.ZERO=new v(t.ed25519.ExtendedPoint.ZERO)),v),t.hashToRistretto255=(k,x)=>{const R=x.DST,B=typeof R=="string"?(0,n.utf8ToBytes)(R):R,K=(0,i.expand_message_xmd)(k,B,64,e.sha512);return v.hashToCurve(K)},t.hash_to_ristretto255=t.hashToRistretto255})(ld);var Hd={},Jt={};Object.defineProperty(Jt,"__esModule",{value:!0}),Jt.sha224=Jt.sha256=Jt.SHA256=void 0;const os=Zt,ft=tn,$0=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),sn=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),an=new Uint32Array(64);class xa extends os.HashMD{constructor(){super(64,32,8,!1),this.A=0|sn[0],this.B=0|sn[1],this.C=0|sn[2],this.D=0|sn[3],this.E=0|sn[4],this.F=0|sn[5],this.G=0|sn[6],this.H=0|sn[7]}get(){const{A:e,B:n,C:r,D:i,E:o,F:c,G:s,H:a}=this;return[e,n,r,i,o,c,s,a]}set(e,n,r,i,o,c,s,a){this.A=0|e,this.B=0|n,this.C=0|r,this.D=0|i,this.E=0|o,this.F=0|c,this.G=0|s,this.H=0|a}process(e,n){for(let d=0;d<16;d++,n+=4)an[d]=e.getUint32(n,!1);for(let d=16;d<64;d++){const h=an[d-15],f=an[d-2],m=(0,ft.rotr)(h,7)^(0,ft.rotr)(h,18)^h>>>3,g=(0,ft.rotr)(f,17)^(0,ft.rotr)(f,19)^f>>>10;an[d]=g+an[d-7]+m+an[d-16]|0}let{A:r,B:i,C:o,D:c,E:s,F:a,G:l,H:u}=this;for(let d=0;d<64;d++){const h=u+((0,ft.rotr)(s,6)^(0,ft.rotr)(s,11)^(0,ft.rotr)(s,25))+(0,os.Chi)(s,a,l)+$0[d]+an[d]|0,f=((0,ft.rotr)(r,2)^(0,ft.rotr)(r,13)^(0,ft.rotr)(r,22))+(0,os.Maj)(r,i,o)|0;u=l,l=a,a=s,s=c+h|0,c=o,o=i,i=r,r=h+f|0}r=r+this.A|0,i=i+this.B|0,o=o+this.C|0,c=c+this.D|0,s=s+this.E|0,a=a+this.F|0,l=l+this.G|0,u=u+this.H|0,this.set(r,i,o,c,s,a,l,u)}roundClean(){an.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}Jt.SHA256=xa;class K0 extends xa{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}Jt.sha256=(0,ft.wrapConstructor)((()=>new xa)),Jt.sha224=(0,ft.wrapConstructor)((()=>new K0));var Li={},Ta={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.hmac=t.HMAC=void 0;const e=ct,n=tn;class r extends n.Hash{constructor(o,c){super(),this.finished=!1,this.destroyed=!1,(0,e.hash)(o);const s=(0,n.toBytes)(c);if(this.iHash=o.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const a=this.blockLen,l=new Uint8Array(a);l.set(s.length>a?o.create().update(s).digest():s);for(let u=0;u<l.length;u++)l[u]^=54;this.iHash.update(l),this.oHash=o.create();for(let u=0;u<l.length;u++)l[u]^=106;this.oHash.update(l),l.fill(0)}update(o){return(0,e.exists)(this),this.iHash.update(o),this}digestInto(o){(0,e.exists)(this),(0,e.bytes)(o,this.outputLen),this.finished=!0,this.iHash.digestInto(o),this.oHash.update(o),this.oHash.digestInto(o),this.destroy()}digest(){const o=new Uint8Array(this.oHash.outputLen);return this.digestInto(o),o}_cloneInto(o){o||(o=Object.create(Object.getPrototypeOf(this),{}));const{oHash:c,iHash:s,finished:a,destroyed:l,blockLen:u,outputLen:d}=this;return o.finished=a,o.destroyed=l,o.blockLen=u,o.outputLen=d,o.oHash=c._cloneInto(o.oHash),o.iHash=s._cloneInto(o.iHash),o}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}t.HMAC=r,t.hmac=(i,o,c)=>new r(i,o).update(c).digest(),t.hmac.create=(i,o)=>new r(i,o)})(Ta);var Ma={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.DER=void 0,t.weierstrassPoints=f,t.weierstrass=function(g){const w=(function(k){const x=(0,e.validateBasic)(k);return r.validateObject(x,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...x})})(g),{Fp:p,n:C}=w,_=p.BYTES+1,P=2*p.BYTES+1;function L(k){return n.mod(k,C)}function U(k){return n.invert(k,C)}const{ProjectivePoint:q,normPrivateKeyToScalar:F,weierstrassEquation:D,isWithinCurveOrder:N}=f({...w,toBytes(k,x,R){const B=x.toAffine(),K=p.toBytes(B.x),z=r.concatBytes;return(0,i.abool)("isCompressed",R),R?z(Uint8Array.from([x.hasEvenY()?2:3]),K):z(Uint8Array.from([4]),K,p.toBytes(B.y))},fromBytes(k){const x=k.length,R=k[0],B=k.subarray(1);if(x!==_||R!==2&&R!==3){if(x===P&&R===4)return{x:p.fromBytes(B.subarray(0,p.BYTES)),y:p.fromBytes(B.subarray(p.BYTES,2*p.BYTES))};throw new Error(`Point of length ${x} was invalid. Expected ${_} compressed bytes or ${P} uncompressed bytes`)}{const K=r.bytesToNumberBE(B);if(!r.inRange(K,l,p.ORDER))throw new Error("Point is not on curve");const z=D(K);let V;try{V=p.sqrt(z)}catch(Z){const Q=Z instanceof Error?": "+Z.message:"";throw new Error("Point is not on curve"+Q)}return(1&R)==1!=((V&l)===l)&&(V=p.neg(V)),{x:K,y:V}}}}),H=k=>r.bytesToHex(r.numberToBytesBE(k,w.nByteLength));function $(k){return k>C>>l}const O=(k,x,R)=>r.bytesToNumberBE(k.slice(x,R));class M{constructor(x,R,B){this.r=x,this.s=R,this.recovery=B,this.assertValidity()}static fromCompact(x){const R=w.nByteLength;return x=(0,i.ensureBytes)("compactSignature",x,2*R),new M(O(x,0,R),O(x,R,2*R))}static fromDER(x){const{r:R,s:B}=t.DER.toSig((0,i.ensureBytes)("DER",x));return new M(R,B)}assertValidity(){r.aInRange("r",this.r,l,C),r.aInRange("s",this.s,l,C)}addRecoveryBit(x){return new M(this.r,this.s,x)}recoverPublicKey(x){const{r:R,s:B,recovery:K}=this,z=y((0,i.ensureBytes)("msgHash",x));if(K==null||![0,1,2,3].includes(K))throw new Error("recovery id invalid");const V=K===2||K===3?R+w.n:R;if(V>=p.ORDER)throw new Error("recovery id 2 or 3 invalid");const Z=(1&K)==0?"02":"03",Q=q.fromHex(Z+H(V)),ne=U(V),oe=L(-z*ne),ue=L(B*ne),re=q.BASE.multiplyAndAddUnsafe(Q,oe,ue);if(!re)throw new Error("point at infinify");return re.assertValidity(),re}hasHighS(){return $(this.s)}normalizeS(){return this.hasHighS()?new M(this.r,L(-this.s),this.recovery):this}toDERRawBytes(){return r.hexToBytes(this.toDERHex())}toDERHex(){return t.DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return r.hexToBytes(this.toCompactHex())}toCompactHex(){return H(this.r)+H(this.s)}}const S={isValidPrivateKey(k){try{return F(k),!0}catch{return!1}},normPrivateKeyToScalar:F,randomPrivateKey:()=>{const k=n.getMinHashLength(w.n);return n.mapHashToField(w.randomBytes(k),w.n)},precompute:(k=8,x=q.BASE)=>(x._setWindowSize(k),x.multiply(BigInt(3)),x)};function I(k){const x=r.isBytes(k),R=typeof k=="string",B=(x||R)&&k.length;return x?B===_||B===P:R?B===2*_||B===2*P:k instanceof q}const j=w.bits2int||function(k){const x=r.bytesToNumberBE(k),R=8*k.length-w.nBitLength;return R>0?x>>BigInt(R):x},y=w.bits2int_modN||function(k){return L(j(k))},E=r.bitMask(w.nBitLength);function A(k){return r.aInRange(`num < 2^${w.nBitLength}`,k,a,E),r.numberToBytesBE(k,w.nByteLength)}function T(k,x,R=b){if(["recovered","canonical"].some((ie=>ie in R)))throw new Error("sign() legacy options not supported");const{hash:B,randomBytes:K}=w;let{lowS:z,prehash:V,extraEntropy:Z}=R;z==null&&(z=!0),k=(0,i.ensureBytes)("msgHash",k),o(R),V&&(k=(0,i.ensureBytes)("prehashed msgHash",B(k)));const Q=y(k),ne=F(x),oe=[A(ne),A(Q)];if(Z!=null&&Z!==!1){const ie=Z===!0?K(p.BYTES):Z;oe.push((0,i.ensureBytes)("extraEntropy",ie))}const ue=r.concatBytes(...oe),re=Q;return{seed:ue,k2sig:function(ie){const le=j(ie);if(!N(le))return;const se=U(le),fe=q.BASE.multiply(le).toAffine(),ve=L(fe.x);if(ve===a)return;const ce=L(se*L(re+ve*ne));if(ce===a)return;let de=(fe.x===ve?0:2)|Number(fe.y&l),me=ce;return z&&$(ce)&&(me=(function(Ae){return $(Ae)?L(-Ae):Ae})(ce),de^=1),new M(ve,me,de)}}}const b={lowS:w.lowS,prehash:!1},v={lowS:w.lowS,prehash:!1};return q.BASE._setWindowSize(8),{CURVE:w,getPublicKey:function(k,x=!0){return q.fromPrivateKey(k).toRawBytes(x)},getSharedSecret:function(k,x,R=!0){if(I(k))throw new Error("first arg must be private key");if(!I(x))throw new Error("second arg must be public key");return q.fromHex(x).multiply(F(k)).toRawBytes(R)},sign:function(k,x,R=b){const{seed:B,k2sig:K}=T(k,x,R),z=w;return r.createHmacDrbg(z.hash.outputLen,z.nByteLength,z.hmac)(B,K)},verify:function(k,x,R,B=v){var ve;const K=k;if(x=(0,i.ensureBytes)("msgHash",x),R=(0,i.ensureBytes)("publicKey",R),"strict"in B)throw new Error("options.strict was renamed to lowS");o(B);const{lowS:z,prehash:V}=B;let Z,Q;try{if(typeof K=="string"||r.isBytes(K))try{Z=M.fromDER(K)}catch(ce){if(!(ce instanceof t.DER.Err))throw ce;Z=M.fromCompact(K)}else{if(typeof K!="object"||typeof K.r!="bigint"||typeof K.s!="bigint")throw new Error("PARSE");{const{r:ce,s:de}=K;Z=new M(ce,de)}}Q=q.fromHex(R)}catch(ce){if(ce.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(z&&Z.hasHighS())return!1;V&&(x=w.hash(x));const{r:ne,s:oe}=Z,ue=y(x),re=U(oe),ie=L(ue*re),le=L(ne*re),se=(ve=q.BASE.multiplyAndAddUnsafe(Q,ie,le))==null?void 0:ve.toAffine();return se?L(se.x)===ne:!1},ProjectivePoint:q,Signature:M,utils:S}},t.SWUFpSqrtRatio=m,t.mapToCurveSimpleSWU=function(g,w){if(n.validateField(g),!g.isValid(w.A)||!g.isValid(w.B)||!g.isValid(w.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const p=m(g,w.Z);if(!g.isOdd)throw new Error("Fp.isOdd is not implemented!");return C=>{let _,P,L,U,q,F,D,N;_=g.sqr(C),_=g.mul(_,w.Z),P=g.sqr(_),P=g.add(P,_),L=g.add(P,g.ONE),L=g.mul(L,w.B),U=g.cmov(w.Z,g.neg(P),!g.eql(P,g.ZERO)),U=g.mul(U,w.A),P=g.sqr(L),F=g.sqr(U),q=g.mul(F,w.A),P=g.add(P,q),P=g.mul(P,L),F=g.mul(F,U),q=g.mul(F,w.B),P=g.add(P,q),D=g.mul(_,L);const{isValid:H,value:$}=p(P,F);N=g.mul(_,C),N=g.mul(N,$),D=g.cmov(D,L,H),N=g.cmov(N,$,H);const O=g.isOdd(C)===g.isOdd(N);return N=g.cmov(g.neg(N),N,O),D=g.div(D,U),{x:D,y:N}}};const e=Yn,n=Ce,r=ye,i=ye;function o(g){g.lowS!==void 0&&(0,i.abool)("lowS",g.lowS),g.prehash!==void 0&&(0,i.abool)("prehash",g.prehash)}const{bytesToNumberBE:c,hexToBytes:s}=r;t.DER={Err:class extends Error{constructor(g=""){super(g)}},_tlv:{encode:(g,w)=>{const{Err:p}=t.DER;if(g<0||g>256)throw new p("tlv.encode: wrong tag");if(1&w.length)throw new p("tlv.encode: unpadded data");const C=w.length/2,_=r.numberToHexUnpadded(C);if(_.length/2&128)throw new p("tlv.encode: long form length too big");const P=C>127?r.numberToHexUnpadded(_.length/2|128):"";return`${r.numberToHexUnpadded(g)}${P}${_}${w}`},decode(g,w){const{Err:p}=t.DER;let C=0;if(g<0||g>256)throw new p("tlv.encode: wrong tag");if(w.length<2||w[C++]!==g)throw new p("tlv.decode: wrong tlv");const _=w[C++];let P=0;if(128&_){const U=127&_;if(!U)throw new p("tlv.decode(long): indefinite length not supported");if(U>4)throw new p("tlv.decode(long): byte length is too big");const q=w.subarray(C,C+U);if(q.length!==U)throw new p("tlv.decode: length bytes not complete");if(q[0]===0)throw new p("tlv.decode(long): zero leftmost byte");for(const F of q)P=P<<8|F;if(C+=U,P<128)throw new p("tlv.decode(long): not minimal encoding")}else P=_;const L=w.subarray(C,C+P);if(L.length!==P)throw new p("tlv.decode: wrong value length");return{v:L,l:w.subarray(C+P)}}},_int:{encode(g){const{Err:w}=t.DER;if(g<a)throw new w("integer: negative integers are not allowed");let p=r.numberToHexUnpadded(g);if(8&Number.parseInt(p[0],16)&&(p="00"+p),1&p.length)throw new w("unexpected assertion");return p},decode(g){const{Err:w}=t.DER;if(128&g[0])throw new w("Invalid signature integer: negative");if(g[0]===0&&!(128&g[1]))throw new w("Invalid signature integer: unnecessary leading zero");return c(g)}},toSig(g){const{Err:w,_int:p,_tlv:C}=t.DER,_=typeof g=="string"?s(g):g;r.abytes(_);const{v:P,l:L}=C.decode(48,_);if(L.length)throw new w("Invalid signature: left bytes after parsing");const{v:U,l:q}=C.decode(2,P),{v:F,l:D}=C.decode(2,q);if(D.length)throw new w("Invalid signature: left bytes after parsing");return{r:p.decode(U),s:p.decode(F)}},hexFromSig(g){const{_tlv:w,_int:p}=t.DER,C=`${w.encode(2,p.encode(g.r))}${w.encode(2,p.encode(g.s))}`;return w.encode(48,C)}};const a=BigInt(0),l=BigInt(1),u=BigInt(2),d=BigInt(3),h=BigInt(4);function f(g){const w=(function(O){const M=(0,e.validateBasic)(O);r.validateObject(M,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:S,Fp:I,a:j}=M;if(S){if(!I.eql(j,I.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof S!="object"||typeof S.beta!="bigint"||typeof S.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...M})})(g),{Fp:p}=w,C=n.Field(w.n,w.nBitLength),_=w.toBytes||((O,M,S)=>{const I=M.toAffine();return r.concatBytes(Uint8Array.from([4]),p.toBytes(I.x),p.toBytes(I.y))}),P=w.fromBytes||(O=>{const M=O.subarray(1);return{x:p.fromBytes(M.subarray(0,p.BYTES)),y:p.fromBytes(M.subarray(p.BYTES,2*p.BYTES))}});function L(O){const{a:M,b:S}=w,I=p.sqr(O),j=p.mul(I,O);return p.add(p.add(j,p.mul(O,M)),S)}if(!p.eql(p.sqr(w.Gy),L(w.Gx)))throw new Error("bad generator point: equation left != right");function U(O){const{allowedPrivateKeyLengths:M,nByteLength:S,wrapPrivateKey:I,n:j}=w;if(M&&typeof O!="bigint"){if(r.isBytes(O)&&(O=r.bytesToHex(O)),typeof O!="string"||!M.includes(O.length))throw new Error("Invalid key");O=O.padStart(2*S,"0")}let y;try{y=typeof O=="bigint"?O:r.bytesToNumberBE((0,i.ensureBytes)("private key",O,S))}catch{throw new Error(`private key must be ${S} bytes, hex or bigint, not ${typeof O}`)}return I&&(y=n.mod(y,j)),r.aInRange("private key",y,l,j),y}function q(O){if(!(O instanceof N))throw new Error("ProjectivePoint expected")}const F=(0,i.memoized)(((O,M)=>{const{px:S,py:I,pz:j}=O;if(p.eql(j,p.ONE))return{x:S,y:I};const y=O.is0();M==null&&(M=y?p.ONE:p.inv(j));const E=p.mul(S,M),A=p.mul(I,M),T=p.mul(j,M);if(y)return{x:p.ZERO,y:p.ZERO};if(!p.eql(T,p.ONE))throw new Error("invZ was invalid");return{x:E,y:A}})),D=(0,i.memoized)((O=>{if(O.is0()){if(w.allowInfinityPoint&&!p.is0(O.py))return;throw new Error("bad point: ZERO")}const{x:M,y:S}=O.toAffine();if(!p.isValid(M)||!p.isValid(S))throw new Error("bad point: x or y not FE");const I=p.sqr(S),j=L(M);if(!p.eql(I,j))throw new Error("bad point: equation left != right");if(!O.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0}));class N{constructor(M,S,I){if(this.px=M,this.py=S,this.pz=I,M==null||!p.isValid(M))throw new Error("x required");if(S==null||!p.isValid(S))throw new Error("y required");if(I==null||!p.isValid(I))throw new Error("z required");Object.freeze(this)}static fromAffine(M){const{x:S,y:I}=M||{};if(!M||!p.isValid(S)||!p.isValid(I))throw new Error("invalid affine point");if(M instanceof N)throw new Error("projective point not allowed");const j=y=>p.eql(y,p.ZERO);return j(S)&&j(I)?N.ZERO:new N(S,I,p.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(M){const S=p.invertBatch(M.map((I=>I.pz)));return M.map(((I,j)=>I.toAffine(S[j]))).map(N.fromAffine)}static fromHex(M){const S=N.fromAffine(P((0,i.ensureBytes)("pointHex",M)));return S.assertValidity(),S}static fromPrivateKey(M){return N.BASE.multiply(U(M))}static msm(M,S){return(0,e.pippenger)(N,C,M,S)}_setWindowSize(M){$.setWindowSize(this,M)}assertValidity(){D(this)}hasEvenY(){const{y:M}=this.toAffine();if(p.isOdd)return!p.isOdd(M);throw new Error("Field doesn't support isOdd")}equals(M){q(M);const{px:S,py:I,pz:j}=this,{px:y,py:E,pz:A}=M,T=p.eql(p.mul(S,A),p.mul(y,j)),b=p.eql(p.mul(I,A),p.mul(E,j));return T&&b}negate(){return new N(this.px,p.neg(this.py),this.pz)}double(){const{a:M,b:S}=w,I=p.mul(S,d),{px:j,py:y,pz:E}=this;let A=p.ZERO,T=p.ZERO,b=p.ZERO,v=p.mul(j,j),k=p.mul(y,y),x=p.mul(E,E),R=p.mul(j,y);return R=p.add(R,R),b=p.mul(j,E),b=p.add(b,b),A=p.mul(M,b),T=p.mul(I,x),T=p.add(A,T),A=p.sub(k,T),T=p.add(k,T),T=p.mul(A,T),A=p.mul(R,A),b=p.mul(I,b),x=p.mul(M,x),R=p.sub(v,x),R=p.mul(M,R),R=p.add(R,b),b=p.add(v,v),v=p.add(b,v),v=p.add(v,x),v=p.mul(v,R),T=p.add(T,v),x=p.mul(y,E),x=p.add(x,x),v=p.mul(x,R),A=p.sub(A,v),b=p.mul(x,k),b=p.add(b,b),b=p.add(b,b),new N(A,T,b)}add(M){q(M);const{px:S,py:I,pz:j}=this,{px:y,py:E,pz:A}=M;let T=p.ZERO,b=p.ZERO,v=p.ZERO;const k=w.a,x=p.mul(w.b,d);let R=p.mul(S,y),B=p.mul(I,E),K=p.mul(j,A),z=p.add(S,I),V=p.add(y,E);z=p.mul(z,V),V=p.add(R,B),z=p.sub(z,V),V=p.add(S,j);let Z=p.add(y,A);return V=p.mul(V,Z),Z=p.add(R,K),V=p.sub(V,Z),Z=p.add(I,j),T=p.add(E,A),Z=p.mul(Z,T),T=p.add(B,K),Z=p.sub(Z,T),v=p.mul(k,V),T=p.mul(x,K),v=p.add(T,v),T=p.sub(B,v),v=p.add(B,v),b=p.mul(T,v),B=p.add(R,R),B=p.add(B,R),K=p.mul(k,K),V=p.mul(x,V),B=p.add(B,K),K=p.sub(R,K),K=p.mul(k,K),V=p.add(V,K),R=p.mul(B,V),b=p.add(b,R),R=p.mul(Z,V),T=p.mul(z,T),T=p.sub(T,R),R=p.mul(z,B),v=p.mul(Z,v),v=p.add(v,R),new N(T,b,v)}subtract(M){return this.add(M.negate())}is0(){return this.equals(N.ZERO)}wNAF(M){return $.wNAFCached(this,M,N.normalizeZ)}multiplyUnsafe(M){r.aInRange("scalar",M,a,w.n);const S=N.ZERO;if(M===a)return S;if(M===l)return this;const{endo:I}=w;if(!I)return $.unsafeLadder(this,M);let{k1neg:j,k1:y,k2neg:E,k2:A}=I.splitScalar(M),T=S,b=S,v=this;for(;y>a||A>a;)y&l&&(T=T.add(v)),A&l&&(b=b.add(v)),v=v.double(),y>>=l,A>>=l;return j&&(T=T.negate()),E&&(b=b.negate()),b=new N(p.mul(b.px,I.beta),b.py,b.pz),T.add(b)}multiply(M){const{endo:S,n:I}=w;let j,y;if(r.aInRange("scalar",M,l,I),S){const{k1neg:E,k1:A,k2neg:T,k2:b}=S.splitScalar(M);let{p:v,f:k}=this.wNAF(A),{p:x,f:R}=this.wNAF(b);v=$.constTimeNegate(E,v),x=$.constTimeNegate(T,x),x=new N(p.mul(x.px,S.beta),x.py,x.pz),j=v.add(x),y=k.add(R)}else{const{p:E,f:A}=this.wNAF(M);j=E,y=A}return N.normalizeZ([j,y])[0]}multiplyAndAddUnsafe(M,S,I){const j=N.BASE,y=(A,T)=>T!==a&&T!==l&&A.equals(j)?A.multiply(T):A.multiplyUnsafe(T),E=y(this,S).add(y(M,I));return E.is0()?void 0:E}toAffine(M){return F(this,M)}isTorsionFree(){const{h:M,isTorsionFree:S}=w;if(M===l)return!0;if(S)return S(N,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:M,clearCofactor:S}=w;return M===l?this:S?S(N,this):this.multiplyUnsafe(w.h)}toRawBytes(M=!0){return(0,i.abool)("isCompressed",M),this.assertValidity(),_(N,this,M)}toHex(M=!0){return(0,i.abool)("isCompressed",M),r.bytesToHex(this.toRawBytes(M))}}N.BASE=new N(w.Gx,w.Gy,p.ONE),N.ZERO=new N(p.ZERO,p.ONE,p.ZERO);const H=w.nBitLength,$=(0,e.wNAF)(N,w.endo?Math.ceil(H/2):H);return{CURVE:w,ProjectivePoint:N,normPrivateKeyToScalar:U,weierstrassEquation:L,isWithinCurveOrder:function(O){return r.inRange(O,l,w.n)}}}function m(g,w){const p=g.ORDER;let C=a;for(let O=p-l;O%u===a;O/=u)C+=l;const _=C,P=u<<_-l-l,L=P*u,U=(p-l)/L,q=(U-l)/u,F=L-l,D=P,N=g.pow(w,U),H=g.pow(w,(U+l)/u);let $=(O,M)=>{let S=N,I=g.pow(M,F),j=g.sqr(I);j=g.mul(j,M);let y=g.mul(O,j);y=g.pow(y,q),y=g.mul(y,I),I=g.mul(y,M),j=g.mul(y,O);let E=g.mul(j,I);y=g.pow(E,D);let A=g.eql(y,g.ONE);I=g.mul(j,H),y=g.mul(E,S),j=g.cmov(I,j,A),E=g.cmov(y,E,A);for(let T=_;T>l;T--){let b=T-u;b=u<<b-l;let v=g.pow(E,b);const k=g.eql(v,g.ONE);I=g.mul(j,S),S=g.mul(S,S),v=g.mul(E,S),j=g.cmov(I,j,k),E=g.cmov(v,E,k)}return{isValid:A,value:j}};if(g.ORDER%h===d){const O=(g.ORDER-d)/h,M=g.sqrt(g.neg(w));$=(S,I)=>{let j=g.sqr(I);const y=g.mul(S,I);j=g.mul(j,y);let E=g.pow(j,O);E=g.mul(E,y);const A=g.mul(E,M),T=g.mul(g.sqr(E),I),b=g.eql(T,S);return{isValid:b,value:g.cmov(A,E,b)}}}return $}})(Ma),Object.defineProperty(Li,"__esModule",{value:!0}),Li.getHash=Vc,Li.createCurve=function(t,e){const n=r=>(0,U0.weierstrass)({...t,...Vc(r)});return Object.freeze({...n(e),create:n})};const j0=Ta,zc=tn,U0=Ma;function Vc(t){return{hash:t,hmac:(e,...n)=>(0,j0.hmac)(t,e,(0,zc.concatBytes)(...n)),randomBytes:zc.randomBytes}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.encodeToCurve=t.hashToCurve=t.schnorr=t.secp256k1=void 0;const e=Jt,n=tn,r=Li,i=hn,o=Ce,c=ye,s=Ma,a=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),l=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),u=BigInt(1),d=BigInt(2),h=(y,E)=>(y+E/d)/E;function f(y){const E=a,A=BigInt(3),T=BigInt(6),b=BigInt(11),v=BigInt(22),k=BigInt(23),x=BigInt(44),R=BigInt(88),B=y*y*y%E,K=B*B*y%E,z=(0,o.pow2)(K,A,E)*K%E,V=(0,o.pow2)(z,A,E)*K%E,Z=(0,o.pow2)(V,d,E)*B%E,Q=(0,o.pow2)(Z,b,E)*Z%E,ne=(0,o.pow2)(Q,v,E)*Q%E,oe=(0,o.pow2)(ne,x,E)*ne%E,ue=(0,o.pow2)(oe,R,E)*oe%E,re=(0,o.pow2)(ue,x,E)*ne%E,ie=(0,o.pow2)(re,A,E)*K%E,le=(0,o.pow2)(ie,k,E)*Q%E,se=(0,o.pow2)(le,T,E)*B%E,fe=(0,o.pow2)(se,d,E);if(!m.eql(m.sqr(fe),y))throw new Error("Cannot find square root");return fe}const m=(0,o.Field)(a,void 0,void 0,{sqrt:f});t.secp256k1=(0,r.createCurve)({a:BigInt(0),b:BigInt(7),Fp:m,n:l,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:y=>{const E=l,A=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),T=-u*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),b=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),v=A,k=BigInt("0x100000000000000000000000000000000"),x=h(v*y,E),R=h(-T*y,E);let B=(0,o.mod)(y-x*A-R*b,E),K=(0,o.mod)(-x*T-R*v,E);const z=B>k,V=K>k;if(z&&(B=E-B),V&&(K=E-K),B>k||K>k)throw new Error("splitScalar: Endomorphism failed, k="+y);return{k1neg:z,k1:B,k2neg:V,k2:K}}}},e.sha256);const g=BigInt(0),w={};function p(y,...E){let A=w[y];if(A===void 0){const T=(0,e.sha256)(Uint8Array.from(y,(b=>b.charCodeAt(0))));A=(0,c.concatBytes)(T,T),w[y]=A}return(0,e.sha256)((0,c.concatBytes)(A,...E))}const C=y=>y.toRawBytes(!0).slice(1),_=y=>(0,c.numberToBytesBE)(y,32),P=y=>(0,o.mod)(y,a),L=y=>(0,o.mod)(y,l),U=t.secp256k1.ProjectivePoint,q=(y,E,A)=>U.BASE.multiplyAndAddUnsafe(y,E,A);function F(y){let E=t.secp256k1.utils.normPrivateKeyToScalar(y),A=U.fromPrivateKey(E);return{scalar:A.hasEvenY()?E:L(-E),bytes:C(A)}}function D(y){(0,c.aInRange)("x",y,u,a);const E=P(y*y);let A=f(P(E*y+BigInt(7)));A%d!==g&&(A=P(-A));const T=new U(y,A,u);return T.assertValidity(),T}const N=c.bytesToNumberBE;function H(...y){return L(N(p("BIP0340/challenge",...y)))}function $(y){return F(y).bytes}function O(y,E,A=(0,n.randomBytes)(32)){const T=(0,c.ensureBytes)("message",y),{bytes:b,scalar:v}=F(E),k=(0,c.ensureBytes)("auxRand",A,32),x=_(v^N(p("BIP0340/aux",k))),R=p("BIP0340/nonce",x,b,T),B=L(N(R));if(B===g)throw new Error("sign failed: k is zero");const{bytes:K,scalar:z}=F(B),V=H(K,b,T),Z=new Uint8Array(64);if(Z.set(K,0),Z.set(_(L(z+V*v)),32),!M(Z,T,b))throw new Error("sign: Invalid signature produced");return Z}function M(y,E,A){const T=(0,c.ensureBytes)("signature",y,64),b=(0,c.ensureBytes)("message",E),v=(0,c.ensureBytes)("publicKey",A,32);try{const k=D(N(v)),x=N(T.subarray(0,32));if(!(0,c.inRange)(x,u,a))return!1;const R=N(T.subarray(32,64));if(!(0,c.inRange)(R,u,l))return!1;const B=H(_(x),C(k),b),K=q(k,R,L(-B));return!(!K||!K.hasEvenY()||K.toAffine().x!==x)}catch{return!1}}t.schnorr={getPublicKey:$,sign:O,verify:M,utils:{randomPrivateKey:t.secp256k1.utils.randomPrivateKey,lift_x:D,pointToBytes:C,numberToBytesBE:c.numberToBytesBE,bytesToNumberBE:c.bytesToNumberBE,taggedHash:p,mod:o.mod}};const S=(0,i.isogenyMap)(m,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map((y=>y.map((E=>BigInt(E)))))),I=(0,s.mapToCurveSimpleSWU)(m,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:m.create(BigInt("-11"))}),j=(0,i.createHasher)(t.secp256k1.ProjectivePoint,(y=>{const{x:E,y:A}=I(m.create(y[0]));return S(E,A)}),{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:m.ORDER,m:1,k:128,expand:"xmd",hash:e.sha256});t.hashToCurve=j.hashToCurve,t.encodeToCurve=j.encodeToCurve})(Hd);var zs={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.decodeHex=t.remove0x=void 0;var e=ut;t.remove0x=function(n){return n.startsWith("0x")||n.startsWith("0X")?n.slice(2):n},t.decodeHex=function(n){return(0,e.hexToBytes)((0,t.remove0x)(n))}})(zs),(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.hexToPublicKey=t.convertPublicKeyFormat=t.getSharedPoint=t.getPublicKey=t.isValidPrivateKey=t.getValidSecret=void 0;var e=Ca,n=ld,r=Hd,i=Lr,o=Ne,c=zs;t.getValidSecret=function(){var u;do u=(0,e.randomBytes)(o.SECRET_KEY_LENGTH);while(!(0,t.isValidPrivateKey)(u));return u},t.isValidPrivateKey=function(u){return s((0,i.ellipticCurve)(),(function(d){return d.utils.isValidPrivateKey(u)}),(function(){return!0}),(function(){return!0}))},t.getPublicKey=function(u){return s((0,i.ellipticCurve)(),(function(d){return d.getPublicKey(u)}),(function(d){return d.getPublicKey(u)}),(function(d){return d.getPublicKey(u)}))},t.getSharedPoint=function(u,d,h){return s((0,i.ellipticCurve)(),(function(f){return f.getSharedSecret(u,d,h)}),(function(f){return f.getSharedSecret(u,d)}),(function(f){return l(f,u,d)}))},t.convertPublicKeyFormat=function(u,d){return s((0,i.ellipticCurve)(),(function(h){return h.getSharedSecret(BigInt(1),u,d)}),(function(){return u}),(function(){return u}))};function s(u,d,h,f){if(u==="secp256k1")return d(r.secp256k1);if(u==="x25519")return h(n.x25519);if(u==="ed25519")return f(n.ed25519);throw new Error("Not implemented")}t.hexToPublicKey=function(u){var d=(0,c.decodeHex)(u);return s((0,i.ellipticCurve)(),(function(){return a(d)}),(function(){return d}),(function(){return d}))};var a=function(u){if(u.length===o.ETH_PUBLIC_KEY_SIZE){var d=new Uint8Array(1+u.length);return d.set([4]),d.set(u,1),d}return u},l=function(u,d,h){var f=u.utils.getExtendedPublicKey(d).scalar;return u.ExtendedPoint.fromHex(h).multiply(f).toRawBytes()}})(cd);var Fd={},Zn={};Object.defineProperty(Zn,"__esModule",{value:!0}),Zn.hkdf=void 0,Zn.extract=zd,Zn.expand=Vd;const Vs=ct,Wc=tn,qd=Ta;function zd(t,e,n){return(0,Vs.hash)(t),n===void 0&&(n=new Uint8Array(t.outputLen)),(0,qd.hmac)(t,(0,Wc.toBytes)(n),(0,Wc.toBytes)(e))}const ss=new Uint8Array([0]),Gc=new Uint8Array;function Vd(t,e,n,r=32){if((0,Vs.hash)(t),(0,Vs.number)(r),r>255*t.outputLen)throw new Error("Length should be <= 255*HashLen");const i=Math.ceil(r/t.outputLen);n===void 0&&(n=Gc);const o=new Uint8Array(i*t.outputLen),c=qd.hmac.create(t,e),s=c._cloneInto(),a=new Uint8Array(c.outputLen);for(let l=0;l<i;l++)ss[0]=l+1,s.update(l===0?Gc:a).update(n).update(ss).digestInto(a),o.set(a,t.outputLen*l),c._cloneInto(s);return c.destroy(),s.destroy(),a.fill(0),ss.fill(0),o.slice(0,r)}Zn.hkdf=(t,e,n,r,i)=>Vd(t,zd(t,e,n),r,i),(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getSharedKey=t.deriveKey=void 0;var e=ut,n=Zn,r=Jt;t.deriveKey=function(i,o,c){return(0,n.hkdf)(r.sha256,i,o,c,32)},t.getSharedKey=function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return(0,t.deriveKey)(e.concatBytes.apply(void 0,i))}})(Fd);var Yc={},nr={},Te={},Pn={};Object.defineProperty(Pn,"__esModule",{value:!0}),Pn.polyval=Pn.ghash=void 0,Pn._toGHASHKey=Wd;const In=ze,Ye=ut,zt=16,Ra=new Uint8Array(16),Pt=(0,Ye.u32)(Ra),gt=t=>(t>>>0&255)<<24|(t>>>8&255)<<16|(t>>>16&255)<<8|t>>>24&255|0;function Wd(t){t.reverse();const e=1&t[15];let n=0;for(let r=0;r<t.length;r++){const i=t[r];t[r]=i>>>1|n,n=(1&i)<<7}return t[0]^=225&-e,t}class Gd{constructor(e,n){this.blockLen=zt,this.outputLen=zt,this.s0=0,this.s1=0,this.s2=0,this.s3=0,this.finished=!1,e=(0,Ye.toBytes)(e),(0,In.bytes)(e,16);const r=(0,Ye.createView)(e);let i=r.getUint32(0,!1),o=r.getUint32(4,!1),c=r.getUint32(8,!1),s=r.getUint32(12,!1);const a=[];for(let p=0;p<128;p++)a.push({s0:gt(i),s1:gt(o),s2:gt(c),s3:gt(s)}),{s0:i,s1:o,s2:c,s3:s}={s3:(d=c)<<31|(h=s)>>>1,s2:(u=o)<<31|d>>>1,s1:(l=i)<<31|u>>>1,s0:l>>>1^225<<24&-(1&h)};var l,u,d,h;const f=(p=>p>65536?8:p>1024?4:2)(n||1024);if(![1,2,4,8].includes(f))throw new Error(`ghash: wrong window size=${f}, should be 2, 4 or 8`);this.W=f;const m=128/f,g=this.windowSize=2**f,w=[];for(let p=0;p<m;p++)for(let C=0;C<g;C++){let _=0,P=0,L=0,U=0;for(let q=0;q<f;q++){if(!(C>>>f-q-1&1))continue;const{s0:F,s1:D,s2:N,s3:H}=a[f*p+q];_^=F,P^=D,L^=N,U^=H}w.push({s0:_,s1:P,s2:L,s3:U})}this.t=w}_updateBlock(e,n,r,i){e^=this.s0,n^=this.s1,r^=this.s2,i^=this.s3;const{W:o,t:c,windowSize:s}=this;let a=0,l=0,u=0,d=0;const h=(1<<o)-1;let f=0;for(const m of[e,n,r,i])for(let g=0;g<4;g++){const w=m>>>8*g&255;for(let p=8/o-1;p>=0;p--){const C=w>>>o*p&h,{s0:_,s1:P,s2:L,s3:U}=c[f*s+C];a^=_,l^=P,u^=L,d^=U,f+=1}}this.s0=a,this.s1=l,this.s2=u,this.s3=d}update(e){e=(0,Ye.toBytes)(e),(0,In.exists)(this);const n=(0,Ye.u32)(e),r=Math.floor(e.length/zt),i=e.length%zt;for(let o=0;o<r;o++)this._updateBlock(n[4*o+0],n[4*o+1],n[4*o+2],n[4*o+3]);return i&&(Ra.set(e.subarray(r*zt)),this._updateBlock(Pt[0],Pt[1],Pt[2],Pt[3]),(0,Ye.clean)(Pt)),this}destroy(){const{t:e}=this;for(const n of e)n.s0=0,n.s1=0,n.s2=0,n.s3=0}digestInto(e){(0,In.exists)(this),(0,In.output)(e,this),this.finished=!0;const{s0:n,s1:r,s2:i,s3:o}=this,c=(0,Ye.u32)(e);return c[0]=n,c[1]=r,c[2]=i,c[3]=o,e}digest(){const e=new Uint8Array(zt);return this.digestInto(e),this.destroy(),e}}class H0 extends Gd{constructor(e,n){e=(0,Ye.toBytes)(e);const r=Wd((0,Ye.copyBytes)(e));super(r,n),(0,Ye.clean)(r)}update(e){e=(0,Ye.toBytes)(e),(0,In.exists)(this);const n=(0,Ye.u32)(e),r=e.length%zt,i=Math.floor(e.length/zt);for(let o=0;o<i;o++)this._updateBlock(gt(n[4*o+3]),gt(n[4*o+2]),gt(n[4*o+1]),gt(n[4*o+0]));return r&&(Ra.set(e.subarray(i*zt)),this._updateBlock(gt(Pt[3]),gt(Pt[2]),gt(Pt[1]),gt(Pt[0])),(0,Ye.clean)(Pt)),this}digestInto(e){(0,In.exists)(this),(0,In.output)(e,this),this.finished=!0;const{s0:n,s1:r,s2:i,s3:o}=this,c=(0,Ye.u32)(e);return c[0]=n,c[1]=r,c[2]=i,c[3]=o,e.reverse()}}function Zc(t){const e=(r,i)=>t(i,r.length).update((0,Ye.toBytes)(r)).digest(),n=t(new Uint8Array(16),0);return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=(r,i)=>t(r,i),e}Pn.ghash=Zc(((t,e)=>new Gd(t,e))),Pn.polyval=Zc(((t,e)=>new H0(t,e))),Object.defineProperty(Te,"__esModule",{value:!0}),Te.unsafe=Te.aeskwp=Te.aeskw=Te.siv=Te.gcm=Te.cfb=Te.cbc=Te.ecb=Te.ctr=void 0,Te.expandKeyLE=Ct,Te.expandKeyDecLE=Dr;const we=ze,Ws=Pn,ee=ut,rt=16,mi=new Uint8Array(rt),F0=283;function Oa(t){return t<<1^F0&-(t>>7)}function Jn(t,e){let n=0;for(;e>0;e>>=1)n^=t&-(1&e),t=Oa(t);return n}const Gs=(()=>{const t=new Uint8Array(256);for(let n=0,r=1;n<256;n++,r^=Oa(r))t[n]=r;const e=new Uint8Array(256);e[0]=99;for(let n=0;n<255;n++){let r=t[255-n];r|=r<<8,e[t[n]]=255&(r^r>>4^r>>5^r>>6^r>>7^99)}return(0,ee.clean)(t),e})(),q0=Gs.map(((t,e)=>Gs.indexOf(e))),z0=t=>t<<24|t>>>8,as=t=>t<<8|t>>>24,no=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function Yd(t,e){if(t.length!==256)throw new Error("Wrong sbox length");const n=new Uint32Array(256).map(((l,u)=>e(t[u]))),r=n.map(as),i=r.map(as),o=i.map(as),c=new Uint32Array(65536),s=new Uint32Array(65536),a=new Uint16Array(65536);for(let l=0;l<256;l++)for(let u=0;u<256;u++){const d=256*l+u;c[d]=n[l]^r[u],s[d]=i[l]^o[u],a[d]=t[l]<<8|t[u]}return{sbox:t,sbox2:a,T0:n,T1:r,T2:i,T3:o,T01:c,T23:s}}const Pa=Yd(Gs,(t=>Jn(t,3)<<24|t<<16|t<<8|Jn(t,2))),Zd=Yd(q0,(t=>Jn(t,11)<<24|Jn(t,13)<<16|Jn(t,9)<<8|Jn(t,14))),V0=(()=>{const t=new Uint8Array(16);for(let e=0,n=1;e<16;e++,n=Oa(n))t[e]=n;return t})();function Ct(t){(0,we.bytes)(t);const e=t.length;if(![16,24,32].includes(e))throw new Error(`aes: wrong key size: should be 16, 24 or 32, got: ${e}`);const{sbox2:n}=Pa,r=[];(0,ee.isAligned32)(t)||r.push(t=(0,ee.copyBytes)(t));const i=(0,ee.u32)(t),o=i.length,c=a=>Lt(n,a,a,a,a),s=new Uint32Array(e+28);s.set(i);for(let a=o;a<s.length;a++){let l=s[a-1];a%o==0?l=c(z0(l))^V0[a/o-1]:o>6&&a%o==4&&(l=c(l)),s[a]=s[a-o]^l}return(0,ee.clean)(...r),s}function Dr(t){const e=Ct(t),n=e.slice(),r=e.length,{sbox2:i}=Pa,{T0:o,T1:c,T2:s,T3:a}=Zd;for(let l=0;l<r;l+=4)for(let u=0;u<4;u++)n[l+u]=e[r-l-4+u];(0,ee.clean)(e);for(let l=4;l<r-4;l++){const u=n[l],d=Lt(i,u,u,u,u);n[l]=o[255&d]^c[d>>>8&255]^s[d>>>16&255]^a[d>>>24]}return n}function wn(t,e,n,r,i,o){return t[n<<8&65280|r>>>8&255]^e[i>>>8&65280|o>>>24&255]}function Lt(t,e,n,r,i){return t[255&e|65280&n]|t[r>>>16&255|i>>>16&65280]<<16}function Ze(t,e,n,r,i){const{sbox2:o,T01:c,T23:s}=Pa;let a=0;e^=t[a++],n^=t[a++],r^=t[a++],i^=t[a++];const l=t.length/4-2;for(let u=0;u<l;u++){const d=t[a++]^wn(c,s,e,n,r,i),h=t[a++]^wn(c,s,n,r,i,e),f=t[a++]^wn(c,s,r,i,e,n),m=t[a++]^wn(c,s,i,e,n,r);e=d,n=h,r=f,i=m}return{s0:t[a++]^Lt(o,e,n,r,i),s1:t[a++]^Lt(o,n,r,i,e),s2:t[a++]^Lt(o,r,i,e,n),s3:t[a++]^Lt(o,i,e,n,r)}}function Br(t,e,n,r,i){const{sbox2:o,T01:c,T23:s}=Zd;let a=0;e^=t[a++],n^=t[a++],r^=t[a++],i^=t[a++];const l=t.length/4-2;for(let u=0;u<l;u++){const d=t[a++]^wn(c,s,e,i,r,n),h=t[a++]^wn(c,s,n,e,i,r),f=t[a++]^wn(c,s,r,n,e,i),m=t[a++]^wn(c,s,i,r,n,e);e=d,n=h,r=f,i=m}return{s0:t[a++]^Lt(o,e,i,r,n),s1:t[a++]^Lt(o,n,e,i,r),s2:t[a++]^Lt(o,r,n,e,i),s3:t[a++]^Lt(o,i,r,n,e)}}function rr(t,e){if(e===void 0)return new Uint8Array(t);if((0,we.bytes)(e),e.length<t)throw new Error(`aes: wrong destination length, expected at least ${t}, got: ${e.length}`);if(!(0,ee.isAligned32)(e))throw new Error("unaligned dst");return e}function Jd(t,e,n,r){(0,we.bytes)(e,rt),(0,we.bytes)(n);const i=n.length;r=rr(i,r);const o=e,c=(0,ee.u32)(o);let{s0:s,s1:a,s2:l,s3:u}=Ze(t,c[0],c[1],c[2],c[3]);const d=(0,ee.u32)(n),h=(0,ee.u32)(r);for(let m=0;m+4<=d.length;m+=4){h[m+0]=d[m+0]^s,h[m+1]=d[m+1]^a,h[m+2]=d[m+2]^l,h[m+3]=d[m+3]^u;let g=1;for(let w=o.length-1;w>=0;w--)g=g+(255&o[w])|0,o[w]=255&g,g>>>=8;({s0:s,s1:a,s2:l,s3:u}=Ze(t,c[0],c[1],c[2],c[3]))}const f=rt*Math.floor(d.length/4);if(f<i){const m=new Uint32Array([s,a,l,u]),g=(0,ee.u8)(m);for(let w=f,p=0;w<i;w++,p++)r[w]=n[w]^g[p];(0,ee.clean)(m)}return r}function Xn(t,e,n,r,i){(0,we.bytes)(n,rt),(0,we.bytes)(r),i=rr(r.length,i);const o=n,c=(0,ee.u32)(o),s=(0,ee.createView)(o),a=(0,ee.u32)(r),l=(0,ee.u32)(i),u=e?0:12,d=r.length;let h=s.getUint32(u,e),{s0:f,s1:m,s2:g,s3:w}=Ze(t,c[0],c[1],c[2],c[3]);for(let C=0;C+4<=a.length;C+=4)l[C+0]=a[C+0]^f,l[C+1]=a[C+1]^m,l[C+2]=a[C+2]^g,l[C+3]=a[C+3]^w,h=h+1>>>0,s.setUint32(u,h,e),{s0:f,s1:m,s2:g,s3:w}=Ze(t,c[0],c[1],c[2],c[3]);const p=rt*Math.floor(a.length/4);if(p<d){const C=new Uint32Array([f,m,g,w]),_=(0,ee.u8)(C);for(let P=p,L=0;P<d;P++,L++)i[P]=r[P]^_[L];(0,ee.clean)(C)}return i}function Jc(t){if((0,we.bytes)(t),t.length%rt!=0)throw new Error("aes/(cbc-ecb).decrypt ciphertext should consist of blocks with size 16")}function Xc(t,e,n){(0,we.bytes)(t);let r=t.length;const i=r%rt;if(!e&&i!==0)throw new Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");(0,ee.isAligned32)(t)||(t=(0,ee.copyBytes)(t));const o=(0,ee.u32)(t);if(e){let s=rt-i;s||(s=rt),r+=s}const c=rr(r,n);return{b:o,o:(0,ee.u32)(c),out:c}}function Qc(t,e){if(!e)return t;const n=t.length;if(!n)throw new Error("aes/pcks5: empty ciphertext not allowed");const r=t[n-1];if(r<=0||r>16)throw new Error("aes/pcks5: wrong padding");const i=t.subarray(0,-r);for(let o=0;o<r;o++)if(t[n-o-1]!==r)throw new Error("aes/pcks5: wrong padding");return i}function el(t){const e=new Uint8Array(16),n=(0,ee.u32)(e);e.set(t);const r=rt-t.length;for(let i=rt-r;i<rt;i++)e[i]=r;return n}function Xd(t,e,n,r,i){const o=i==null?0:i.length,c=t.create(n,r.length+o);i&&c.update(i),c.update(r);const s=new Uint8Array(16),a=(0,ee.createView)(s);i&&(0,ee.setBigUint64)(a,0,BigInt(8*o),e),(0,ee.setBigUint64)(a,8,BigInt(8*r.length),e),c.update(s);const l=c.digest();return(0,ee.clean)(s),l}Te.ctr=(0,ee.wrapCipher)({blockSize:16,nonceLength:16},(function(t,e){function n(r,i){if((0,we.bytes)(r),i!==void 0&&((0,we.bytes)(i),!(0,ee.isAligned32)(i)))throw new Error("unaligned destination");const o=Ct(t),c=(0,ee.copyBytes)(e),s=[o,c];(0,ee.isAligned32)(r)||s.push(r=(0,ee.copyBytes)(r));const a=Jd(o,c,r,i);return(0,ee.clean)(...s),a}return(0,we.bytes)(t),(0,we.bytes)(e,rt),{encrypt:(r,i)=>n(r,i),decrypt:(r,i)=>n(r,i)}})),Te.ecb=(0,ee.wrapCipher)({blockSize:16},(function(t,e={}){(0,we.bytes)(t);const n=!e.disablePadding;return{encrypt(r,i){const{b:o,o:c,out:s}=Xc(r,n,i),a=Ct(t);let l=0;for(;l+4<=o.length;){const{s0:u,s1:d,s2:h,s3:f}=Ze(a,o[l+0],o[l+1],o[l+2],o[l+3]);c[l++]=u,c[l++]=d,c[l++]=h,c[l++]=f}if(n){const u=el(r.subarray(4*l)),{s0:d,s1:h,s2:f,s3:m}=Ze(a,u[0],u[1],u[2],u[3]);c[l++]=d,c[l++]=h,c[l++]=f,c[l++]=m}return(0,ee.clean)(a),s},decrypt(r,i){Jc(r);const o=Dr(t),c=rr(r.length,i),s=[o];(0,ee.isAligned32)(r)||s.push(r=(0,ee.copyBytes)(r));const a=(0,ee.u32)(r),l=(0,ee.u32)(c);for(let u=0;u+4<=a.length;){const{s0:d,s1:h,s2:f,s3:m}=Br(o,a[u+0],a[u+1],a[u+2],a[u+3]);l[u++]=d,l[u++]=h,l[u++]=f,l[u++]=m}return(0,ee.clean)(...s),Qc(c,n)}}})),Te.cbc=(0,ee.wrapCipher)({blockSize:16,nonceLength:16},(function(t,e,n={}){(0,we.bytes)(t),(0,we.bytes)(e,16);const r=!n.disablePadding;return{encrypt(i,o){const c=Ct(t),{b:s,o:a,out:l}=Xc(i,r,o);let u=e;const d=[c];(0,ee.isAligned32)(u)||d.push(u=(0,ee.copyBytes)(u));const h=(0,ee.u32)(u);let f=h[0],m=h[1],g=h[2],w=h[3],p=0;for(;p+4<=s.length;)f^=s[p+0],m^=s[p+1],g^=s[p+2],w^=s[p+3],{s0:f,s1:m,s2:g,s3:w}=Ze(c,f,m,g,w),a[p++]=f,a[p++]=m,a[p++]=g,a[p++]=w;if(r){const C=el(i.subarray(4*p));f^=C[0],m^=C[1],g^=C[2],w^=C[3],{s0:f,s1:m,s2:g,s3:w}=Ze(c,f,m,g,w),a[p++]=f,a[p++]=m,a[p++]=g,a[p++]=w}return(0,ee.clean)(...d),l},decrypt(i,o){Jc(i);const c=Dr(t);let s=e;const a=[c];(0,ee.isAligned32)(s)||a.push(s=(0,ee.copyBytes)(s));const l=(0,ee.u32)(s),u=rr(i.length,o);(0,ee.isAligned32)(i)||a.push(i=(0,ee.copyBytes)(i));const d=(0,ee.u32)(i),h=(0,ee.u32)(u);let f=l[0],m=l[1],g=l[2],w=l[3];for(let p=0;p+4<=d.length;){const C=f,_=m,P=g,L=w;f=d[p+0],m=d[p+1],g=d[p+2],w=d[p+3];const{s0:U,s1:q,s2:F,s3:D}=Br(c,f,m,g,w);h[p++]=U^C,h[p++]=q^_,h[p++]=F^P,h[p++]=D^L}return(0,ee.clean)(...a),Qc(u,r)}}})),Te.cfb=(0,ee.wrapCipher)({blockSize:16,nonceLength:16},(function(t,e){function n(r,i,o){(0,we.bytes)(r);const c=r.length;o=rr(c,o);const s=Ct(t);let a=e;const l=[s];(0,ee.isAligned32)(a)||l.push(a=(0,ee.copyBytes)(a)),(0,ee.isAligned32)(r)||l.push(r=(0,ee.copyBytes)(r));const u=(0,ee.u32)(r),d=(0,ee.u32)(o),h=i?d:u,f=(0,ee.u32)(a);let m=f[0],g=f[1],w=f[2],p=f[3];for(let _=0;_+4<=u.length;){const{s0:P,s1:L,s2:U,s3:q}=Ze(s,m,g,w,p);d[_+0]=u[_+0]^P,d[_+1]=u[_+1]^L,d[_+2]=u[_+2]^U,d[_+3]=u[_+3]^q,m=h[_++],g=h[_++],w=h[_++],p=h[_++]}const C=rt*Math.floor(u.length/4);if(C<c){({s0:m,s1:g,s2:w,s3:p}=Ze(s,m,g,w,p));const _=(0,ee.u8)(new Uint32Array([m,g,w,p]));for(let P=C,L=0;P<c;P++,L++)o[P]=r[P]^_[L];(0,ee.clean)(_)}return(0,ee.clean)(...l),o}return(0,we.bytes)(t),(0,we.bytes)(e,16),{encrypt:(r,i)=>n(r,!0,i),decrypt:(r,i)=>n(r,!1,i)}})),Te.gcm=(0,ee.wrapCipher)({blockSize:16,nonceLength:12,tagLength:16},(function(t,e,n){if((0,we.bytes)(t),(0,we.bytes)(e),n!==void 0&&(0,we.bytes)(n),e.length<8)throw new Error("aes/gcm: invalid nonce length");const r=16;function i(c,s,a){const l=Xd(Ws.ghash,!1,c,a,n);for(let u=0;u<s.length;u++)l[u]^=s[u];return l}function o(){const c=Ct(t),s=mi.slice(),a=mi.slice();if(Xn(c,!1,a,a,s),e.length===12)a.set(e);else{const l=mi.slice(),u=(0,ee.createView)(l);(0,ee.setBigUint64)(u,8,BigInt(8*e.length),!1);const d=Ws.ghash.create(s).update(e).update(l);d.digestInto(a),d.destroy()}return{xk:c,authKey:s,counter:a,tagMask:Xn(c,!1,a,mi)}}return{encrypt(c){(0,we.bytes)(c);const{xk:s,authKey:a,counter:l,tagMask:u}=o(),d=new Uint8Array(c.length+r),h=[s,a,l,u];(0,ee.isAligned32)(c)||h.push(c=(0,ee.copyBytes)(c)),Xn(s,!1,l,c,d);const f=i(a,u,d.subarray(0,d.length-r));return h.push(f),d.set(f,c.length),(0,ee.clean)(...h),d},decrypt(c){if((0,we.bytes)(c),c.length<r)throw new Error("aes/gcm: ciphertext less than tagLen (16)");const{xk:s,authKey:a,counter:l,tagMask:u}=o(),d=[s,a,u,l];(0,ee.isAligned32)(c)||d.push(c=(0,ee.copyBytes)(c));const h=c.subarray(0,-16),f=c.subarray(-16),m=i(a,u,h);if(d.push(m),!(0,ee.equalBytes)(m,f))throw new Error("aes/gcm: invalid ghash tag");const g=Xn(s,!1,l,h);return(0,ee.clean)(...d),g}}}));const gi=(t,e,n)=>r=>{if(!Number.isSafeInteger(r)||e>r||r>n)throw new Error(`${t}: invalid value=${r}, must be [${e}..${n}]`)};function Qd(t){return t!=null&&typeof t=="object"&&(t instanceof Uint32Array||t.constructor.name==="Uint32Array")}function eh(t,e){if((0,we.bytes)(e,16),!Qd(t))throw new Error("_encryptBlock accepts result of expandKeyLE");const n=(0,ee.u32)(e);let{s0:r,s1:i,s2:o,s3:c}=Ze(t,n[0],n[1],n[2],n[3]);return n[0]=r,n[1]=i,n[2]=o,n[3]=c,e}function th(t,e){if((0,we.bytes)(e,16),!Qd(t))throw new Error("_decryptBlock accepts result of expandKeyLE");const n=(0,ee.u32)(e);let{s0:r,s1:i,s2:o,s3:c}=Br(t,n[0],n[1],n[2],n[3]);return n[0]=r,n[1]=i,n[2]=o,n[3]=c,e}Te.siv=(0,ee.wrapCipher)({blockSize:16,nonceLength:12,tagLength:16},(function(t,e,n){const r=gi("AAD",0,68719476736),i=gi("plaintext",0,2**36),o=gi("nonce",12,12),c=gi("ciphertext",16,2**36+16);function s(){const u=Ct(t),d=new Uint8Array(t.length),h=new Uint8Array(16),f=[u,d];let m=e;(0,ee.isAligned32)(m)||f.push(m=(0,ee.copyBytes)(m));const g=(0,ee.u32)(m);let w=0,p=g[0],C=g[1],_=g[2],P=0;for(const U of[h,d].map(ee.u32)){const q=(0,ee.u32)(U);for(let F=0;F<q.length;F+=2){const{s0:D,s1:N}=Ze(u,w,p,C,_);q[F+0]=D,q[F+1]=N,w=++P}}const L={authKey:h,encKey:Ct(d)};return(0,ee.clean)(...f),L}function a(u,d,h){const f=Xd(Ws.polyval,!0,d,h,n);for(let _=0;_<12;_++)f[_]^=e[_];f[15]&=127;const m=(0,ee.u32)(f);let g=m[0],w=m[1],p=m[2],C=m[3];return{s0:g,s1:w,s2:p,s3:C}=Ze(u,g,w,p,C),m[0]=g,m[1]=w,m[2]=p,m[3]=C,f}function l(u,d,h){let f=(0,ee.copyBytes)(d);f[15]|=128;const m=Xn(u,!0,f,h);return(0,ee.clean)(f),m}return(0,we.bytes)(t,16,24,32),(0,we.bytes)(e),o(e.length),n!==void 0&&((0,we.bytes)(n),r(n.length)),{encrypt(u){(0,we.bytes)(u),i(u.length);const{encKey:d,authKey:h}=s(),f=a(d,h,u),m=[d,h,f];(0,ee.isAligned32)(u)||m.push(u=(0,ee.copyBytes)(u));const g=new Uint8Array(u.length+16);return g.set(f,u.length),g.set(l(d,f,u)),(0,ee.clean)(...m),g},decrypt(u){(0,we.bytes)(u),c(u.length);const d=u.subarray(-16),{encKey:h,authKey:f}=s(),m=[h,f];(0,ee.isAligned32)(u)||m.push(u=(0,ee.copyBytes)(u));const g=l(h,d,u.subarray(0,-16)),w=a(h,f,g);if(m.push(w),!(0,ee.equalBytes)(d,w))throw(0,ee.clean)(...m),new Error("invalid polyval tag");return(0,ee.clean)(...m),g}}}));const ro={encrypt(t,e){if(e.length>=2**32)throw new Error("plaintext should be less than 4gb");const n=Ct(t);if(e.length===16)eh(n,e);else{const r=(0,ee.u32)(e);let i=r[0],o=r[1];for(let c=0,s=1;c<6;c++)for(let a=2;a<r.length;a+=2,s++){const{s0:l,s1:u,s2:d,s3:h}=Ze(n,i,o,r[a],r[a+1]);i=l,o=u^no(s),r[a]=d,r[a+1]=h}r[0]=i,r[1]=o}n.fill(0)},decrypt(t,e){if(e.length-8>=2**32)throw new Error("ciphertext should be less than 4gb");const n=Dr(t),r=e.length/8-1;if(r===1)th(n,e);else{const i=(0,ee.u32)(e);let o=i[0],c=i[1];for(let s=0,a=6*r;s<6;s++)for(let l=2*r;l>=1;l-=2,a--){c^=no(a);const{s0:u,s1:d,s2:h,s3:f}=Br(n,o,c,i[l],i[l+1]);o=u,c=d,i[l]=h,i[l+1]=f}i[0]=o,i[1]=c}n.fill(0)}},tl=new Uint8Array(8).fill(166);Te.aeskw=(0,ee.wrapCipher)({blockSize:8},(t=>({encrypt(e){if((0,we.bytes)(e),!e.length||e.length%8!=0)throw new Error("invalid plaintext length");if(e.length===8)throw new Error("8-byte keys not allowed in AESKW, use AESKWP instead");const n=(0,ee.concatBytes)(tl,e);return ro.encrypt(t,n),n},decrypt(e){if((0,we.bytes)(e),e.length%8!=0||e.length<24)throw new Error("invalid ciphertext length");const n=(0,ee.copyBytes)(e);if(ro.decrypt(t,n),!(0,ee.equalBytes)(n.subarray(0,8),tl))throw new Error("integrity check failed");return n.subarray(0,8).fill(0),n.subarray(8)}})));const nl=2790873510;Te.aeskwp=(0,ee.wrapCipher)({blockSize:8},(t=>({encrypt(e){if((0,we.bytes)(e),!e.length)throw new Error("invalid plaintext length");const n=8*Math.ceil(e.length/8),r=new Uint8Array(8+n);r.set(e,8);const i=(0,ee.u32)(r);return i[0]=nl,i[1]=no(e.length),ro.encrypt(t,r),r},decrypt(e){if((0,we.bytes)(e),e.length<16)throw new Error("invalid ciphertext length");const n=(0,ee.copyBytes)(e),r=(0,ee.u32)(n);ro.decrypt(t,n);const i=no(r[1])>>>0,o=8*Math.ceil(i/8);if(r[0]!==nl||n.length-8!==o)throw new Error("integrity check failed");for(let c=i;c<o;c++)if(n[8+c]!==0)throw new Error("integrity check failed");return n.subarray(0,8).fill(0),n.subarray(8,8+i)}}))),Te.unsafe={expandKeyLE:Ct,expandKeyDecLE:Dr,encrypt:Ze,decrypt:Br,encryptBlock:eh,decryptBlock:th,ctrCounter:Jd,ctr32:Xn},Object.defineProperty(nr,"__esModule",{value:!0}),nr.aes256cbc=nr.aes256gcm=void 0;var nh=Te;nr.aes256gcm=function(t,e,n){return(0,nh.gcm)(t,e,n)};nr.aes256cbc=function(t,e,n){return(0,nh.cbc)(t,e)};var io={},rh={},Qn={};Object.defineProperty(Qn,"__esModule",{value:!0}),Qn.sigma=void 0,Qn.rotl=function(t,e){return t<<e|t>>>32-e},Qn.createCipher=function(t,e){const{allowShortKeys:n,extendNonceFn:r,counterLength:i,counterRight:o,rounds:c}=(0,pt.checkOpts)({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},e);if(typeof t!="function")throw new Error("core must be a function");return(0,qt.number)(i),(0,qt.number)(c),(0,qt.bool)(o),(0,qt.bool)(n),(s,a,l,u,d=0)=>{(0,qt.bytes)(s),(0,qt.bytes)(a),(0,qt.bytes)(l);const h=l.length;if(u===void 0&&(u=new Uint8Array(h)),(0,qt.bytes)(u),(0,qt.number)(d),d<0||d>=rl)throw new Error("arx: counter overflow");if(u.length<h)throw new Error(`arx: output (${u.length}) is shorter than data (${h})`);const f=[];let m,g,w=s.length;if(w===32)f.push(m=(0,pt.copyBytes)(s)),g=oh;else{if(w!==16||!n)throw new Error(`arx: invalid 32-byte key, got length=${w}`);m=new Uint8Array(32),m.set(s),m.set(s,16),g=Y0,f.push(m)}cs(a)||f.push(a=(0,pt.copyBytes)(a));const p=(0,pt.u32)(m);if(r){if(a.length!==24)throw new Error("arx: extended nonce must be 24 bytes");r(g,p,(0,pt.u32)(a.subarray(0,16)),p),a=a.subarray(16)}const C=16-i;if(C!==a.length)throw new Error(`arx: nonce must be ${C} or 16 bytes`);if(C!==12){const P=new Uint8Array(12);P.set(a,o?0:12-a.length),a=P,f.push(a)}const _=(0,pt.u32)(a);return(function(P,L,U,q,F,D,N,H){const $=F.length,O=new Uint8Array(yi),M=(0,pt.u32)(O),S=cs(F)&&cs(D),I=S?(0,pt.u32)(F):il,j=S?(0,pt.u32)(D):il;for(let y=0;y<$;N++){if(P(L,U,q,M,N,H),N>=rl)throw new Error("arx: counter overflow");const E=Math.min(yi,$-y);if(S&&E===yi){const A=y/4;if(y%4!=0)throw new Error("arx: invalid block position");for(let T,b=0;b<Z0;b++)T=A+b,j[T]=I[T]^M[b];y+=yi}else{for(let A,T=0;T<E;T++)A=y+T,D[A]=F[A]^O[T];y+=E}}})(t,g,p,_,l,u,d,c),(0,pt.clean)(...f),u}};const qt=ze,pt=ut,ih=t=>Uint8Array.from(t.split("").map((e=>e.charCodeAt(0)))),W0=ih("expand 16-byte k"),G0=ih("expand 32-byte k"),Y0=(0,pt.u32)(W0),oh=(0,pt.u32)(G0);function cs(t){return t.byteOffset%4==0}Qn.sigma=oh.slice();const yi=64,Z0=16,rl=2**32-1,il=new Uint32Array;var Ar={};Object.defineProperty(Ar,"__esModule",{value:!0}),Ar.poly1305=void 0,Ar.wrapConstructorWithKey=sh;const vi=ze,_r=ut,$e=(t,e)=>255&t[e++]|(255&t[e++])<<8;class J0{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,e=(0,_r.toBytes)(e),(0,vi.bytes)(e,32);const n=$e(e,0),r=$e(e,2),i=$e(e,4),o=$e(e,6),c=$e(e,8),s=$e(e,10),a=$e(e,12),l=$e(e,14);this.r[0]=8191&n,this.r[1]=8191&(n>>>13|r<<3),this.r[2]=7939&(r>>>10|i<<6),this.r[3]=8191&(i>>>7|o<<9),this.r[4]=255&(o>>>4|c<<12),this.r[5]=c>>>1&8190,this.r[6]=8191&(c>>>14|s<<2),this.r[7]=8065&(s>>>11|a<<5),this.r[8]=8191&(a>>>8|l<<8),this.r[9]=l>>>5&127;for(let u=0;u<8;u++)this.pad[u]=$e(e,16+2*u)}process(e,n,r=!1){const i=r?0:2048,{h:o,r:c}=this,s=c[0],a=c[1],l=c[2],u=c[3],d=c[4],h=c[5],f=c[6],m=c[7],g=c[8],w=c[9],p=$e(e,n+0),C=$e(e,n+2),_=$e(e,n+4),P=$e(e,n+6),L=$e(e,n+8),U=$e(e,n+10),q=$e(e,n+12),F=$e(e,n+14);let D=o[0]+(8191&p),N=o[1]+(8191&(p>>>13|C<<3)),H=o[2]+(8191&(C>>>10|_<<6)),$=o[3]+(8191&(_>>>7|P<<9)),O=o[4]+(8191&(P>>>4|L<<12)),M=o[5]+(L>>>1&8191),S=o[6]+(8191&(L>>>14|U<<2)),I=o[7]+(8191&(U>>>11|q<<5)),j=o[8]+(8191&(q>>>8|F<<8)),y=o[9]+(F>>>5|i),E=0,A=E+D*s+N*(5*w)+H*(5*g)+$*(5*m)+O*(5*f);E=A>>>13,A&=8191,A+=M*(5*h)+S*(5*d)+I*(5*u)+j*(5*l)+y*(5*a),E+=A>>>13,A&=8191;let T=E+D*a+N*s+H*(5*w)+$*(5*g)+O*(5*m);E=T>>>13,T&=8191,T+=M*(5*f)+S*(5*h)+I*(5*d)+j*(5*u)+y*(5*l),E+=T>>>13,T&=8191;let b=E+D*l+N*a+H*s+$*(5*w)+O*(5*g);E=b>>>13,b&=8191,b+=M*(5*m)+S*(5*f)+I*(5*h)+j*(5*d)+y*(5*u),E+=b>>>13,b&=8191;let v=E+D*u+N*l+H*a+$*s+O*(5*w);E=v>>>13,v&=8191,v+=M*(5*g)+S*(5*m)+I*(5*f)+j*(5*h)+y*(5*d),E+=v>>>13,v&=8191;let k=E+D*d+N*u+H*l+$*a+O*s;E=k>>>13,k&=8191,k+=M*(5*w)+S*(5*g)+I*(5*m)+j*(5*f)+y*(5*h),E+=k>>>13,k&=8191;let x=E+D*h+N*d+H*u+$*l+O*a;E=x>>>13,x&=8191,x+=M*s+S*(5*w)+I*(5*g)+j*(5*m)+y*(5*f),E+=x>>>13,x&=8191;let R=E+D*f+N*h+H*d+$*u+O*l;E=R>>>13,R&=8191,R+=M*a+S*s+I*(5*w)+j*(5*g)+y*(5*m),E+=R>>>13,R&=8191;let B=E+D*m+N*f+H*h+$*d+O*u;E=B>>>13,B&=8191,B+=M*l+S*a+I*s+j*(5*w)+y*(5*g),E+=B>>>13,B&=8191;let K=E+D*g+N*m+H*f+$*h+O*d;E=K>>>13,K&=8191,K+=M*u+S*l+I*a+j*s+y*(5*w),E+=K>>>13,K&=8191;let z=E+D*w+N*g+H*m+$*f+O*h;E=z>>>13,z&=8191,z+=M*d+S*u+I*l+j*a+y*s,E+=z>>>13,z&=8191,E=(E<<2)+E|0,E=E+A|0,A=8191&E,E>>>=13,T+=E,o[0]=A,o[1]=T,o[2]=b,o[3]=v,o[4]=k,o[5]=x,o[6]=R,o[7]=B,o[8]=K,o[9]=z}finalize(){const{h:e,pad:n}=this,r=new Uint16Array(10);let i=e[1]>>>13;e[1]&=8191;for(let s=2;s<10;s++)e[s]+=i,i=e[s]>>>13,e[s]&=8191;e[0]+=5*i,i=e[0]>>>13,e[0]&=8191,e[1]+=i,i=e[1]>>>13,e[1]&=8191,e[2]+=i,r[0]=e[0]+5,i=r[0]>>>13,r[0]&=8191;for(let s=1;s<10;s++)r[s]=e[s]+i,i=r[s]>>>13,r[s]&=8191;r[9]-=8192;let o=(1^i)-1;for(let s=0;s<10;s++)r[s]&=o;o=~o;for(let s=0;s<10;s++)e[s]=e[s]&o|r[s];e[0]=65535&(e[0]|e[1]<<13),e[1]=65535&(e[1]>>>3|e[2]<<10),e[2]=65535&(e[2]>>>6|e[3]<<7),e[3]=65535&(e[3]>>>9|e[4]<<4),e[4]=65535&(e[4]>>>12|e[5]<<1|e[6]<<14),e[5]=65535&(e[6]>>>2|e[7]<<11),e[6]=65535&(e[7]>>>5|e[8]<<8),e[7]=65535&(e[8]>>>8|e[9]<<5);let c=e[0]+n[0];e[0]=65535&c;for(let s=1;s<8;s++)c=(e[s]+n[s]|0)+(c>>>16)|0,e[s]=65535&c;(0,_r.clean)(r)}update(e){(0,vi.exists)(this);const{buffer:n,blockLen:r}=this,i=(e=(0,_r.toBytes)(e)).length;for(let o=0;o<i;){const c=Math.min(r-this.pos,i-o);if(c!==r)n.set(e.subarray(o,o+c),this.pos),this.pos+=c,o+=c,this.pos===r&&(this.process(n,0,!1),this.pos=0);else for(;r<=i-o;o+=r)this.process(e,o)}return this}destroy(){(0,_r.clean)(this.h,this.r,this.buffer,this.pad)}digestInto(e){(0,vi.exists)(this),(0,vi.output)(e,this),this.finished=!0;const{buffer:n,h:r}=this;let{pos:i}=this;if(i){for(n[i++]=1;i<16;i++)n[i]=0;this.process(n,0,!0)}this.finalize();let o=0;for(let c=0;c<8;c++)e[o++]=r[c]>>>0,e[o++]=r[c]>>>8;return e}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const r=e.slice(0,n);return this.destroy(),r}}function sh(t){const e=(r,i)=>t(i).update((0,_r.toBytes)(r)).digest(),n=t(new Uint8Array(32));return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=r=>t(r),e}Ar.poly1305=sh((t=>new J0(t))),(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.xchacha20poly1305=t.chacha20poly1305=t._poly1305_aead=t.chacha12=t.chacha8=t.xchacha20=t.chacha20=t.chacha20orig=void 0,t.hchacha=c;const e=Qn,n=ze,r=Ar,i=ut;function o(d,h,f,m,g,w=20){let p=d[0],C=d[1],_=d[2],P=d[3],L=h[0],U=h[1],q=h[2],F=h[3],D=h[4],N=h[5],H=h[6],$=h[7],O=g,M=f[0],S=f[1],I=f[2],j=p,y=C,E=_,A=P,T=L,b=U,v=q,k=F,x=D,R=N,B=H,K=$,z=O,V=M,Z=S,Q=I;for(let oe=0;oe<w;oe+=2)j=j+T|0,z=(0,e.rotl)(z^j,16),x=x+z|0,T=(0,e.rotl)(T^x,12),j=j+T|0,z=(0,e.rotl)(z^j,8),x=x+z|0,T=(0,e.rotl)(T^x,7),y=y+b|0,V=(0,e.rotl)(V^y,16),R=R+V|0,b=(0,e.rotl)(b^R,12),y=y+b|0,V=(0,e.rotl)(V^y,8),R=R+V|0,b=(0,e.rotl)(b^R,7),E=E+v|0,Z=(0,e.rotl)(Z^E,16),B=B+Z|0,v=(0,e.rotl)(v^B,12),E=E+v|0,Z=(0,e.rotl)(Z^E,8),B=B+Z|0,v=(0,e.rotl)(v^B,7),A=A+k|0,Q=(0,e.rotl)(Q^A,16),K=K+Q|0,k=(0,e.rotl)(k^K,12),A=A+k|0,Q=(0,e.rotl)(Q^A,8),K=K+Q|0,k=(0,e.rotl)(k^K,7),j=j+b|0,Q=(0,e.rotl)(Q^j,16),B=B+Q|0,b=(0,e.rotl)(b^B,12),j=j+b|0,Q=(0,e.rotl)(Q^j,8),B=B+Q|0,b=(0,e.rotl)(b^B,7),y=y+v|0,z=(0,e.rotl)(z^y,16),K=K+z|0,v=(0,e.rotl)(v^K,12),y=y+v|0,z=(0,e.rotl)(z^y,8),K=K+z|0,v=(0,e.rotl)(v^K,7),E=E+k|0,V=(0,e.rotl)(V^E,16),x=x+V|0,k=(0,e.rotl)(k^x,12),E=E+k|0,V=(0,e.rotl)(V^E,8),x=x+V|0,k=(0,e.rotl)(k^x,7),A=A+T|0,Z=(0,e.rotl)(Z^A,16),R=R+Z|0,T=(0,e.rotl)(T^R,12),A=A+T|0,Z=(0,e.rotl)(Z^A,8),R=R+Z|0,T=(0,e.rotl)(T^R,7);let ne=0;m[ne++]=p+j|0,m[ne++]=C+y|0,m[ne++]=_+E|0,m[ne++]=P+A|0,m[ne++]=L+T|0,m[ne++]=U+b|0,m[ne++]=q+v|0,m[ne++]=F+k|0,m[ne++]=D+x|0,m[ne++]=N+R|0,m[ne++]=H+B|0,m[ne++]=$+K|0,m[ne++]=O+z|0,m[ne++]=M+V|0,m[ne++]=S+Z|0,m[ne++]=I+Q|0}function c(d,h,f,m){let g=d[0],w=d[1],p=d[2],C=d[3],_=h[0],P=h[1],L=h[2],U=h[3],q=h[4],F=h[5],D=h[6],N=h[7],H=f[0],$=f[1],O=f[2],M=f[3];for(let I=0;I<20;I+=2)g=g+_|0,H=(0,e.rotl)(H^g,16),q=q+H|0,_=(0,e.rotl)(_^q,12),g=g+_|0,H=(0,e.rotl)(H^g,8),q=q+H|0,_=(0,e.rotl)(_^q,7),w=w+P|0,$=(0,e.rotl)($^w,16),F=F+$|0,P=(0,e.rotl)(P^F,12),w=w+P|0,$=(0,e.rotl)($^w,8),F=F+$|0,P=(0,e.rotl)(P^F,7),p=p+L|0,O=(0,e.rotl)(O^p,16),D=D+O|0,L=(0,e.rotl)(L^D,12),p=p+L|0,O=(0,e.rotl)(O^p,8),D=D+O|0,L=(0,e.rotl)(L^D,7),C=C+U|0,M=(0,e.rotl)(M^C,16),N=N+M|0,U=(0,e.rotl)(U^N,12),C=C+U|0,M=(0,e.rotl)(M^C,8),N=N+M|0,U=(0,e.rotl)(U^N,7),g=g+P|0,M=(0,e.rotl)(M^g,16),D=D+M|0,P=(0,e.rotl)(P^D,12),g=g+P|0,M=(0,e.rotl)(M^g,8),D=D+M|0,P=(0,e.rotl)(P^D,7),w=w+L|0,H=(0,e.rotl)(H^w,16),N=N+H|0,L=(0,e.rotl)(L^N,12),w=w+L|0,H=(0,e.rotl)(H^w,8),N=N+H|0,L=(0,e.rotl)(L^N,7),p=p+U|0,$=(0,e.rotl)($^p,16),q=q+$|0,U=(0,e.rotl)(U^q,12),p=p+U|0,$=(0,e.rotl)($^p,8),q=q+$|0,U=(0,e.rotl)(U^q,7),C=C+_|0,O=(0,e.rotl)(O^C,16),F=F+O|0,_=(0,e.rotl)(_^F,12),C=C+_|0,O=(0,e.rotl)(O^C,8),F=F+O|0,_=(0,e.rotl)(_^F,7);let S=0;m[S++]=g,m[S++]=w,m[S++]=p,m[S++]=C,m[S++]=H,m[S++]=$,m[S++]=O,m[S++]=M}t.chacha20orig=(0,e.createCipher)(o,{counterRight:!1,counterLength:8,allowShortKeys:!0}),t.chacha20=(0,e.createCipher)(o,{counterRight:!1,counterLength:4,allowShortKeys:!1}),t.xchacha20=(0,e.createCipher)(o,{counterRight:!1,counterLength:8,extendNonceFn:c,allowShortKeys:!1}),t.chacha8=(0,e.createCipher)(o,{counterRight:!1,counterLength:4,rounds:8}),t.chacha12=(0,e.createCipher)(o,{counterRight:!1,counterLength:4,rounds:12});const s=new Uint8Array(16),a=(d,h)=>{d.update(h);const f=h.length%16;f&&d.update(s.subarray(f))},l=new Uint8Array(32);function u(d,h,f,m,g){const w=d(h,f,l),p=r.poly1305.create(w);g&&a(p,g),a(p,m);const C=new Uint8Array(16),_=(0,i.createView)(C);(0,i.setBigUint64)(_,0,BigInt(g?g.length:0),!0),(0,i.setBigUint64)(_,8,BigInt(m.length),!0),p.update(C);const P=p.digest();return(0,i.clean)(w,C),P}t._poly1305_aead=d=>(h,f,m)=>((0,n.bytes)(h,32),(0,n.bytes)(f),{encrypt(w,p){const C=w.length,_=C+16;p?(0,n.bytes)(p,_):p=new Uint8Array(_),d(h,f,w,p,1);const P=u(d,h,f,p.subarray(0,-16),m);return p.set(P,C),(0,i.clean)(P),p},decrypt(w,p){const C=w.length,_=C-16;if(C<16)throw new Error("encrypted data must be at least 16 bytes");p?(0,n.bytes)(p,_):p=new Uint8Array(_);const P=w.subarray(0,-16),L=w.subarray(-16),U=u(d,h,f,P,m);if(!(0,i.equalBytes)(L,U))throw new Error("invalid tag");return d(h,f,P,p,1),(0,i.clean)(U),p}}),t.chacha20poly1305=(0,i.wrapCipher)({blockSize:64,nonceLength:12,tagLength:16},(0,t._poly1305_aead)(t.chacha20)),t.xchacha20poly1305=(0,i.wrapCipher)({blockSize:64,nonceLength:24,tagLength:16},(0,t._poly1305_aead)(t.xchacha20))})(rh),Object.defineProperty(io,"__esModule",{value:!0}),io.xchacha20=void 0;var qn,ol,yr,X0=rh;io.xchacha20=function(t,e,n){return(0,X0.xchacha20poly1305)(t,e,n)},(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.aesDecrypt=t.aesEncrypt=t.symDecrypt=t.symEncrypt=void 0;var e=ut,n=Ca,r=nr,i=io,o=Lr,c=Ne;t.symEncrypt=function(u,d,h){return s(a,u,d,h)};function s(u,d,h,f){var m=(0,o.symmetricAlgorithm)();if(m==="aes-256-gcm")return u(r.aes256gcm,d,h,(0,o.symmetricNonceLength)(),c.AEAD_TAG_LENGTH,f);if(m==="xchacha20")return u(i.xchacha20,d,h,c.XCHACHA20_NONCE_LENGTH,c.AEAD_TAG_LENGTH,f);if(m==="aes-256-cbc")return u(r.aes256cbc,d,h,16,0);throw new Error("Not implemented")}function a(u,d,h,f,m,g){var w=(0,n.randomBytes)(f),p=u(d,w,g).encrypt(h);if(m===0)return(0,e.concatBytes)(w,p);var C=p.length-m,_=p.subarray(0,C),P=p.subarray(C);return(0,e.concatBytes)(w,P,_)}function l(u,d,h,f,m,g){var w=h.subarray(0,f),p=u(d,Uint8Array.from(w),g),C=h.subarray(f);if(m===0)return p.decrypt(C);var _=C.subarray(0,m),P=C.subarray(m);return p.decrypt((0,e.concatBytes)(P,_))}t.symDecrypt=function(u,d,h){return s(l,u,d,h)},t.aesEncrypt=t.symEncrypt,t.aesDecrypt=t.symDecrypt})(Yc),qn=xo,ol=bt&&bt.__createBinding||(Object.create?function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]}),yr=bt&&bt.__exportStar||function(t,e){for(var n in t)n==="default"||Object.prototype.hasOwnProperty.call(e,n)||ol(e,t,n)},Object.defineProperty(qn,"__esModule",{value:!0}),yr(cd,qn),yr(Fd,qn),yr(zs,qn),yr(Yc,qn);var $r={};Object.defineProperty($r,"__esModule",{value:!0}),$r.PublicKey=void 0;var sl=ut,bi=xo,Q0=(function(){function t(e){this.data=(0,bi.convertPublicKeyFormat)(e,!0)}return t.fromHex=function(e){return new t((0,bi.hexToPublicKey)(e))},Object.defineProperty(t.prototype,"uncompressed",{get:function(){return X.from((0,bi.convertPublicKeyFormat)(this.data,!1))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"compressed",{get:function(){return X.from(this.data)},enumerable:!1,configurable:!0}),t.prototype.toHex=function(e){return e===void 0&&(e=!0),(0,sl.bytesToHex)(e?this.data:this.uncompressed)},t.prototype.decapsulate=function(e,n){n===void 0&&(n=!1);var r=n?this.data:this.uncompressed,i=e.multiply(this,n);return(0,bi.getSharedKey)(r,i)},t.prototype.equals=function(e){return(0,sl.equalBytes)(this.data,e.data)},t})();$r.PublicKey=Q0,Object.defineProperty(Xi,"__esModule",{value:!0}),Xi.PrivateKey=void 0;var al=ut,zn=xo,em=$r,tm=(function(){function t(e){if(e===void 0)this.data=(0,zn.getValidSecret)();else{if(!(0,zn.isValidPrivateKey)(e))throw new Error("Invalid private key");this.data=e}this.publicKey=new em.PublicKey((0,zn.getPublicKey)(this.data))}return t.fromHex=function(e){return new t((0,zn.decodeHex)(e))},Object.defineProperty(t.prototype,"secret",{get:function(){return X.from(this.data)},enumerable:!1,configurable:!0}),t.prototype.toHex=function(){return(0,al.bytesToHex)(this.data)},t.prototype.encapsulate=function(e,n){n===void 0&&(n=!1);var r=n?this.publicKey.compressed:this.publicKey.uncompressed,i=this.multiply(e,n);return(0,zn.getSharedKey)(r,i)},t.prototype.multiply=function(e,n){return n===void 0&&(n=!1),(0,zn.getSharedPoint)(this.data,e.compressed,n)},t.prototype.equals=function(e){return(0,al.equalBytes)(this.data,e.data)},t})();Xi.PrivateKey=tm,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.PublicKey=t.PrivateKey=void 0;var e=Xi;Object.defineProperty(t,"PrivateKey",{enumerable:!0,get:function(){return e.PrivateKey}});var n=$r;Object.defineProperty(t,"PublicKey",{enumerable:!0,get:function(){return n.PublicKey}})})(Wo),(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.utils=t.PublicKey=t.PrivateKey=t.ECIES_CONFIG=void 0,t.encrypt=function(s,a){var l=new r.PrivateKey,u=s instanceof Uint8Array?new r.PublicKey(s):r.PublicKey.fromHex(s),d=l.encapsulate(u,(0,n.isHkdfKeyCompressed)()),h=(0,n.isEphemeralKeyCompressed)()?l.publicKey.compressed:l.publicKey.uncompressed,f=(0,i.symEncrypt)(d,a);return X.from((0,e.concatBytes)(h,f))},t.decrypt=function(s,a){var l=s instanceof Uint8Array?new r.PrivateKey(s):r.PrivateKey.fromHex(s),u=(0,n.ephemeralKeySize)(),d=new r.PublicKey(a.subarray(0,u)),h=a.subarray(u),f=d.decapsulate(l,(0,n.isHkdfKeyCompressed)());return X.from((0,i.symDecrypt)(f,h))};var e=ut,n=Lr,r=Wo,i=xo,o=Lr;Object.defineProperty(t,"ECIES_CONFIG",{enumerable:!0,get:function(){return o.ECIES_CONFIG}});var c=Wo;Object.defineProperty(t,"PrivateKey",{enumerable:!0,get:function(){return c.PrivateKey}}),Object.defineProperty(t,"PublicKey",{enumerable:!0,get:function(){return c.PublicKey}}),t.utils={aesEncrypt:i.aesEncrypt,aesDecrypt:i.aesDecrypt,symEncrypt:i.symEncrypt,symDecrypt:i.symDecrypt,decodeHex:i.decodeHex,getValidSecret:i.getValidSecret,remove0x:i.remove0x}})(Wn);const ah=Je("KeyExchange:Layer"),ch=Je("SocketService:Layer"),lh=Je("Ecies:Layer"),uh=Je("RemoteCommunication:Layer");ah.color="##95c44e",ch.color="#f638d7",lh.color="#465b9c",uh.color="#47a2be";const W={KeyExchange:ah,SocketService:ch,Ecies:lh,RemoteCommunication:uh};let vr,wi=[],ls=[];const en=(t,e)=>J(void 0,void 0,void 0,(function*(){vr=e,ls.push(t),(function(n){return J(this,void 0,void 0,(function*(){if(!vr||!n)return;(function(){const c=ls;ls=wi,wi=c})();const r=vr.endsWith("/")?`${vr}evt`:`${vr}/evt`,i=Object.assign({},n);if(delete i.params,n.params)for(const[c,s]of Object.entries(n.params))i[c]=s;const o=JSON.stringify(i);W.RemoteCommunication(`[sendBufferedEvents] Sending ${wi.length} analytics events to ${r}`);try{const c=yield Pu(r,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:o}),s=yield c.text();W.RemoteCommunication(`[sendBufferedEvents] Response: ${s}`),wi.length=0}catch{}}))})(t).catch((()=>{}))}));class us{constructor(e){this.enabled=!0,e!=null&&e.debug&&Je.enable("Ecies:Layer"),this.ecies=e!=null&&e.privateKey?Wn.PrivateKey.fromHex(e.privateKey):new Wn.PrivateKey,W.Ecies("[ECIES constructor()] initialized secret: ",this.ecies.toHex()),W.Ecies("[ECIES constructor()] initialized public: ",this.ecies.publicKey.toHex()),W.Ecies("[ECIES constructor()] init with",this)}generateECIES(){this.ecies=new Wn.PrivateKey}getPublicKey(){return this.ecies.publicKey.toHex()}encrypt(e,n){let r=e;if(this.enabled)try{W.Ecies("[ECIES: encrypt()] using otherPublicKey",n);const i=X.from(e),o=Wn.encrypt(n,i);r=X.from(o).toString("base64")}catch(i){throw W.Ecies("[ECIES: encrypt()] error encrypt:",i),W.Ecies("[ECIES: encrypt()] private: ",this.ecies.toHex()),W.Ecies("[ECIES: encrypt()] data: ",e),W.Ecies("[ECIES: encrypt()] otherkey: ",n),i}return r}decrypt(e){let n=e;if(this.enabled)try{W.Ecies("[ECIES: decrypt()] using privateKey",this.ecies.toHex());const r=X.from(e.toString(),"base64");n=Wn.decrypt(this.ecies.toHex(),r).toString()}catch(r){throw W.Ecies("[ECIES: decrypt()] error decrypt",r),W.Ecies("[ECIES: decrypt()] private: ",this.ecies.toHex()),W.Ecies("[ECIES: decrypt()] encryptedData: ",e),r}return n}getKeyInfo(){return{private:this.ecies.toHex(),public:this.ecies.publicKey.toHex()}}toString(){W.Ecies("[ECIES: toString()]",this.getKeyInfo())}}var kn={version:"0.33.1"};const ar="https://metamask-sdk.api.cx.metamask.io/",nm=["websocket"],cr=6048e5,rm=3e3,Fe={METAMASK_CONNECTSIGN:"metamask_connectSign",METAMASK_CONNECTWITH:"metamask_connectWith",METAMASK_OPEN:"metamask_open",METAMASK_BATCH:"metamask_batch",PERSONAL_SIGN:"personal_sign",WALLET_REQUESTPERMISSIONS:"wallet_requestPermissions",WALLET_REVOKEPERMISSIONS:"wallet_revokePermissions",WALLET_WATCHASSET:"wallet_watchAsset",ETH_REQUESTACCOUNTS:"eth_requestAccounts",ETH_SENDTRANSACTION:"eth_sendTransaction",ETH_SIGNTYPEDDATA:"eth_signTypedData",ETH_SIGNTYPEDDATA_V3:"eth_signTypedData_v3",ETH_SIGNTYPEDDATA_V4:"eth_signTypedData_v4",ETH_SIGNTRANSACTION:"eth_signTransaction",ETH_SIGN:"eth_sign",PERSONAL_EC_RECOVER:"personal_ecRecover"},im=[Fe.METAMASK_CONNECTSIGN,Fe.METAMASK_CONNECTWITH,Fe.METAMASK_OPEN,Fe.METAMASK_BATCH,Fe.PERSONAL_SIGN,Fe.WALLET_REQUESTPERMISSIONS,Fe.WALLET_REVOKEPERMISSIONS,Fe.WALLET_WATCHASSET,Fe.ETH_SENDTRANSACTION,Fe.ETH_SIGNTYPEDDATA,Fe.ETH_SIGNTYPEDDATA_V3,Fe.ETH_SIGNTYPEDDATA_V4,Fe.ETH_SIGNTRANSACTION,Fe.ETH_SIGN,Fe.PERSONAL_EC_RECOVER];function Jr(t){return im.includes(t)}function dh(t){const{context:e}=t;W.RemoteCommunication(`[RemoteCommunication: clean()] context=${e}`),t.channelConfig=void 0,t.ready=!1,t.originatorConnectStarted=!1}var Ue,te,oo,Se,xe,Oe,Vn;(Vn=Ue||(Ue={})).DISCONNECTED="disconnected",Vn.WAITING="waiting",Vn.TIMEOUT="timeout",Vn.LINKED="linked",Vn.PAUSED="paused",Vn.TERMINATED="terminated",(function(t){t.KEY_INFO="key_info",t.SERVICE_STATUS="service_status",t.PROVIDER_UPDATE="provider_update",t.RPC_UPDATE="rpc_update",t.KEYS_EXCHANGED="keys_exchanged",t.JOIN_CHANNEL="join_channel",t.PUBLIC_KEY="public_key",t.CHANNEL_CREATED="channel_created",t.CLIENTS_CONNECTED="clients_connected",t.CLIENTS_DISCONNECTED="clients_disconnected",t.CLIENTS_WAITING="clients_waiting",t.CLIENTS_READY="clients_ready",t.REJECTED="rejected",t.WALLET_INIT="wallet_init",t.CHANNEL_PERSISTENCE="channel_persistence",t.CONFIG="config",t.MESSAGE_ACK="ack",t.SOCKET_DISCONNECTED="socket_disconnected",t.SOCKET_RECONNECT="socket_reconnect",t.OTP="otp",t.SDK_RPC_CALL="sdk_rpc_call",t.AUTHORIZED="authorized",t.CONNECTION_STATUS="connection_status",t.MESSAGE="message",t.TERMINATE="terminate"})(te||(te={})),(oo||(oo={})).KEY_EXCHANGE="key_exchange",(function(t){t.KEY_HANDSHAKE_START="key_handshake_start",t.KEY_HANDSHAKE_CHECK="key_handshake_check",t.KEY_HANDSHAKE_SYN="key_handshake_SYN",t.KEY_HANDSHAKE_SYNACK="key_handshake_SYNACK",t.KEY_HANDSHAKE_ACK="key_handshake_ACK",t.KEY_HANDSHAKE_WALLET="key_handshake_wallet",t.KEY_HANDSHAKE_NONE="none"})(Se||(Se={}));class om extends _o.EventEmitter2{constructor({communicationLayer:e,otherPublicKey:n,context:r,ecies:i,logging:o}){super(),this.keysExchanged=!1,this.step=Se.KEY_HANDSHAKE_NONE,this.debug=!1,this.context=r,this.communicationLayer=e,i!=null&&i.privateKey&&n&&(W.KeyExchange(`[KeyExchange: constructor()] otherPubKey=${n} set keysExchanged to true!`,i),this.keysExchanged=!0),this.myECIES=new us(Object.assign(Object.assign({},i),{debug:o==null?void 0:o.eciesLayer})),this.communicationLayer.state.eciesInstance=this.myECIES,this.myPublicKey=this.myECIES.getPublicKey(),this.debug=(o==null?void 0:o.keyExchangeLayer)===!0,n&&this.setOtherPublicKey(n),this.communicationLayer.on(oo.KEY_EXCHANGE,this.onKeyExchangeMessage.bind(this))}onKeyExchangeMessage(e){const{relayPersistence:n}=this.communicationLayer.remote.state;if(W.KeyExchange(`[KeyExchange: onKeyExchangeMessage()] context=${this.context} keysExchanged=${this.keysExchanged} relayPersistence=${n}`,e),n)return void W.KeyExchange("[KeyExchange: onKeyExchangeMessage()] Ignoring key exchange message because relay persistence is activated");const{message:r}=e;this.keysExchanged&&W.KeyExchange(`[KeyExchange: onKeyExchangeMessage()] context=${this.context} received handshake while already exchanged. step=${this.step} otherPubKey=${this.otherPublicKey}`),this.emit(te.KEY_INFO,r.type),r.type===Se.KEY_HANDSHAKE_SYN?(this.checkStep([Se.KEY_HANDSHAKE_NONE,Se.KEY_HANDSHAKE_ACK]),W.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_SYN",r),r.pubkey&&this.setOtherPublicKey(r.pubkey),this.communicationLayer.sendMessage({type:Se.KEY_HANDSHAKE_SYNACK,pubkey:this.myPublicKey}).catch((i=>{W.KeyExchange("[KeyExchange: onKeyExchangeMessage()] Error sending KEY_HANDSHAKE_SYNACK",i)})),this.setStep(Se.KEY_HANDSHAKE_ACK)):r.type===Se.KEY_HANDSHAKE_SYNACK?(this.checkStep([Se.KEY_HANDSHAKE_SYNACK,Se.KEY_HANDSHAKE_ACK,Se.KEY_HANDSHAKE_NONE]),W.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_SYNACK"),r.pubkey&&this.setOtherPublicKey(r.pubkey),this.communicationLayer.sendMessage({type:Se.KEY_HANDSHAKE_ACK}).catch((i=>{W.KeyExchange("[KeyExchange: onKeyExchangeMessage()] Error sending KEY_HANDSHAKE_ACK",i)})),this.keysExchanged=!0,this.setStep(Se.KEY_HANDSHAKE_ACK),this.emit(te.KEYS_EXCHANGED)):r.type===Se.KEY_HANDSHAKE_ACK&&(W.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_ACK set keysExchanged to true!"),this.checkStep([Se.KEY_HANDSHAKE_ACK,Se.KEY_HANDSHAKE_NONE]),this.keysExchanged=!0,this.setStep(Se.KEY_HANDSHAKE_ACK),this.emit(te.KEYS_EXCHANGED))}resetKeys(e){this.clean(),this.myECIES=new us(e)}clean(){W.KeyExchange(`[KeyExchange: clean()] context=${this.context} reset handshake state`),this.setStep(Se.KEY_HANDSHAKE_NONE),this.emit(te.KEY_INFO,this.step),this.keysExchanged=!1}start({isOriginator:e,force:n}){const{relayPersistence:r,protocolVersion:i}=this.communicationLayer.remote.state,o=i>=2;r?W.KeyExchange("[KeyExchange: start()] Ignoring key exchange message because relay persistence is activated"):(W.KeyExchange(`[KeyExchange: start()] context=${this.context} protocolVersion=${i} isOriginator=${e} step=${this.step} force=${n} relayPersistence=${r} keysExchanged=${this.keysExchanged}`),e?!(this.keysExchanged||this.step!==Se.KEY_HANDSHAKE_NONE&&this.step!==Se.KEY_HANDSHAKE_SYNACK)||n?(W.KeyExchange(`[KeyExchange: start()] context=${this.context} -- start key exchange (force=${n}) -- step=${this.step}`,this.step),this.clean(),this.setStep(Se.KEY_HANDSHAKE_SYNACK),this.communicationLayer.sendMessage({type:Se.KEY_HANDSHAKE_SYN,pubkey:this.myPublicKey,v:2}).catch((c=>{W.KeyExchange("[KeyExchange: start()] Error sending KEY_HANDSHAKE_SYN",c)}))):W.KeyExchange(`[KeyExchange: start()] context=${this.context} -- key exchange already ${this.keysExchanged?"done":"in progress"} -- aborted.`,this.step):this.keysExchanged&&n!==!0?W.KeyExchange("[KeyExchange: start()] don't send KEY_HANDSHAKE_START -- exchange already done."):o?this.communicationLayer.sendMessage({type:Se.KEY_HANDSHAKE_SYNACK,pubkey:this.myPublicKey,v:2}).catch((c=>{W.KeyExchange("[KeyExchange: start()] Error sending KEY_HANDSHAKE_SYNACK",c)})):(this.communicationLayer.sendMessage({type:Se.KEY_HANDSHAKE_START}).catch((c=>{W.KeyExchange("[KeyExchange: start()] Error sending KEY_HANDSHAKE_START",c)})),this.clean()))}setStep(e){this.step=e,this.emit(te.KEY_INFO,e)}checkStep(e){e.length>0&&e.indexOf(this.step.toString())}setRelayPersistence({localKey:e,otherKey:n}){this.otherPublicKey=n,this.myECIES=new us({privateKey:e,debug:this.debug}),this.keysExchanged=!0}setKeysExchanged(e){this.keysExchanged=e}areKeysExchanged(){return this.keysExchanged}getMyPublicKey(){return this.myPublicKey}getOtherPublicKey(){return this.otherPublicKey}setOtherPublicKey(e){W.KeyExchange("[KeyExchange: setOtherPubKey()]",e),this.otherPublicKey=e}encryptMessage(e){if(!this.otherPublicKey)throw new Error("encryptMessage: Keys not exchanged - missing otherPubKey");return this.myECIES.encrypt(e,this.otherPublicKey)}decryptMessage(e){if(!this.otherPublicKey)throw new Error("decryptMessage: Keys not exchanged - missing otherPubKey");return this.myECIES.decrypt(e)}getKeyInfo(){return{ecies:Object.assign(Object.assign({},this.myECIES.getKeyInfo()),{otherPubKey:this.otherPublicKey}),step:this.step,keysExchanged:this.areKeysExchanged()}}toString(){const e={keyInfo:this.getKeyInfo(),keysExchanged:this.keysExchanged,step:this.step};return JSON.stringify(e)}}(function(t){t.TERMINATE="terminate",t.ANSWER="answer",t.OFFER="offer",t.CANDIDATE="candidate",t.JSONRPC="jsonrpc",t.WALLET_INFO="wallet_info",t.WALLET_INIT="wallet_init",t.ORIGINATOR_INFO="originator_info",t.PAUSE="pause",t.OTP="otp",t.AUTHORIZED="authorized",t.PING="ping",t.READY="ready"})(xe||(xe={})),(function(t){t.REQUEST="sdk_connect_request_started",t.REQUEST_MOBILE="sdk_connect_request_started_mobile",t.RECONNECT="sdk_reconnect_request_started",t.CONNECTED="sdk_connection_established",t.CONNECTED_MOBILE="sdk_connection_established_mobile",t.AUTHORIZED="sdk_connection_authorized",t.REJECTED="sdk_connection_rejected",t.TERMINATED="sdk_connection_terminated",t.DISCONNECTED="sdk_disconnected",t.SDK_USE_EXTENSION="sdk_use_extension",t.SDK_RPC_REQUEST="sdk_rpc_request",t.SDK_RPC_REQUEST_RECEIVED="sdk_rpc_request_received",t.SDK_RPC_REQUEST_DONE="sdk_rpc_request_done",t.SDK_EXTENSION_UTILIZED="sdk_extension_utilized",t.SDK_USE_INAPP_BROWSER="sdk_use_inapp_browser"})(Oe||(Oe={}));const Ni=(t,e,n)=>J(void 0,void 0,void 0,(function*(){var r,i,o,c,s,a;const{remote:l,state:u}=t,{channelId:d,isOriginator:h}=u;if(e==="error_terminated")return W.SocketService(`handleJoinChannelResults: Channel ${d} terminated`),void t.emit(te.TERMINATE);if(!n)return void W.SocketService(`handleJoinChannelResults: No result for channel ${d}`);const{persistence:f,walletKey:m,rejected:g}=n;if(W.SocketService(`handleJoinChannelResults: Channel ${d} persistence=${f} walletKey=${m} rejected=${g}`),g)return W.SocketService(`handleJoinChannelResults: Channel ${d} rejected`),yield t.remote.disconnect({terminate:!0}),t.remote.emit(te.REJECTED,{channelId:d}),void t.remote.emitServiceStatusEvent();if(m&&!(!((r=l.state.channelConfig)===null||r===void 0)&&r.otherKey)){t.getKeyExchange().setOtherPublicKey(m),(i=t.state.keyExchange)===null||i===void 0||i.setKeysExchanged(!0),l.state.ready=!0,l.state.authorized=!0,l.emit(te.AUTHORIZED);const{communicationLayer:w,storageManager:p}=l.state,C=Object.assign(Object.assign({},l.state.channelConfig),{channelId:(o=l.state.channelId)!==null&&o!==void 0?o:"",validUntil:Date.now()+cr,localKey:w==null?void 0:w.getKeyInfo().ecies.private,otherKey:m});t.sendMessage({type:Se.KEY_HANDSHAKE_ACK}).catch((_=>{})),(c=t.state.socket)===null||c===void 0||c.emit(xe.PING,{id:d,clientType:h?"dapp":"wallet",context:"on_channel_reconnect",message:""}),yield p==null?void 0:p.persistChannelConfig(C),l.emitServiceStatusEvent(),l.setConnectionStatus(Ue.LINKED)}f&&(t.emit(te.CHANNEL_PERSISTENCE),(s=t.state.keyExchange)===null||s===void 0||s.setKeysExchanged(!0),l.state.ready=!0,l.state.authorized=!0,l.emit(te.AUTHORIZED),en(Object.assign(Object.assign({id:d??"",event:h?Oe.CONNECTED:Oe.CONNECTED_MOBILE},t.remote.state.originatorInfo),{sdkVersion:t.remote.state.sdkVersion,commLayer:t.state.communicationLayerPreference,commLayerVersion:kn.version,walletVersion:(a=t.remote.state.walletInfo)===null||a===void 0?void 0:a.version}),u.communicationServerUrl).catch((w=>{})))})),ir=t=>new Promise((e=>{setTimeout(e,t)})),cl=(t,e,...n)=>J(void 0,[t,e,...n],void 0,(function*(r,i,o=200){let c;const s=Date.now();let a=!1;for(;!a;){if(a=Date.now()-s>3e5,c=i[r],c.elapsedTime!==void 0)return c;yield ir(o)}throw new Error(`RPC ${r} timed out`)})),Ys=t=>J(void 0,void 0,void 0,(function*(){const{state:e}=t,{socket:n,channelId:r,context:i,isOriginator:o,isReconnecting:c}=e;if(c)return W.SocketService("[SocketService: reconnectSocket()] Reconnection already in progress, skipping",t),!1;if(!n)return W.SocketService("[SocketService: reconnectSocket()] socket is not defined",t),!1;if(!r)return!1;const{connected:s}=n;e.isReconnecting=!0,e.reconnectionAttempts=0,W.SocketService(`[SocketService: reconnectSocket()] connected=${s} trying to reconnect after socketio disconnection`,t);try{for(;3>e.reconnectionAttempts;){if(W.SocketService(`[SocketService: reconnectSocket()] Attempt ${e.reconnectionAttempts+1} of 3`,t),yield ir(200),n.connected)return W.SocketService("Socket already connected --- ping to retrieve messages"),n.emit(xe.PING,{id:r,clientType:o?"dapp":"wallet",context:"on_channel_config",message:""}),!0;e.resumed=!0,n.connect(),t.emit(te.SOCKET_RECONNECT);try{if(yield new Promise(((a,l)=>{n.emit(te.JOIN_CHANNEL,{channelId:r,context:`${i}connect_again`,clientType:o?"dapp":"wallet"},((u,d)=>J(void 0,void 0,void 0,(function*(){try{yield Ni(t,u,d),a()}catch(h){l(h)}}))))})),yield ir(100),n.connected)return W.SocketService(`Reconnection successful on attempt ${e.reconnectionAttempts+1}`),!0}catch(a){W.SocketService(`Error during reconnection attempt ${e.reconnectionAttempts+1}:`,a)}e.reconnectionAttempts+=1,3>e.reconnectionAttempts&&(yield ir(200))}return W.SocketService("Failed to reconnect after 3 attempts"),!1}finally{e.isReconnecting=!1,e.reconnectionAttempts=0}}));function hh(t,e){return J(this,void 0,void 0,(function*(){var n;const r=(n=t.state.keyExchange)===null||n===void 0?void 0:n.encryptMessage(JSON.stringify(e)),i={id:t.state.channelId,context:t.state.context,clientType:t.state.isOriginator?"dapp":"wallet",message:r,plaintext:t.state.hasPlaintext?JSON.stringify(e):void 0};return W.SocketService(`[SocketService: encryptAndSendMessage()] context=${t.state.context}`,i),e.type===xe.TERMINATE&&(t.state.manualDisconnect=!0),new Promise(((o,c)=>{var s;(s=t.state.socket)===null||s===void 0||s.emit(te.MESSAGE,i,((a,l)=>{var u;a&&(W.SocketService(`[SocketService: encryptAndSendMessage()] error=${a}`),c(a)),W.SocketService("[encryptAndSendMessage] response",l),o((u=l==null?void 0:l.success)!==null&&u!==void 0&&u)}))}))}))}var er;(function(t){t.RPC_CHECK="rpcCheck",t.SKIPPED_RPC="skippedRpc"})(er||(er={}));const fh=["eth_sendTransaction","eth_signTypedData","eth_signTransaction","personal_sign","wallet_requestPermissions","wallet_switchEthereumChain","eth_signTypedData_v3","eth_signTypedData_v4","metamask_connectSign","metamask_connectWith","metamask_batch"].map((t=>t.toLowerCase())),sm=[{event:te.CLIENTS_CONNECTED,handler:function(t,e){return n=>J(this,void 0,void 0,(function*(){var r,i,o,c,s,a,l,u,d,h,f;const m=(i=(r=t.remote.state.channelConfig)===null||r===void 0?void 0:r.relayPersistence)!==null&&i!==void 0&&i;if(W.SocketService(`[SocketService: handleClientsConnected()] context=${t.state.context} on 'clients_connected-${e}' relayPersistence=${m} resumed=${t.state.resumed} clientsPaused=${t.state.clientsPaused} keysExchanged=${(o=t.state.keyExchange)===null||o===void 0?void 0:o.areKeysExchanged()} isOriginator=${t.state.isOriginator}`),t.emit(te.CLIENTS_CONNECTED,{isOriginator:t.state.isOriginator,keysExchanged:(c=t.state.keyExchange)===null||c===void 0?void 0:c.areKeysExchanged(),context:t.state.context}),t.state.resumed)t.state.isOriginator||(W.SocketService(`[SocketService: handleClientsConnected()] context=${t.state.context} 'clients_connected' / keysExchanged=${(s=t.state.keyExchange)===null||s===void 0?void 0:s.areKeysExchanged()} -- backward compatibility`),(a=t.state.keyExchange)===null||a===void 0||a.start({isOriginator:(l=t.state.isOriginator)!==null&&l!==void 0&&l})),t.state.resumed=!1;else if(t.state.clientsPaused)W.SocketService("[SocketService: handleClientsConnected()] 'clients_connected' skip sending originatorInfo on pause");else if(!t.state.isOriginator){const g=!m;W.SocketService(`[SocketService: handleClientsConnected()] context=${t.state.context} on 'clients_connected' / keysExchanged=${(u=t.state.keyExchange)===null||u===void 0?void 0:u.areKeysExchanged()} -- force=${g} -- backward compatibility`),W.SocketService(`[SocketService: handleClientsConnected()] context=${t.state.context} on 'clients_connected' / keysExchanged=${(d=t.state.keyExchange)===null||d===void 0?void 0:d.areKeysExchanged()} -- force=${g} -- backward compatibility`),(h=t.state.keyExchange)===null||h===void 0||h.start({isOriginator:(f=t.state.isOriginator)!==null&&f!==void 0&&f,force:g})}t.state.clientsConnected=!0,t.state.clientsPaused=!1}))}},{event:te.CHANNEL_CREATED,handler:function(t,e){return n=>{W.SocketService(`[SocketService: handleChannelCreated()] context=${t.state.context} on 'channel_created-${e}'`,n),t.emit(te.CHANNEL_CREATED,n)}}},{event:te.CLIENTS_DISCONNECTED,handler:function(t,e){return()=>{var n;t.state.clientsConnected=!1,W.SocketService(`[SocketService: handlesClientsDisconnected()] context=${t.state.context} on 'clients_disconnected-${e}'`),t.remote.state.relayPersistence?W.SocketService(`[SocketService: handlesClientsDisconnected()] context=${t.state.context} on 'clients_disconnected-${e}' - relayPersistence enabled, skipping key exchange cleanup.`):(t.state.isOriginator&&!t.state.clientsPaused&&((n=t.state.keyExchange)===null||n===void 0||n.clean()),t.emit(te.CLIENTS_DISCONNECTED,e))}}},{event:te.CONFIG,handler:function(t,e){return n=>J(this,void 0,void 0,(function*(){var r,i,o;W.SocketService(`[SocketService: handleChannelConfig()] update relayPersistence on 'config-${e}'`,n);const{persistence:c,walletKey:s}=n;t.state.isOriginator&&t.remote.state.channelConfig?(n.walletKey&&!t.remote.state.channelConfig.otherKey&&(W.SocketService(`Setting wallet key ${s}`),t.remote.state.channelConfig.otherKey=s,t.getKeyExchange().setOtherPublicKey(n.walletKey),(r=t.state.keyExchange)===null||r===void 0||r.setKeysExchanged(!0),yield t.remote.sendMessage({type:Se.KEY_HANDSHAKE_ACK}),yield t.remote.sendMessage({type:xe.PING}),yield(i=t.remote.state.storageManager)===null||i===void 0?void 0:i.persistChannelConfig(t.remote.state.channelConfig)),c!==!0||t.remote.state.channelConfig.relayPersistence||(W.SocketService(`Setting relay persistence ${c}`),t.remote.state.channelConfig.relayPersistence=c,t.remote.state.relayPersistence=!0,t.remote.emit(te.CHANNEL_PERSISTENCE),t.remote.state.authorized=!0,t.remote.state.ready=!0,t.remote.emit(te.AUTHORIZED),yield(o=t.remote.state.storageManager)===null||o===void 0?void 0:o.persistChannelConfig(t.remote.state.channelConfig))):t.state.isOriginator||n.persistence&&(t.remote.state.relayPersistence=!0,t.remote.emit(te.CHANNEL_PERSISTENCE))}))}},{event:te.MESSAGE,handler:function(t,e){return n=>{var r,i,o,c,s,a,l,u,d,h,f,m,g,w,p,C,_,P;const{ackId:L,message:U,error:q}=n,F=(r=t.remote.state.relayPersistence)!==null&&r!==void 0&&r;if(W.SocketService(`[SocketService handleMessage()] relayPersistence=${F} context=${t.state.context} on 'message' ${e} keysExchanged=${(i=t.state.keyExchange)===null||i===void 0?void 0:i.areKeysExchanged()}`,n),q)throw W.SocketService(`
|
|
9
|
+
[SocketService handleMessage()] context=${t.state.context}::on 'message' error=${q}`),new Error(q);const D=typeof U=="string";if(!D&&(U==null?void 0:U.type)===Se.KEY_HANDSHAKE_START)return F?void 0:(W.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' received HANDSHAKE_START isOriginator=${t.state.isOriginator}`,U),void((o=t.state.keyExchange)===null||o===void 0||o.start({isOriginator:(c=t.state.isOriginator)!==null&&c!==void 0&&c,force:!0})));if(!D&&(!((s=U==null?void 0:U.type)===null||s===void 0)&&s.startsWith("key_handshake")))return F?void 0:(W.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' emit KEY_EXCHANGE`,U),void t.emit(oo.KEY_EXCHANGE,{message:U,context:t.state.context}));if(D&&!(!((a=t.state.keyExchange)===null||a===void 0)&&a.areKeysExchanged())){let $=!1;try{W.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' trying to decrypt message`),(l=t.state.keyExchange)===null||l===void 0||l.decryptMessage(U),$=!0}catch(O){W.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' error`,O)}if(!$)return t.state.isOriginator?(d=t.state.keyExchange)===null||d===void 0||d.start({isOriginator:(h=t.state.isOriginator)!==null&&h!==void 0&&h}):t.sendMessage({type:Se.KEY_HANDSHAKE_START}).catch((O=>{})),void W.SocketService(`Message ignored because invalid key exchange status. step=${(f=t.state.keyExchange)===null||f===void 0?void 0:f.getKeyInfo().step}`,(m=t.state.keyExchange)===null||m===void 0?void 0:m.getKeyInfo(),U);W.SocketService("Invalid key exchange status detected --- updating it."),(u=t.state.keyExchange)===null||u===void 0||u.setKeysExchanged(!0)}else if(!D&&(U!=null&&U.type))return void t.emit(te.MESSAGE,U);if(!D)return void t.emit(te.MESSAGE,U);const N=(g=t.state.keyExchange)===null||g===void 0?void 0:g.decryptMessage(U),H=JSON.parse(N??"{}");if(L&&(L==null?void 0:L.length)>0&&(W.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' ackid=${L} channelId=${e}`),(w=t.state.socket)===null||w===void 0||w.emit(te.MESSAGE_ACK,{ackId:L,channelId:e,clientType:t.state.isOriginator?"dapp":"wallet"})),t.state.clientsPaused=(H==null?void 0:H.type)===xe.PAUSE,t.state.isOriginator&&H.data){const $=H.data,O=t.state.rpcMethodTracker[$.id];if(O){const M=Date.now()-O.timestamp;W.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' received answer for id=${$.id} method=${O.method} responseTime=${M}`,H),t.remote.state.analytics&&fh.includes(O.method.toLowerCase())&&en(Object.assign(Object.assign({id:(p=t.remote.state.channelId)!==null&&p!==void 0?p:"",event:Oe.SDK_RPC_REQUEST_DONE,sdkVersion:t.remote.state.sdkVersion,commLayerVersion:kn.version},t.remote.state.originatorInfo),{walletVersion:(C=t.remote.state.walletInfo)===null||C===void 0?void 0:C.version,params:{method:O.method,from:"mobile"}}),t.remote.state.communicationServerUrl).catch((I=>{})),Jr(O.method)&&Re.analytics.track($.error?$.error.code===4001?"sdk_action_rejected":"sdk_action_failed":"sdk_action_succeeded",{action:O.method});const S=Object.assign(Object.assign({},O),{result:$.result,error:$.error?{code:(_=$.error)===null||_===void 0?void 0:_.code,message:(P=$.error)===null||P===void 0?void 0:P.message}:void 0,elapsedTime:M});t.state.rpcMethodTracker[$.id]=S,t.emit(te.RPC_UPDATE,S)}}t.emit(te.MESSAGE,{message:H})}}},{event:te.REJECTED,handler:function(t,e){return n=>J(this,void 0,void 0,(function*(){var r;t.state.isOriginator&&!t.remote.state.ready?(W.SocketService(`[SocketService: handleChannelRejected()] context=${t.state.context} channelId=${e} isOriginator=${t.state.isOriginator} ready=${t.remote.state.ready}`,t.remote.state.originatorInfo),en(Object.assign(Object.assign({id:e,event:Oe.REJECTED},t.remote.state.originatorInfo),{sdkVersion:t.remote.state.sdkVersion,commLayer:t.state.communicationLayerPreference,commLayerVersion:kn.version,walletVersion:(r=t.remote.state.walletInfo)===null||r===void 0?void 0:r.version}),t.remote.state.communicationServerUrl).catch((i=>{})),Re.analytics.track("sdk_connection_rejected",{transport_type:"websocket"}),yield t.remote.disconnect({terminate:!0}),t.remote.emit(te.REJECTED,{channelId:e}),t.remote.setConnectionStatus(Ue.DISCONNECTED)):W.SocketService(`[SocketService: handleChannelRejected()] SKIP -- channelId=${e} isOriginator=${t.state.isOriginator} ready=${t.remote.state.ready}`)}))}},{event:"clients_waiting_to_join",handler:function(t,e){return n=>{W.SocketService(`[SocketService: handleClientsWaitingToJoin()] context=${t.state.context} on 'clients_waiting_to_join-${e}'`,n),t.emit(te.CLIENTS_WAITING,n)}}}],am=[{event:te.KEY_INFO,handler:function(t){return e=>{W.SocketService("[SocketService: handleKeyInfo()] on 'KEY_INFO'",e),t.emit(te.KEY_INFO,e)}}},{event:te.KEYS_EXCHANGED,handler:function(t){return()=>{var e,n,r;W.SocketService(`[SocketService: handleKeysExchanged()] on 'keys_exchanged' keyschanged=${(e=t.state.keyExchange)===null||e===void 0?void 0:e.areKeysExchanged()}`);const{channelConfig:i}=t.remote.state;if(i){const c=t.getKeyExchange().getKeyInfo().ecies;i.localKey=c.private,i.otherKey=c.otherPubKey,t.remote.state.channelConfig=i,(n=t.remote.state.storageManager)===null||n===void 0||n.persistChannelConfig(i).catch((s=>{}))}t.emit(te.KEYS_EXCHANGED,{keysExchanged:(r=t.state.keyExchange)===null||r===void 0?void 0:r.areKeysExchanged(),isOriginator:t.state.isOriginator});const o={keyInfo:t.getKeyInfo()};t.emit(te.SERVICE_STATUS,o)}}}];function ll(t,e){W.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} setting socket listeners for channel ${e}...`);const{socket:n}=t.state,{keyExchange:r}=t.state;n&&t.state.isOriginator&&(t.state.debug&&(n==null||n.io.on("error",(i=>{W.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} socket event=error`,i)})),n==null||n.io.on("reconnect",(i=>{W.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} socket event=reconnect`,i),Ys(t).catch((o=>{}))})),n==null||n.io.on("reconnect_error",(i=>{W.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} socket event=reconnect_error`,i)})),n==null||n.io.on("reconnect_failed",(()=>{W.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} socket event=reconnect_failed`)}))),n==null||n.on("disconnect",(i=>(W.SocketService(`[SocketService: setupChannelListener()] on 'disconnect' -- MetaMaskSDK socket disconnected '${i}' begin recovery...`),(function(o){return c=>{W.SocketService(`[SocketService: handleDisconnect()] on 'disconnect' manualDisconnect=${o.state.manualDisconnect}`,c),o.state.manualDisconnect||(o.emit(te.SOCKET_DISCONNECTED),Ys(o).catch((s=>{})))}})(t)(i))))),sm.forEach((({event:i,handler:o})=>{n==null||n.on(`${i}-${e}`,o(t,e))})),am.forEach((({event:i,handler:o})=>{r==null||r.on(i,o(t))})),t.state.setupChannelListeners=!0}class cm extends _o.EventEmitter2{constructor(e){super(),this.state={clientsConnected:!1,clientsPaused:!1,manualDisconnect:!1,lastRpcId:void 0,rpcMethodTracker:{},hasPlaintext:!1,communicationServerUrl:"",focusListenerAdded:!1,removeFocusListener:void 0,isReconnecting:!1,reconnectionAttempts:0},this.options=e;const{reconnect:n,communicationLayerPreference:r,communicationServerUrl:i,context:o,remote:c,logging:s}=e;this.state.resumed=n,this.state.context=o,this.state.isOriginator=c.state.isOriginator,this.state.communicationLayerPreference=r,this.state.debug=(s==null?void 0:s.serviceLayer)===!0,this.remote=c,(s==null?void 0:s.serviceLayer)===!0&&Je.enable("SocketService:Layer"),this.state.communicationServerUrl=i,this.state.hasPlaintext=this.state.communicationServerUrl!==ar&&(s==null?void 0:s.plaintext)===!0,W.SocketService(`[SocketService: constructor()] Socket IO url: ${this.state.communicationServerUrl}`),this.initSocket()}initSocket(){var e;const{otherPublicKey:n,ecies:r,logging:i}=this.options,o={autoConnect:!1,transports:nm,withCredentials:!0},c=this.state.communicationServerUrl;W.SocketService(`[SocketService: initSocket()] Socket IO url: ${c}`),this.state.socket=Oi(c,o),(function(a){if(typeof window<"u"&&typeof document<"u"&&(W.SocketService(`[SocketService: setupSocketFocusListener()] hasFocus=${document.hasFocus()}`,a),!a.state.focusListenerAdded)){const l=()=>{W.SocketService("Document has focus --- reconnecting socket"),Ys(a).catch((u=>{}))};window.addEventListener("focus",l),a.state.focusListenerAdded=!0,a.state.removeFocusListener=()=>{window.removeEventListener("focus",l),a.state.focusListenerAdded=!1}}})(this);const s={communicationLayer:this,otherPublicKey:n,sendPublicKey:!1,context:(e=this.state.context)!==null&&e!==void 0?e:"",ecies:r,logging:i};this.state.keyExchange=new om(s)}resetKeys(){return W.SocketService("[SocketService: resetKeys()] Resetting keys."),void((e=this.state.keyExchange)===null||e===void 0||e.resetKeys());var e}createChannel(){return J(this,void 0,void 0,(function*(){return(function(e){return J(this,void 0,void 0,(function*(){var n,r,i;if(W.SocketService(`[SocketService: createChannel()] context=${e.state.context}`),e.state.socket||e.initSocket(),(n=e.state.socket)===null||n===void 0?void 0:n.connected)throw new Error("socket already connected");(r=e.state.socket)===null||r===void 0||r.connect(),e.state.manualDisconnect=!1,e.state.isOriginator=!0;const o=yn();e.state.channelId=o,ll(e,o),yield new Promise(((s,a)=>{var l;(l=e.state.socket)===null||l===void 0||l.emit(te.JOIN_CHANNEL,{channelId:o,context:`${e.state.context}createChannel`,clientType:"dapp"},((u,d)=>J(this,void 0,void 0,(function*(){try{yield Ni(e,u,d),s()}catch(h){a(h)}}))))}));const c=(i=e.state.keyExchange)===null||i===void 0?void 0:i.getKeyInfo();return{channelId:o,pubKey:(c==null?void 0:c.ecies.public)||"",privKey:(c==null?void 0:c.ecies.private)||""}}))})(this)}))}connectToChannel({channelId:e,withKeyExchange:n=!1,authorized:r}){return(function(i){return J(this,arguments,void 0,(function*({options:o,instance:c}){const{channelId:s,authorized:a,withKeyExchange:l}=o,{state:u,remote:d}=c,{isOriginator:h=!1,socket:f,keyExchange:m}=u,{channelConfig:g}=d.state;if(f!=null&&f.connected)throw new Error("socket already connected");if(h&&(g!=null&&g.relayPersistence)){const{localKey:w,otherKey:p}=g;w&&p&&(m==null||m.setRelayPersistence({localKey:w,otherKey:p}))}return Object.assign(u,{manualDisconnect:!1,withKeyExchange:l,isOriginator:h,channelId:s}),f==null||f.connect(),ll(c,s),!h&&a&&(m==null||m.setKeysExchanged(!0),Object.assign(d.state,{ready:!0,authorized:!0})),new Promise((w=>{var p;const C=(p=m==null?void 0:m.getKeyInfo())===null||p===void 0?void 0:p.ecies.public;f==null||f.emit(te.JOIN_CHANNEL,{channelId:s,context:`${u.context}_connectToChannel`,clientType:h?"dapp":"wallet",publicKey:a&&!h?C:void 0},((_,P)=>J(this,void 0,void 0,(function*(){yield Ni(c,_,P),w()}))))}))}))})({options:{channelId:e,withKeyExchange:n,authorized:r},instance:this})}getKeyInfo(){return this.state.keyExchange.getKeyInfo()}keyCheck(){var e,n;(n=(e=this).state.socket)===null||n===void 0||n.emit(te.MESSAGE,{id:e.state.channelId,context:e.state.context,message:{type:Se.KEY_HANDSHAKE_CHECK,pubkey:e.getKeyInfo().ecies.otherPubKey}})}getKeyExchange(){return this.state.keyExchange}sendMessage(e){return J(this,void 0,void 0,(function*(){return(function(n,r){return J(this,void 0,void 0,(function*(){var i,o,c;if(!n.state.channelId)throw W.SocketService("handleSendMessage: no channelId - Create a channel first"),new Error("Create a channel first");if(W.SocketService(`[SocketService: handleSendMessage()] context=${n.state.context} areKeysExchanged=${(i=n.state.keyExchange)===null||i===void 0?void 0:i.areKeysExchanged()}`,r),(o=r==null?void 0:r.type)===null||o===void 0?void 0:o.startsWith("key_handshake"))return(function(a,l){var u;W.SocketService(`[SocketService: handleKeyHandshake()] context=${a.state.context}`,l),(u=a.state.socket)===null||u===void 0||u.emit(te.MESSAGE,{id:a.state.channelId,context:a.state.context,clientType:a.state.isOriginator?"dapp":"wallet",message:l})})(n,r),!0;(function(a,l){var u;if(!(!((u=a.state.keyExchange)===null||u===void 0)&&u.areKeysExchanged())&&!a.remote.state.relayPersistence)throw W.SocketService(`[SocketService: validateKeyExchange()] context=${a.state.context} ERROR keys not exchanged`,l),new Error("Keys not exchanged BBB")})(n,r),(function(a,l){var u;const d=(u=l==null?void 0:l.method)!==null&&u!==void 0?u:"",h=l==null?void 0:l.id;a.state.isOriginator&&h&&(a.state.rpcMethodTracker[h]={id:h,timestamp:Date.now(),method:d},a.emit(te.RPC_UPDATE,a.state.rpcMethodTracker[h]))})(n,r);const s=yield hh(n,r);return n.remote.state.analytics&&n.remote.state.isOriginator&&r.method&&fh.includes(r.method.toLowerCase())&&en({id:(c=n.remote.state.channelId)!==null&&c!==void 0?c:"",event:Oe.SDK_RPC_REQUEST,params:{method:r.method,from:"mobile"}},n.remote.state.communicationServerUrl).catch((a=>{})),n.remote.state.isOriginator&&r.method&&Jr(r.method)&&Re.analytics.track("sdk_action_requested",{action:r.method}),(function(a,l){return J(this,void 0,void 0,(function*(){var u;const d=l==null?void 0:l.id,h=(u=l==null?void 0:l.method)!==null&&u!==void 0?u:"";if(a.state.isOriginator&&d)try{const f=cl(d,a.state.rpcMethodTracker,200).then((w=>({type:er.RPC_CHECK,result:w}))),m=J(this,void 0,void 0,(function*(){const w=yield(C=>J(void 0,[C],void 0,(function*({rpcId:_,instance:P}){for(;P.state.lastRpcId===_||P.state.lastRpcId===void 0;)yield ir(200);return P.state.lastRpcId})))({instance:a,rpcId:d}),p=yield cl(w,a.state.rpcMethodTracker,200);return{type:er.SKIPPED_RPC,result:p}})),g=yield Promise.race([f,m]);if(g.type===er.RPC_CHECK){const w=g.result;W.SocketService(`[SocketService:handleRpcReplies()] id=${l.id} ${h} ( ${w.elapsedTime} ms)`,w.result)}else{if(g.type!==er.SKIPPED_RPC)throw new Error(`Error handling RPC replies for ${d}`);{const w=Object.assign(Object.assign({},a.state.rpcMethodTracker[d]),{error:new Error("SDK_CONNECTION_ISSUE")});a.emit(te.RPC_UPDATE,w);const p={data:Object.assign(Object.assign({},w),{jsonrpc:"2.0"}),name:"metamask-provider"};a.emit(te.MESSAGE,{message:p})}}}catch(f){throw f}}))})(n,r).catch((a=>{})),s}))})(this,e)}))}ping(){return(function(e){return J(this,void 0,void 0,(function*(){var n,r;W.SocketService(`[SocketService: ping()] context=${e.state.context} originator=${e.state.isOriginator} keysExchanged=${(n=e.state.keyExchange)===null||n===void 0?void 0:n.areKeysExchanged()}`),(r=e.state.socket)===null||r===void 0||r.emit(xe.PING,{id:e.state.channelId,context:"ping",clientType:e.remote.state.isOriginator?"dapp":"wallet",message:""})}))})(this)}pause(){return(function(e){return J(this,void 0,void 0,(function*(){var n,r;W.SocketService(`[SocketService: pause()] context=${e.state.context}`),e.state.manualDisconnect=!0,!((n=e.state.keyExchange)===null||n===void 0)&&n.areKeysExchanged()&&(yield e.sendMessage({type:xe.PAUSE})),(r=e.state.socket)===null||r===void 0||r.disconnect()}))})(this)}isConnected(){var e;return(e=this.state.socket)===null||e===void 0?void 0:e.connected}resume(){return(function(e){return J(this,void 0,void 0,(function*(){const{state:n,remote:r}=e,{socket:i,channelId:o,context:c,keyExchange:s,isOriginator:a}=n,{isOriginator:l}=r.state;if(W.SocketService(`[SocketService: resume()] channelId=${o} context=${c} connected=${i==null?void 0:i.connected} manualDisconnect=${n.manualDisconnect} resumed=${n.resumed} keysExchanged=${s==null?void 0:s.areKeysExchanged()}`),!o)throw W.SocketService("[SocketService: resume()] channelId is not defined"),new Error("ChannelId is not defined");i!=null&&i.connected?(W.SocketService("[SocketService: resume()] already connected."),i.emit(xe.PING,{id:o,clientType:l?"dapp":"wallet",context:"on_channel_config",message:""}),r.hasRelayPersistence()||s!=null&&s.areKeysExchanged()||(a?yield e.sendMessage({type:xe.READY}):s==null||s.start({isOriginator:!1}))):(i==null||i.connect(),W.SocketService(`[SocketService: resume()] after connecting socket --> connected=${i==null?void 0:i.connected}`),i==null||i.emit(te.JOIN_CHANNEL,{channelId:o,context:`${c}_resume`,clientType:l?"dapp":"wallet"},((u,d)=>J(this,void 0,void 0,(function*(){try{yield Ni(e,u,d)}catch{}}))))),n.manualDisconnect=!1,n.resumed=!0}))})(this)}getRPCMethodTracker(){return this.state.rpcMethodTracker}disconnect(e){return(function(n,r){var i,o,c,s,a;W.SocketService(`[SocketService: disconnect()] context=${n.state.context}`,r),r!=null&&r.terminate&&((o=(i=n.state).removeFocusListener)===null||o===void 0||o.call(i),n.state.channelId=r.channelId,(c=n.state.socket)===null||c===void 0||c.removeAllListeners(),(s=n.state.keyExchange)===null||s===void 0||s.clean(),n.remote.state.ready=!1,n.state.socket=void 0,n.state.rpcMethodTracker={}),n.state.manualDisconnect=!0,(a=n.state.socket)===null||a===void 0||a.disconnect()})(this,e)}}var Bn,Ve,ul;function lm(t){return()=>J(this,void 0,void 0,(function*(){var e,n,r;const{state:i}=t;if(i.authorized)return;yield J(this,void 0,void 0,(function*(){for(;!i.walletInfo;)yield ir(500)}));const o="7.3".localeCompare(((e=i.walletInfo)===null||e===void 0?void 0:e.version)||"");if(W.RemoteCommunication(`[RemoteCommunication: handleAuthorizedEvent()] HACK 'authorized' version=${(n=i.walletInfo)===null||n===void 0?void 0:n.version} compareValue=${o}`),o!==1)return;const c=i.platformType===Ve.MobileWeb||i.platformType===Ve.ReactNative||i.platformType===Ve.MetaMaskMobileWebview;W.RemoteCommunication(`[RemoteCommunication: handleAuthorizedEvent()] HACK 'authorized' platform=${i.platformType} secure=${c} channel=${i.channelId} walletVersion=${(r=i.walletInfo)===null||r===void 0?void 0:r.version}`),c&&(i.authorized=!0,t.emit(te.AUTHORIZED))}))}function um(t){return e=>{const{state:n}=t;W.RemoteCommunication(`[RemoteCommunication: handleChannelCreatedEvent()] context=${n.context} on 'channel_created' channelId=${e}`),t.emit(te.CHANNEL_CREATED,e)}}function dm(t,e){return()=>{var n,r,i,o;const{state:c}=t;W.RemoteCommunication(`[RemoteCommunication: handleClientsConnectedEvent()] on 'clients_connected' channel=${c.channelId} keysExchanged=${(r=(n=c.communicationLayer)===null||n===void 0?void 0:n.getKeyInfo())===null||r===void 0?void 0:r.keysExchanged}`),c.analytics&&en(Object.assign(Object.assign({id:(i=c.channelId)!==null&&i!==void 0?i:"",event:c.reconnection?Oe.RECONNECT:c.isOriginator?Oe.REQUEST:Oe.REQUEST_MOBILE},c.originatorInfo),{commLayer:e,sdkVersion:c.sdkVersion,walletVersion:(o=c.walletInfo)===null||o===void 0?void 0:o.version,commLayerVersion:kn.version}),c.communicationServerUrl).catch((s=>{})),c.isOriginator&&!c.reconnection&&Re.analytics.track("sdk_connection_established",{transport_type:"websocket"}),c.clientsConnected=!0,c.originatorInfoSent=!1,t.emit(te.CLIENTS_CONNECTED)}}function hm(t){return e=>{const{state:n}=t;W.RemoteCommunication(`[RemoteCommunication: handleClientsDisconnectedEvent()] context=${n.context} on 'clients_disconnected' channelId=${e}`),n.relayPersistence||(n.clientsConnected=!1,n.ready=!1,n.authorized=!1),t.emit(te.CLIENTS_DISCONNECTED,n.channelId),t.setConnectionStatus(Ue.DISCONNECTED)}}function fm(t){return e=>{var n;const{state:r}=t;if(W.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] context=${r.context} on 'clients_waiting' numberUsers=${e} ready=${r.ready} autoStarted=${r.originatorConnectStarted}`),t.setConnectionStatus(Ue.WAITING),t.emit(te.CLIENTS_WAITING,e),r.originatorConnectStarted){W.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] on 'clients_waiting' watch autoStarted=${r.originatorConnectStarted} timeout`,r.autoConnectOptions);const i=((n=r.autoConnectOptions)===null||n===void 0?void 0:n.timeout)||3e3,o=setTimeout((()=>{W.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] setTimeout(${i}) terminate channelConfig`,r.autoConnectOptions),r.originatorConnectStarted=!1,r.ready||t.setConnectionStatus(Ue.TIMEOUT),clearTimeout(o)}),i)}}}function pm(t,e){return n=>{var r,i,o,c,s,a,l,u;const{state:d}=t;if(W.RemoteCommunication(`[RemoteCommunication: handleKeysExchangedEvent()] context=${d.context} on commLayer.'keys_exchanged' channel=${d.channelId}`,n),(i=(r=d.communicationLayer)===null||r===void 0?void 0:r.getKeyInfo())===null||i===void 0?void 0:i.keysExchanged){const h=Object.assign(Object.assign({},d.channelConfig),{channelId:(o=d.channelId)!==null&&o!==void 0?o:"",validUntil:((c=d.channelConfig)===null||c===void 0?void 0:c.validUntil)||cr,localKey:d.communicationLayer.getKeyInfo().ecies.private,otherKey:d.communicationLayer.getKeyInfo().ecies.otherPubKey});(s=d.storageManager)===null||s===void 0||s.persistChannelConfig(h).catch((f=>{})),t.setConnectionStatus(Ue.LINKED)}(function(h,f){var m,g,w,p,C,_,P,L;const{state:U}=h;W.RemoteCommunication(`[RemoteCommunication: setLastActiveDate()] channel=${U.channelId}`,f);const q=Object.assign(Object.assign({},U.channelConfig),{channelId:(m=U.channelId)!==null&&m!==void 0?m:"",validUntil:(w=(g=U.channelConfig)===null||g===void 0?void 0:g.validUntil)!==null&&w!==void 0?w:0,relayPersistence:U.relayPersistence,localKey:(C=(p=U.communicationLayer)===null||p===void 0?void 0:p.state.keyExchange)===null||C===void 0?void 0:C.getKeyInfo().ecies.private,otherKey:(P=(_=U.communicationLayer)===null||_===void 0?void 0:_.state.keyExchange)===null||P===void 0?void 0:P.getKeyInfo().ecies.otherPubKey,lastActive:f.getTime()});(L=U.storageManager)===null||L===void 0||L.persistChannelConfig(q)})(t,new Date),d.analytics&&d.channelId&&en(Object.assign(Object.assign({id:d.channelId,event:n.isOriginator?Oe.CONNECTED:Oe.CONNECTED_MOBILE},d.originatorInfo),{sdkVersion:d.sdkVersion,commLayer:e,commLayerVersion:kn.version,walletVersion:(a=d.walletInfo)===null||a===void 0?void 0:a.version}),d.communicationServerUrl).catch((h=>{})),d.isOriginator=n.isOriginator,n.isOriginator||((l=d.communicationLayer)===null||l===void 0||l.sendMessage({type:xe.READY}),d.ready=!0,d.paused=!1),n.isOriginator&&!d.originatorInfoSent&&((u=d.communicationLayer)===null||u===void 0||u.sendMessage({type:xe.ORIGINATOR_INFO,originatorInfo:d.originatorInfo,originator:d.originatorInfo}),d.originatorInfoSent=!0)}}function mm(t){return e=>{let n=e;e.message&&(n=n.message),(function(r,i){const{state:o}=i;if(W.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] context=${o.context} on 'message' typeof=${typeof r}`,r),i.state.ready=!0,o.isOriginator||r.type!==xe.ORIGINATOR_INFO)if(o.isOriginator&&r.type===xe.WALLET_INFO)(function(c,s){const{state:a}=c;a.walletInfo=s.walletInfo,a.paused=!1})(i,r);else{if(o.isOriginator&&r.type===xe.WALLET_INIT)(function(c,s){return J(this,void 0,void 0,(function*(){var a,l,u;const{state:d}=c;if(d.isOriginator){const h=s.data||{};if(typeof h=="object"&&"accounts"in h&&"chainId"in h&&"walletKey"in h)try{const{channelConfig:f}=c.state;if(W.RemoteCommunication("WALLET_INIT: channelConfig",JSON.stringify(f,null,2)),f){const m=h.accounts,g=h.chainId,w=h.walletKey;let p,C=!1;"deeplinkProtocol"in h&&(C=!!h.deeplinkProtocol,c.state.deeplinkProtocolAvailable=C),"walletVersion"in h&&(p=h.walletVersion),yield(a=c.state.storageManager)===null||a===void 0?void 0:a.persistChannelConfig(Object.assign(Object.assign({},f),{otherKey:w,walletVersion:p,deeplinkProtocolAvailable:C,relayPersistence:!0})),yield(l=c.state.storageManager)===null||l===void 0?void 0:l.persistAccounts(m),yield(u=c.state.storageManager)===null||u===void 0?void 0:u.persistChainId(g)}c.emit(te.WALLET_INIT,{accounts:h.accounts,chainId:h.chainId})}catch{}}}))})(i,r).catch((c=>{W.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] error=${c}`)}));else if(r.type===xe.TERMINATE)(function(c){return J(this,void 0,void 0,(function*(){const{state:s}=c;s.isOriginator&&(yield ph({options:{terminate:!0,sendMessage:!1},instance:c}),c.emit(te.TERMINATE))}))})(i).catch((c=>{W.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] error=${c}`)}));else if(r.type===xe.PAUSE)(function(c){const{state:s}=c;s.paused=!0,c.setConnectionStatus(Ue.PAUSED)})(i);else if(r.type===xe.READY&&o.isOriginator)(function(c){const{state:s}=c;c.setConnectionStatus(Ue.LINKED);const a=s.paused;s.paused=!1,c.emit(te.CLIENTS_READY,{isOriginator:s.isOriginator,walletInfo:s.walletInfo}),a&&(s.authorized=!0,c.emit(te.AUTHORIZED))})(i);else{if(r.type===xe.OTP&&o.isOriginator)return void(function(c,s){var a;const{state:l}=c;c.emit(te.OTP,s.otpAnswer),"6.6".localeCompare(((a=l.walletInfo)===null||a===void 0?void 0:a.version)||"")===1&&c.emit(te.SDK_RPC_CALL,{method:Fe.ETH_REQUESTACCOUNTS,params:[]})})(i,r);r.type===xe.AUTHORIZED&&o.isOriginator&&(function(c){const{state:s}=c;s.authorized=!0,c.emit(te.AUTHORIZED)})(i)}i.emit(te.MESSAGE,r)}else(function(c,s){var a;const{state:l}=c;(a=l.communicationLayer)===null||a===void 0||a.sendMessage({type:xe.WALLET_INFO,walletInfo:l.walletInfo}),l.originatorInfo=s.originatorInfo||s.originator,c.emit(te.CLIENTS_READY,{isOriginator:l.isOriginator,originatorInfo:l.originatorInfo}),l.paused=!1})(i,r)})(n,t)}}function gm(t){return()=>{const{state:e}=t;W.RemoteCommunication("[RemoteCommunication: handleSocketReconnectEvent()] on 'socket_reconnect' -- reset key exchange status / set ready to false"),e.ready=!1,e.authorized=!1,dh(e),t.emitServiceStatusEvent({context:"socket_reconnect"})}}function ym(t){return()=>{const{state:e}=t;W.RemoteCommunication("[RemoteCommunication: handleSocketDisconnectedEvent()] on 'socket_Disconnected' set ready to false"),e.ready=!1}}function vm(t){return()=>J(this,void 0,void 0,(function*(){var e,n,r,i,o,c,s;const{state:a}=t;W.RemoteCommunication(`[RemoteCommunication: handleFullPersistenceEvent()] context=${a.context}`),t.state.ready=!0,t.state.clientsConnected=!0,t.state.authorized=!0,t.state.relayPersistence=!0,(e=t.state.communicationLayer)===null||e===void 0||e.getKeyExchange().setKeysExchanged(!0),t.emit(te.KEYS_EXCHANGED,{keysExchanged:!0,isOriginator:!0}),t.emit(te.AUTHORIZED),t.emit(te.CLIENTS_READY),t.emit(te.CHANNEL_PERSISTENCE);try{a.channelConfig=Object.assign(Object.assign({},a.channelConfig),{localKey:(n=a.communicationLayer)===null||n===void 0?void 0:n.getKeyExchange().getKeyInfo().ecies.private,otherKey:(r=a.communicationLayer)===null||r===void 0?void 0:r.getKeyExchange().getOtherPublicKey(),channelId:(i=a.channelId)!==null&&i!==void 0?i:"",validUntil:(c=(o=a.channelConfig)===null||o===void 0?void 0:o.validUntil)!==null&&c!==void 0?c:cr,relayPersistence:!0}),yield(s=a.storageManager)===null||s===void 0?void 0:s.persistChannelConfig(a.channelConfig)}catch{}}))}function dl({communicationLayerPreference:t,otherPublicKey:e,reconnect:n,ecies:r,communicationServerUrl:i=ar,instance:o}){var c,s,a,l,u,d,h,f,m,g,w;const{state:p}=o;if(W.RemoteCommunication("[initCommunicationLayer()] ",JSON.stringify(p,null,2)),t!==Bn.SOCKET)throw new Error("Invalid communication protocol");p.communicationLayer=new cm({communicationLayerPreference:t,otherPublicKey:e,reconnect:n,transports:p.transports,communicationServerUrl:i,context:p.context,ecies:r,logging:p.logging,remote:o});let C=typeof document<"u"&&document.URL||"",_=typeof document<"u"&&document.title||"";!((c=p.dappMetadata)===null||c===void 0)&&c.url&&(C=p.dappMetadata.url),!((s=p.dappMetadata)===null||s===void 0)&&s.name&&(_=p.dappMetadata.name);const P=(d=(l=(a=p.dappMetadata)===null||a===void 0?void 0:a.name)!==null&&l!==void 0?l:(u=p.dappMetadata)===null||u===void 0?void 0:u.url)!==null&&d!==void 0?d:"N/A",L=typeof window<"u"&&window.location!==void 0&&(h=window.location.hostname)!==null&&h!==void 0?h:P,U={url:C,title:_,source:(f=p.dappMetadata)===null||f===void 0?void 0:f.source,dappId:L,anonId:p.anonId,icon:((m=p.dappMetadata)===null||m===void 0?void 0:m.iconUrl)||((g=p.dappMetadata)===null||g===void 0?void 0:g.base64Icon),platform:p.platformType,apiVersion:kn.version,connector:(w=p.dappMetadata)===null||w===void 0?void 0:w.connector};p.originatorInfo=U;const q={[te.AUTHORIZED]:lm(o),[te.MESSAGE]:mm(o),[te.CHANNEL_PERSISTENCE]:vm(o),[te.CLIENTS_CONNECTED]:dm(o,t),[te.KEYS_EXCHANGED]:pm(o,t),[te.SOCKET_DISCONNECTED]:ym(o),[te.SOCKET_RECONNECT]:gm(o),[te.CLIENTS_DISCONNECTED]:hm(o),[te.KEY_INFO]:()=>{},[te.CHANNEL_CREATED]:um(o),[te.CLIENTS_WAITING]:fm(o),[te.RPC_UPDATE]:F=>{o.emit(te.RPC_UPDATE,F)}};for(const[F,D]of Object.entries(q))try{p.communicationLayer.on(F,D)}catch{}}function ph(t){return J(this,arguments,void 0,(function*({options:e,instance:n}){const{state:r}=n;return W.RemoteCommunication(`[RemoteCommunication: disconnect()] channel=${r.channelId}`,e),new Promise(((i,o)=>{var c,s,a,l,u,d;e!=null&&e.terminate?(n.state.ready&&en({id:(c=n.state.channelId)!==null&&c!==void 0?c:"",event:Oe.TERMINATED},n.state.communicationServerUrl).catch((h=>{})),r.ready=!1,r.paused=!1,(s=r.storageManager)===null||s===void 0||s.terminate((a=r.channelId)!==null&&a!==void 0?a:""),n.state.terminated=!0,e.sendMessage?!((l=r.communicationLayer)===null||l===void 0)&&l.getKeyInfo().keysExchanged&&n.state.communicationLayer&&hh(n.state.communicationLayer,{type:xe.TERMINATE}).then((()=>{i(!0)})).catch((h=>{o(h)})):i(!0),r.authorized=!1,r.relayPersistence=!1,r.channelId=yn(),e.channelId=r.channelId,r.channelConfig=void 0,r.originatorConnectStarted=!1,(u=r.communicationLayer)===null||u===void 0||u.disconnect(e),n.setConnectionStatus(Ue.TERMINATED)):((d=r.communicationLayer)===null||d===void 0||d.disconnect(e),n.setConnectionStatus(Ue.DISCONNECTED),i(!0))}))}))}(Bn||(Bn={})).SOCKET="socket",(function(t){t.NonBrowser="nodejs",t.MetaMaskMobileWebview="in-app-browser",t.DesktopWeb="web-desktop",t.MobileWeb="web-mobile",t.ReactNative="react-native"})(Ve||(Ve={}));class bm extends _o.EventEmitter2{constructor(e){super(),this.state={ready:!1,anonId:"",authorized:!1,isOriginator:!1,terminated:!1,protocolVersion:1,paused:!1,deeplinkProtocolAvailable:!1,platformType:"metamask-mobile",analytics:!1,reconnection:!1,originatorInfoSent:!1,communicationServerUrl:ar,context:"",persist:!1,clientsConnected:!1,sessionDuration:cr,originatorConnectStarted:!1,debug:!1,_connectionStatus:Ue.DISCONNECTED},this._options=e;const{anonId:n,platformType:r,communicationLayerPreference:i,otherPublicKey:o,reconnect:c,walletInfo:s,dappMetadata:a,protocolVersion:l,transports:u,context:d,relayPersistence:h,ecies:f,analytics:m=!1,storage:g,sdkVersion:w,communicationServerUrl:p=ar,logging:C,autoConnect:_={timeout:rm}}=e;this.state.anonId=n,this.state.otherPublicKey=o,this.state.dappMetadata=a,this.state.walletInfo=s,this.state.transports=u,this.state.platformType=r,this.state.analytics=m,this.state.protocolVersion=l??1,this.state.isOriginator=!o,this.state.relayPersistence=h,this.state.communicationServerUrl=p,this.state.context=d,this.state.terminated=!1,this.state.sdkVersion=w,this.setMaxListeners(50),this.setConnectionStatus(Ue.DISCONNECTED),g!=null&&g.duration&&(this.state.sessionDuration=cr),this.state.storageOptions=g,this.state.autoConnectOptions=_,this.state.debug=(C==null?void 0:C.remoteLayer)===!0,(C==null?void 0:C.remoteLayer)===!0&&Je.enable("RemoteCommunication:Layer"),(C==null?void 0:C.serviceLayer)===!0&&Je.enable("SocketService:Layer"),(C==null?void 0:C.eciesLayer)===!0&&Je.enable("ECIES:Layer"),(C==null?void 0:C.keyExchangeLayer)===!0&&Je.enable("KeyExchange:Layer"),this.state.logging=C,g!=null&&g.storageManager&&(this.state.storageManager=g.storageManager),W.RemoteCommunication(`[RemoteCommunication: constructor()] protocolVersion=${l} relayPersistence=${h} isOriginator=${this.state.isOriginator} communicationLayerPreference=${i} otherPublicKey=${o} reconnect=${c}`),this.state.isOriginator||dl({communicationLayerPreference:i,otherPublicKey:o,reconnect:c,ecies:f,communicationServerUrl:p,instance:this}),this.emitServiceStatusEvent({context:"constructor"})}initFromDappStorage(){return J(this,void 0,void 0,(function*(){var e;if(this.state.storageManager){const n=yield this.state.storageManager.getPersistedChannelConfig({});n&&(this.state.channelConfig=n,this.state.channelId=n.channelId,this.state.deeplinkProtocolAvailable=(e=n.deeplinkProtocolAvailable)!==null&&e!==void 0&&e,n.relayPersistence&&(this.state.authorized=!0,this.state.ready=!0,this.setConnectionStatus(Ue.LINKED),yield this.connectToChannel({channelId:n.channelId})))}dl({communicationLayerPreference:Bn.SOCKET,otherPublicKey:this.state.otherPublicKey,reconnect:this._options.reconnect,ecies:this._options.ecies,communicationServerUrl:this.state.communicationServerUrl,instance:this})}))}originatorSessionConnect(){return J(this,void 0,void 0,(function*(){return yield(function(e){return J(this,void 0,void 0,(function*(){var n;const{state:r}=e;if(!r.storageManager)return void W.RemoteCommunication("[RemoteCommunication: originatorSessionConnect()] no storage manager defined - skip");const i=yield r.storageManager.getPersistedChannelConfig({});if(W.RemoteCommunication(`[RemoteCommunication: originatorSessionConnect()] autoStarted=${r.originatorConnectStarted} channelConfig`,i),(n=r.communicationLayer)===null||n===void 0?void 0:n.isConnected())return W.RemoteCommunication("[RemoteCommunication: originatorSessionConnect()] socket already connected - skip"),i;if(i){if(i.validUntil>Date.now())return r.channelConfig=i,r.originatorConnectStarted=!0,r.channelId=i==null?void 0:i.channelId,r.reconnection=!0,i;W.RemoteCommunication("[RemoteCommunication: autoConnect()] Session has expired")}r.originatorConnectStarted=!1}))})(this)}))}generateChannelIdConnect(){return J(this,void 0,void 0,(function*(){return(function(e){return J(this,void 0,void 0,(function*(){var n,r,i,o,c,s;if(!e.communicationLayer)throw new Error("communication layer not initialized");if(e.ready)throw new Error("Channel already connected");if(e.channelId&&(!((n=e.communicationLayer)===null||n===void 0)&&n.isConnected()))return e.channelConfig=Object.assign(Object.assign({},e.channelConfig),{channelId:e.channelId,validUntil:Date.now()+e.sessionDuration}),(r=e.storageManager)===null||r===void 0||r.persistChannelConfig(e.channelConfig),{channelId:e.channelId,privKey:(o=(i=e.communicationLayer)===null||i===void 0?void 0:i.getKeyInfo())===null||o===void 0?void 0:o.ecies.private,pubKey:(s=(c=e.communicationLayer)===null||c===void 0?void 0:c.getKeyInfo())===null||s===void 0?void 0:s.ecies.public};W.RemoteCommunication("[RemoteCommunication: generateChannelId()]");const a=yield e.communicationLayer.createChannel();W.RemoteCommunication("[RemoteCommunication: generateChannelId()] channel created",a);const l=Object.assign(Object.assign({},e.channelConfig),{channelId:a.channelId,localKey:a.privKey,validUntil:Date.now()+e.sessionDuration});return e.channelId=a.channelId,e.channelConfig=l,{channelId:e.channelId,pubKey:a.pubKey,privKey:a.privKey}}))})(this.state)}))}clean(){return dh(this.state)}connectToChannel({channelId:e,withKeyExchange:n,authorized:r}){return(function(i){return J(this,arguments,void 0,(function*({channelId:o,withKeyExchange:c,authorized:s,state:a}){var l,u,d;if(!Os(o))throw W.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${a.context} invalid channel channelId=${o}`),new Error(`Invalid channel ${o}`);if(W.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${a.context} channelId=${o} withKeyExchange=${c}`),(l=a.communicationLayer)===null||l===void 0?void 0:l.isConnected())return void W.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${a.context} already connected - interrupt connection.`);a.channelId=o,yield(u=a.communicationLayer)===null||u===void 0?void 0:u.connectToChannel({channelId:o,authorized:s,withKeyExchange:c});const h=Object.assign(Object.assign({},a.channelConfig),{channelId:o,validUntil:Date.now()+a.sessionDuration});a.channelConfig=h,(d=a.storageManager)===null||d===void 0||d.persistChannelConfig(h)}))})({channelId:e,authorized:r,withKeyExchange:n,state:this.state})}sendMessage(e){return J(this,void 0,void 0,(function*(){const n=this.state.isOriginator&&e.method&&Jr(e.method);n&&Re.analytics.track("sdk_action_requested",{action:e.method});try{return yield(function(r,i){return J(this,void 0,void 0,(function*(){var o,c;const{state:s}=r;W.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${s.context} paused=${s.paused} ready=${s.ready} relayPersistence=${s.relayPersistence} authorized=${s.authorized} socket=${(o=s.communicationLayer)===null||o===void 0?void 0:o.isConnected()} clientsConnected=${s.clientsConnected} status=${s._connectionStatus}`,i),s.relayPersistence||s.ready&&(!((c=s.communicationLayer)===null||c===void 0)&&c.isConnected())&&s.clientsConnected||(W.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${s.context} SKIP message waiting for MM mobile readiness.`),yield new Promise((a=>{r.once(te.CLIENTS_READY,a)})),W.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${s.context} AFTER SKIP / READY -- sending pending message`));try{return yield(function(l,u){return J(this,void 0,void 0,(function*(){return new Promise((d=>{var h;const{state:f}=l;W.RemoteCommunication(`[RemoteCommunication: handleAuthorization()] context=${f.context} ready=${f.ready} authorized=${f.authorized} method=${u.method}`),!f.isOriginator||f.authorized||f.relayPersistence?(h=f.communicationLayer)===null||h===void 0||h.sendMessage(u).then((m=>{d(m)})).catch((m=>{d(!1)})):l.once(te.AUTHORIZED,(()=>{var m;W.RemoteCommunication(`[RemoteCommunication: handleAuthorization()] context=${f.context} AFTER SKIP / AUTHORIZED -- sending pending message`),(m=f.communicationLayer)===null||m===void 0||m.sendMessage(u).then((g=>{d(g)})).catch((g=>{d(!1)}))}))}))}))})(r,i)}catch(a){throw a}}))})(this,e)}catch(r){throw n&&Re.analytics.track("sdk_action_failed",{action:e.method}),r}}))}testStorage(){return J(this,void 0,void 0,(function*(){return(function(e){return J(this,void 0,void 0,(function*(){var n;const r=yield(n=e.storageManager)===null||n===void 0?void 0:n.getPersistedChannelConfig();W.RemoteCommunication("[RemoteCommunication: testStorage()] res",r)}))})(this.state)}))}hasDeeplinkProtocol(){return this.state.deeplinkProtocolAvailable}getChannelConfig(){return this.state.channelConfig}isReady(){return this.state.ready}isConnected(){var e;return(e=this.state.communicationLayer)===null||e===void 0?void 0:e.isConnected()}isAuthorized(){return this.state.authorized}isPaused(){return this.state.paused}getCommunicationLayer(){return this.state.communicationLayer}ping(){return J(this,void 0,void 0,(function*(){var e;W.RemoteCommunication(`[RemoteCommunication: ping()] channel=${this.state.channelId}`),yield(e=this.state.communicationLayer)===null||e===void 0?void 0:e.ping()}))}testLogger(){W.RemoteCommunication(`testLogger() channel=${this.state.channelId}`),W.SocketService(`testLogger() channel=${this.state.channelId}`),W.Ecies(`testLogger() channel=${this.state.channelId}`),W.KeyExchange(`testLogger() channel=${this.state.channelId}`)}keyCheck(){var e;W.RemoteCommunication(`[RemoteCommunication: keyCheck()] channel=${this.state.channelId}`),(e=this.state.communicationLayer)===null||e===void 0||e.keyCheck()}setConnectionStatus(e){this.state._connectionStatus!==e&&(this.state._connectionStatus=e,this.emit(te.CONNECTION_STATUS,e),this.emitServiceStatusEvent({context:"setConnectionStatus"}))}emitServiceStatusEvent(e={}){this.emit(te.SERVICE_STATUS,this.getServiceStatus())}getConnectionStatus(){return this.state._connectionStatus}getServiceStatus(){return{originatorInfo:this.state.originatorInfo,keyInfo:this.getKeyInfo(),connectionStatus:this.state._connectionStatus,channelConfig:this.state.channelConfig,channelId:this.state.channelId}}getKeyInfo(){var e;return(e=this.state.communicationLayer)===null||e===void 0?void 0:e.getKeyInfo()}resetKeys(){var e;(e=this.state.communicationLayer)===null||e===void 0||e.resetKeys()}setOtherPublicKey(e){var n;const r=(n=this.state.communicationLayer)===null||n===void 0?void 0:n.getKeyExchange();if(!r)throw new Error("KeyExchange is not initialized.");r.getOtherPublicKey()!==e&&r.setOtherPublicKey(e)}pause(){return J(this,void 0,void 0,(function*(){var e;W.RemoteCommunication(`[RemoteCommunication: pause()] channel=${this.state.channelId}`),yield(e=this.state.communicationLayer)===null||e===void 0?void 0:e.pause(),this.setConnectionStatus(Ue.PAUSED)}))}getVersion(){return kn.version}hasRelayPersistence(){var e;return(e=this.state.relayPersistence)!==null&&e!==void 0&&e}resume(){return J(this,void 0,void 0,(function*(){return(function(e){return J(this,void 0,void 0,(function*(){var n;const{state:r}=e;W.RemoteCommunication(`[RemoteCommunication: resume()] channel=${r.channelId}`),yield(n=r.communicationLayer)===null||n===void 0?void 0:n.resume(),e.setConnectionStatus(Ue.LINKED)}))})(this)}))}encrypt(e){var n,r,i;const o=(n=this.state.communicationLayer)===null||n===void 0?void 0:n.getKeyExchange(),c=o==null?void 0:o.getOtherPublicKey();if(!c)throw new Error("KeyExchange not completed");return(i=(r=this.state.communicationLayer)===null||r===void 0?void 0:r.state.eciesInstance)===null||i===void 0?void 0:i.encrypt(e,c)}decrypt(e){var n,r,i;if(!(!((n=this.state.communicationLayer)===null||n===void 0)&&n.state.eciesInstance))throw new Error("ECIES instance is not initialized");return(i=(r=this.state.communicationLayer)===null||r===void 0?void 0:r.state.eciesInstance)===null||i===void 0?void 0:i.decrypt(e)}getChannelId(){return this.state.channelId}getRPCMethodTracker(){var e;return(e=this.state.communicationLayer)===null||e===void 0?void 0:e.getRPCMethodTracker()}reject({channelId:e}){return(function(n){return J(this,arguments,void 0,(function*({channelId:r,state:i}){var o,c,s;if(!Os(r))throw W.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${i.context} invalid channel channelId=${r}`),new Error(`Invalid channel ${r}`);if(i.isOriginator)return void W.RemoteCommunication(`[RemoteCommunication: reject()] context=${i.context} isOriginator=${i.isOriginator} channelId=${r}`);const{socket:a}=(c=(o=i.communicationLayer)===null||o===void 0?void 0:o.state)!==null&&c!==void 0?c:{};a!=null&&a.connected||(W.RemoteCommunication(`[RemoteCommunication: reject()] context=${i.context} socket already connected`),a==null||a.connect()),en(Object.assign(Object.assign({id:r,event:Oe.REJECTED},i.originatorInfo),{sdkVersion:i.sdkVersion,commLayerVersion:kn.version,walletVersion:(s=i.walletInfo)===null||s===void 0?void 0:s.version}),i.communicationServerUrl).catch((l=>{})),yield new Promise(((l,u)=>{a==null||a.emit(te.REJECTED,{channelId:r},((d,h)=>{W.RemoteCommunication(`[RemoteCommunication: reject()] context=${i.context} socket=${a==null?void 0:a.id}`,{error:d,response:h}),d?u(d):l(h)}))}))}))})({channelId:e,state:this.state})}disconnect(e){return J(this,void 0,void 0,(function*(){return ph({options:e,instance:this})}))}}(function(t){t.RENEW="renew",t.LINK="link"})(ul||(ul={}));var wm="ERC721",Em="ERC1155",Me={errors:{disconnected:()=>"MetaMask: Disconnected from chain. Attempting to connect.",permanentlyDisconnected:()=>"MetaMask: Disconnected from MetaMask background. Page reload required.",sendSiteMetadata:()=>"MetaMask: Failed to send site metadata. This is an internal error, please report this bug.",unsupportedSync:t=>`MetaMask: The MetaMask Ethereum provider does not support synchronous methods like ${t} without a callback parameter.`,invalidDuplexStream:()=>"Must provide a Node.js-style duplex stream.",invalidNetworkParams:()=>"MetaMask: Received invalid network parameters. Please report this bug.",invalidRequestArgs:()=>"Expected a single, non-array, object argument.",invalidRequestMethod:()=>"'args.method' must be a non-empty string.",invalidRequestParams:()=>"'args.params' must be an object or array if provided.",invalidLoggerObject:()=>"'args.logger' must be an object if provided.",invalidLoggerMethod:t=>`'args.logger' must include required method '${t}'.`},info:{connected:t=>`MetaMask: Connected to chain with ID "${t}".`},warnings:{chainIdDeprecation:`MetaMask: 'ethereum.chainId' is deprecated and may be removed in the future. Please use the 'eth_chainId' RPC method instead.
|
|
10
|
+
For more information, see: https://github.com/MetaMask/metamask-improvement-proposals/discussions/23`,networkVersionDeprecation:`MetaMask: 'ethereum.networkVersion' is deprecated and may be removed in the future. Please use the 'net_version' RPC method instead.
|
|
11
|
+
For more information, see: https://github.com/MetaMask/metamask-improvement-proposals/discussions/23`,selectedAddressDeprecation:`MetaMask: 'ethereum.selectedAddress' is deprecated and may be removed in the future. Please use the 'eth_accounts' RPC method instead.
|
|
12
|
+
For more information, see: https://github.com/MetaMask/metamask-improvement-proposals/discussions/23`,enableDeprecation:`MetaMask: 'ethereum.enable()' is deprecated and may be removed in the future. Please use the 'eth_requestAccounts' RPC method instead.
|
|
13
|
+
For more information, see: https://eips.ethereum.org/EIPS/eip-1102`,sendDeprecation:`MetaMask: 'ethereum.send(...)' is deprecated and may be removed in the future. Please use 'ethereum.sendAsync(...)' or 'ethereum.request(...)' instead.
|
|
14
|
+
For more information, see: https://eips.ethereum.org/EIPS/eip-1193`,events:{close:`MetaMask: The event 'close' is deprecated and may be removed in the future. Please use 'disconnect' instead.
|
|
15
|
+
For more information, see: https://eips.ethereum.org/EIPS/eip-1193#disconnect`,data:`MetaMask: The event 'data' is deprecated and will be removed in the future. Use 'message' instead.
|
|
16
|
+
For more information, see: https://eips.ethereum.org/EIPS/eip-1193#message`,networkChanged:`MetaMask: The event 'networkChanged' is deprecated and may be removed in the future. Use 'chainChanged' instead.
|
|
17
|
+
For more information, see: https://eips.ethereum.org/EIPS/eip-1193#chainchanged`,notification:`MetaMask: The event 'notification' is deprecated and may be removed in the future. Use 'message' instead.
|
|
18
|
+
For more information, see: https://eips.ethereum.org/EIPS/eip-1193#message`},rpc:{ethDecryptDeprecation:`MetaMask: The RPC method 'eth_decrypt' is deprecated and may be removed in the future.
|
|
19
|
+
For more information, see: https://medium.com/metamask/metamask-api-method-deprecation-2b0564a84686`,ethGetEncryptionPublicKeyDeprecation:`MetaMask: The RPC method 'eth_getEncryptionPublicKey' is deprecated and may be removed in the future.
|
|
20
|
+
For more information, see: https://medium.com/metamask/metamask-api-method-deprecation-2b0564a84686`,walletWatchAssetNFTExperimental:`MetaMask: The RPC method 'wallet_watchAsset' is experimental for ERC721/ERC1155 assets and may change in the future.
|
|
21
|
+
For more information, see: https://github.com/MetaMask/metamask-improvement-proposals/blob/main/MIPs/mip-1.md and https://github.com/MetaMask/metamask-improvement-proposals/blob/main/PROCESS-GUIDE.md#proposal-lifecycle`},experimentalMethods:"MetaMask: 'ethereum._metamask' exposes non-standard, experimental methods. They may be removed or changed without warning."}};function _m(t){const e={ethDecryptDeprecation:!1,ethGetEncryptionPublicKeyDeprecation:!1,walletWatchAssetNFTExperimental:!1};return(n,r,i)=>{var o;e.ethDecryptDeprecation||n.method!=="eth_decrypt"?e.ethGetEncryptionPublicKeyDeprecation||n.method!=="eth_getEncryptionPublicKey"?!e.walletWatchAssetNFTExperimental&&n.method==="wallet_watchAsset"&&[wm,Em].includes(((o=n.params)==null?void 0:o.type)||"")&&(t.warn(Me.warnings.rpc.walletWatchAssetNFTExperimental),e.walletWatchAssetNFTExperimental=!0):(t.warn(Me.warnings.rpc.ethGetEncryptionPublicKeyDeprecation),e.ethGetEncryptionPublicKeyDeprecation=!0):(t.warn(Me.warnings.rpc.ethDecryptDeprecation),e.ethDecryptDeprecation=!0),i()}}var mh=4294967295,hl=Math.floor(Math.random()*mh);function Sm(){return(t,e,n,r)=>{const i=t.id,o=hl=(hl+1)%mh;t.id=o,e.id=o,n((c=>{t.id=i,e.id=i,c()}))}}var Ia=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},bn=(t,e,n)=>(Ia(t,e,"read from private field"),n?n.call(t):e.get(t)),St=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},Ei=(t,e,n,r)=>(Ia(t,e,"write to private field"),e.set(t,n),n),Ge=(t,e,n)=>(Ia(t,e,"access private method"),n),pn={invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},fl={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}};function pl(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}var so=(t,e)=>Object.hasOwnProperty.call(t,e);class Cm extends TypeError{constructor(e,n){let r;const{message:i,explanation:o,...c}=e,{path:s}=e,a=s.length===0?i:`At path: ${s.join(".")} -- ${i}`;super(o??a),o!=null&&(this.cause=a),Object.assign(this,c),this.name=this.constructor.name,this.failures=()=>r??(r=[e,...n()])}}function Qt(t){return typeof t=="object"&&t!=null}function Ut(t){return typeof t=="symbol"?t.toString():typeof t=="string"?JSON.stringify(t):`${t}`}function km(t,e,n,r){if(t===!0)return;t===!1?t={}:typeof t=="string"&&(t={message:t});const{path:i,branch:o}=e,{type:c}=n,{refinement:s,message:a=`Expected a value of type \`${c}\`${s?` with refinement \`${s}\``:""}, but received: \`${Ut(r)}\``}=t;return{value:r,type:c,refinement:s,key:i[i.length-1],path:i,branch:o,...t,message:a}}function*ml(t,e,n,r){(function(i){return Qt(i)&&typeof i[Symbol.iterator]=="function"})(t)||(t=[t]);for(const i of t){const o=km(i,e,n,r);o&&(yield o)}}function*La(t,e,n={}){const{path:r=[],branch:i=[t],coerce:o=!1,mask:c=!1}=n,s={path:r,branch:i};if(o&&(t=e.coercer(t,s),c&&e.type!=="type"&&Qt(e.schema)&&Qt(t)&&!Array.isArray(t)))for(const l in t)e.schema[l]===void 0&&delete t[l];let a="valid";for(const l of e.validator(t,s))l.explanation=n.message,a="not_valid",yield[l,void 0];for(let[l,u,d]of e.entries(t,s)){const h=La(u,d,{path:l===void 0?r:[...r,l],branch:l===void 0?i:[...i,u],coerce:o,mask:c,message:n.message});for(const f of h)f[0]?(a=f[0].refinement!=null?"not_refined":"not_valid",yield[f[0],void 0]):o&&(u=f[1],l===void 0?t=u:t instanceof Map?t.set(l,u):t instanceof Set?t.add(u):Qt(t)&&(u!==void 0||l in t)&&(t[l]=u))}if(a!=="not_valid")for(const l of e.refiner(t,s))l.explanation=n.message,a="not_refined",yield[l,void 0];a==="valid"&&(yield[void 0,t])}class At{constructor(e){const{type:n,schema:r,validator:i,refiner:o,coercer:c=(a=>a),entries:s=function*(){}}=e;this.type=n,this.schema=r,this.entries=s,this.coercer=c,this.validator=i?(a,l)=>ml(i(a,l),l,this,a):()=>[],this.refiner=o?(a,l)=>ml(o(a,l),l,this,a):()=>[]}assert(e,n){return gh(e,this,n)}create(e,n){return yh(e,this,n)}is(e){return hr(e,this)}mask(e,n){return(function(r,i,o){const c=Kr(r,i,{coerce:!0,mask:!0,message:o});if(c[0])throw c[0];return c[1]})(e,this,n)}validate(e,n={}){return Kr(e,this,n)}}function gh(t,e,n){const r=Kr(t,e,{message:n});if(r[0])throw r[0]}function yh(t,e,n){const r=Kr(t,e,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}function hr(t,e){return!Kr(t,e)[0]}function Kr(t,e,n={}){const r=La(t,e,n),i=(function(o){const{done:c,value:s}=o.next();return c?void 0:s})(r);return i[0]?[new Cm(i[0],(function*(){for(const c of r)c[0]&&(yield c[0])})),void 0]:[void 0,i[1]]}function An(t,e){return new At({type:t,schema:null,validator:e})}function gl(t){let e;return new At({type:"lazy",schema:null,*entries(n,r){e??(e=t()),yield*e.entries(n,r)},validator:(n,r)=>(e??(e=t()),e.validator(n,r)),coercer:(n,r)=>(e??(e=t()),e.coercer(n,r)),refiner:(n,r)=>(e??(e=t()),e.refiner(n,r))})}function vh(t){return new At({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(const[n,r]of e.entries())yield[n,r,t]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${Ut(e)}`})}function bh(t){const e=Ut(t),n=typeof t;return new At({type:"literal",schema:n==="string"||n==="number"||n==="boolean"?t:null,validator:r=>r===t||`Expected the literal \`${e}\`, but received: ${Ut(r)}`})}function wh(){return An("number",(t=>typeof t=="number"&&!isNaN(t)||`Expected a number, but received: ${Ut(t)}`))}function Eh(t){const e=t?Object.keys(t):[],n=An("never",(()=>!1));return new At({type:"object",schema:t||null,*entries(r){if(t&&Qt(r)){const i=new Set(Object.keys(r));for(const o of e)i.delete(o),yield[o,r[o],t[o]];for(const o of i)yield[o,r[o],n]}},validator:r=>Qt(r)||`Expected an object, but received: ${Ut(r)}`,coercer:r=>Qt(r)?{...r}:r})}function yl(t){return new At({...t,validator:(e,n)=>e===void 0||t.validator(e,n),refiner:(e,n)=>e===void 0||t.refiner(e,n)})}function _h(t,e){return new At({type:"record",schema:null,*entries(n){if(Qt(n))for(const r in n){const i=n[r];yield[r,r,t],yield[r,i,e]}},validator:n=>Qt(n)||`Expected an object, but received: ${Ut(n)}`})}function xn(){return An("string",(t=>typeof t=="string"||`Expected a string, but received: ${Ut(t)}`))}function To(t){const e=t.map((n=>n.type)).join(" | ");return new At({type:"union",schema:null,coercer(n){for(const r of t){const[i,o]=r.validate(n,{coerce:!0});if(!i)return o}return n},validator(n,r){const i=[];for(const o of t){const[...c]=La(n,o,r),[s]=c;if(!s[0])return[];for(const[a]of c)a&&i.push(a)}return[`Expected the value to satisfy a union of \`${e}\`, but received: ${Ut(n)}`,...i]}})}function Am(t){return(function(e){return(function(n){return typeof n=="object"&&n!==null&&"message"in n})(e)&&typeof e.message=="string"?e.message:e==null?"":String(e)})(t).replace(/\.$/u,"")}function xm(t,e){var r,i;return n=t,typeof((i=(r=n==null?void 0:n.prototype)==null?void 0:r.constructor)==null?void 0:i.name)=="string"?new t({message:e}):t({message:e});var n}var Tm=class extends Error{constructor(t){super(t.message),this.code="ERR_ASSERTION"}};function Sh(){throw new Error("setTimeout has not been defined")}function Ch(){throw new Error("clearTimeout has not been defined")}var cn=Sh,ln=Ch;function kh(t){if(cn===setTimeout)return setTimeout(t,0);if((cn===Sh||!cn)&&setTimeout)return cn=setTimeout,setTimeout(t,0);try{return cn(t,0)}catch{try{return cn.call(null,t,0)}catch{return cn.call(this,t,0)}}}typeof Xe.setTimeout=="function"&&(cn=setTimeout),typeof Xe.clearTimeout=="function"&&(ln=clearTimeout);var Ln,Xt=[],or=!1,Di=-1;function Mm(){or&&Ln&&(or=!1,Ln.length?Xt=Ln.concat(Xt):Di=-1,Xt.length&&Ah())}function Ah(){if(!or){var t=kh(Mm);or=!0;for(var e=Xt.length;e;){for(Ln=Xt,Xt=[];++Di<e;)Ln&&Ln[Di].run();Di=-1,e=Xt.length}Ln=null,or=!1,(function(n){if(ln===clearTimeout)return clearTimeout(n);if((ln===Ch||!ln)&&clearTimeout)return ln=clearTimeout,clearTimeout(n);try{return ln(n)}catch{try{return ln.call(null,n)}catch{return ln.call(this,n)}}})(t)}}function xh(t,e){this.fun=t,this.array=e}xh.prototype.run=function(){this.fun.apply(null,this.array)};function Kn(){}var Rm=Kn,Om=Kn,Pm=Kn,Im=Kn,Lm=Kn,Nm=Kn,Dm=Kn,Gn=Xe.performance||{},Bm=Gn.now||Gn.mozNow||Gn.msNow||Gn.oNow||Gn.webkitNow||function(){return new Date().getTime()},$m=new Date,Ee={nextTick:function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];Xt.push(new xh(t,e)),Xt.length!==1||or||kh(Ah)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:Rm,addListener:Om,once:Pm,off:Im,removeListener:Lm,removeAllListeners:Nm,emit:Dm,binding:function(t){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(t){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(t){var e=.001*Bm.call(Gn),n=Math.floor(e),r=Math.floor(e%1*1e9);return t&&(n-=t[0],(r-=t[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-$m)/1e3}},jr=t=>Eh(t);function vl({path:t,branch:e}){const n=t[t.length-1];return so(e[e.length-2],n)}function ao(t){return new At({...t,type:`optional ${t.type}`,validator:(e,n)=>!vl(n)||t.validator(e,n),refiner:(e,n)=>!vl(n)||t.refiner(e,n)})}var _i,bl,wl,co=To([bh(null),An("boolean",(t=>typeof t=="boolean")),An("finite number",(t=>hr(t,wh())&&Number.isFinite(t))),xn(),vh(gl((()=>co))),_h(xn(),gl((()=>co)))]),Ur=(_i=co,bl=An("any",(()=>!0)),wl=t=>((function(e,n,r="Assertion failed",i=Tm){try{gh(e,n)}catch(o){throw xm(i,`${r}: ${Am(o)}.`)}})(t,co),JSON.parse(JSON.stringify(t,((e,n)=>{if(e!=="__proto__"&&e!=="constructor")return n})))),new At({..._i,coercer:(t,e)=>hr(t,bl)?_i.coercer(wl(t,e),e):_i.coercer(t,e)}));function Zs(t){try{return(function(e){yh(e,Ur)})(t),!0}catch{return!1}}var xr=bh("2.0"),Bi=(function(t){return new At({...t,validator:(e,n)=>e===null||t.validator(e,n),refiner:(e,n)=>e===null||t.refiner(e,n)})})(To([wh(),xn()])),Js=jr({code:An("integer",(t=>typeof t=="number"&&!isNaN(t)&&Number.isInteger(t)||`Expected an integer, but received: ${Ut(t)}`)),message:xn(),data:ao(Ur),stack:ao(xn())}),Th=To([_h(xn(),Ur),vh(Ur)]),Km=jr({id:Bi,jsonrpc:xr,method:xn(),params:ao(Th)}),jm=jr({jsonrpc:xr,method:xn(),params:ao(Th)});function El(t){return hr(t,Km)}function _l(t){return hr(t,Js)}Eh({id:Bi,jsonrpc:xr,result:yl(An("unknown",(()=>!0))),error:yl(Js)}),To([jr({id:Bi,jsonrpc:xr,result:Ur}),jr({id:Bi,jsonrpc:xr,error:Js})]);var Sl=pn.internal,Um="Unspecified error message. This is a bug, please report it.",Hm={code:Sl,message:Mh(Sl)},Fm="Unspecified server error.";function Mh(t,e=Um){if((function(n){return Number.isInteger(n)})(t)){const n=t.toString();if(so(fl,n))return fl[n].message;if((function(r){return r>=-32099&&r<=-32e3})(t))return Fm}return e}function Cl(t,{fallbackError:e=Hm,shouldIncludeStack:n=!0}={}){if(!_l(e))throw new Error("Must provide fallback error with integer number code and string message.");const r=(function(i,o){if(i&&typeof i=="object"&&"serialize"in i&&typeof i.serialize=="function")return i.serialize();if(_l(i))return i;const c=Rh(i);return{...o,data:{cause:c}}})(t,e);return n||delete r.stack,r}function Rh(t){return Array.isArray(t)?t.map((e=>Zs(e)?e:pl(e)?kl(e):null)):pl(t)?kl(t):Zs(t)?t:null}function kl(t){return Object.getOwnPropertyNames(t).reduce(((e,n)=>{const r=t[n];return Zs(r)&&(e[n]=r),e}),{})}var Oh=Sr;Sr.default=Sr,Sr.stable=Al,Sr.stableStringify=Al;var lo="[...]",Ph="[Circular]",$n=[],Nn=[];function Ih(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function Sr(t,e,n,r){var i;r===void 0&&(r=Ih()),Xs(t,"",0,[],void 0,0,r);try{i=Nn.length===0?JSON.stringify(t,e,n):JSON.stringify(t,Lh(e),n)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;$n.length!==0;){var o=$n.pop();o.length===4?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return i}function sr(t,e,n,r){var i=Object.getOwnPropertyDescriptor(r,n);i.get!==void 0?i.configurable?(Object.defineProperty(r,n,{value:t}),$n.push([r,n,e,i])):Nn.push([e,n,t]):(r[n]=t,$n.push([r,n,e]))}function Xs(t,e,n,r,i,o,c){var s;if(o+=1,typeof t=="object"&&t!==null){for(s=0;s<r.length;s++)if(r[s]===t)return void sr(Ph,t,e,i);if(c.depthLimit!==void 0&&o>c.depthLimit||c.edgesLimit!==void 0&&n+1>c.edgesLimit)return void sr(lo,t,e,i);if(r.push(t),Array.isArray(t))for(s=0;s<t.length;s++)Xs(t[s],s,s,r,t,o,c);else{var a=Object.keys(t);for(s=0;s<a.length;s++){var l=a[s];Xs(t[l],l,s,r,t,o,c)}}r.pop()}}function qm(t,e){return t<e?-1:t>e?1:0}function Al(t,e,n,r){r===void 0&&(r=Ih());var i,o=Qs(t,"",0,[],void 0,0,r)||t;try{i=Nn.length===0?JSON.stringify(o,e,n):JSON.stringify(o,Lh(e),n)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;$n.length!==0;){var c=$n.pop();c.length===4?Object.defineProperty(c[0],c[1],c[3]):c[0][c[1]]=c[2]}}return i}function Qs(t,e,n,r,i,o,c){var s;if(o+=1,typeof t=="object"&&t!==null){for(s=0;s<r.length;s++)if(r[s]===t)return void sr(Ph,t,e,i);try{if(typeof t.toJSON=="function")return}catch{return}if(c.depthLimit!==void 0&&o>c.depthLimit||c.edgesLimit!==void 0&&n+1>c.edgesLimit)return void sr(lo,t,e,i);if(r.push(t),Array.isArray(t))for(s=0;s<t.length;s++)Qs(t[s],s,s,r,t,o,c);else{var a={},l=Object.keys(t).sort(qm);for(s=0;s<l.length;s++){var u=l[s];Qs(t[u],u,s,r,t,o,c),a[u]=t[u]}if(i===void 0)return a;$n.push([i,e,t]),i[e]=a}r.pop()}}function Lh(t){return t=t!==void 0?t:function(e,n){return n},function(e,n){if(Nn.length>0)for(var r=0;r<Nn.length;r++){var i=Nn[r];if(i[1]===e&&i[0]===n){n=i[2],Nn.splice(r,1);break}}return t.call(this,e,n)}}var zm=Ao(Oh),Vt=class extends Error{constructor(t,e,n){if(!Number.isInteger(t))throw new Error('"code" must be an integer.');if(!e||typeof e!="string")throw new Error('"message" must be a non-empty string.');super(e),this.code=t,n!==void 0&&(this.data=n)}serialize(){const t={code:this.code,message:this.message};return this.data!==void 0&&(t.data=this.data,(function(e){if(typeof e!="object"||e===null)return!1;try{let n=e;for(;Object.getPrototypeOf(n)!==null;)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(e)===n}catch{return!1}})(this.data)&&(t.data.cause=Rh(this.data.cause))),this.stack&&(t.stack=this.stack),t}toString(){return zm(this.serialize(),Vm,2)}};function Vm(t,e){if(e!=="[Circular]")return e}var Tr=t=>Wm(pn.invalidRequest,t);function Wm(t,e){const[n,r]=(function(i){if(i){if(typeof i=="string")return[i];if(typeof i=="object"&&!Array.isArray(i)){const{message:o,data:c}=i;if(o&&typeof o!="string")throw new Error("Must specify string message.");return[o??void 0,c]}}return[]})(e);return new Vt(t,n??Mh(t),r)}var Nh={};function un(){}function _e(){_e.init.call(this)}function Dh(t){return t._maxListeners===void 0?_e.defaultMaxListeners:t._maxListeners}function xl(t,e,n,r){var i,o,c;if(typeof n!="function")throw new TypeError('"listener" argument must be a function');if((o=t._events)?(o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),c=o[e]):(o=t._events=new un,t._eventsCount=0),c){if(typeof c=="function"?c=o[e]=r?[n,c]:[c,n]:r?c.unshift(n):c.push(n),!c.warned&&(i=Dh(t))&&i>0&&c.length>i){c.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+c.length+" "+e+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=t,s.type=e,s.count=c.length,(function(a){typeof console.warn=="function"?console.warn(a):console.log(a)})(s)}}else c=o[e]=n,++t._eventsCount;return t}function Tl(t,e,n){var r=!1;function i(){t.removeListener(e,i),r||(r=!0,n.apply(t,arguments))}return i.listener=n,i}function Ml(t){var e=this._events;if(e){var n=e[t];if(typeof n=="function")return 1;if(n)return n.length}return 0}function br(t,e){for(var n=new Array(e);e--;)n[e]=t[e];return n}un.prototype=Object.create(null),_e.EventEmitter=_e,_e.usingDomains=!1,_e.prototype.domain=void 0,_e.prototype._events=void 0,_e.prototype._maxListeners=void 0,_e.defaultMaxListeners=10,_e.init=function(){this.domain=null,_e.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new un,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},_e.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||isNaN(t))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=t,this},_e.prototype.getMaxListeners=function(){return Dh(this)},_e.prototype.emit=function(t){var e,n,r,i,o,c,s,a=t==="error";if(c=this._events)a=a&&c.error==null;else if(!a)return!1;if(s=this.domain,a){if(e=arguments[1],!s){if(e instanceof Error)throw e;var l=new Error('Uncaught, unspecified "error" event. ('+e+")");throw l.context=e,l}return e||(e=new Error('Uncaught, unspecified "error" event')),e.domainEmitter=this,e.domain=s,e.domainThrown=!1,s.emit("error",e),!1}if(!(n=c[t]))return!1;var u=typeof n=="function";switch(r=arguments.length){case 1:(function(d,h,f){if(h)d.call(f);else for(var m=d.length,g=br(d,m),w=0;w<m;++w)g[w].call(f)})(n,u,this);break;case 2:(function(d,h,f,m){if(h)d.call(f,m);else for(var g=d.length,w=br(d,g),p=0;p<g;++p)w[p].call(f,m)})(n,u,this,arguments[1]);break;case 3:(function(d,h,f,m,g){if(h)d.call(f,m,g);else for(var w=d.length,p=br(d,w),C=0;C<w;++C)p[C].call(f,m,g)})(n,u,this,arguments[1],arguments[2]);break;case 4:(function(d,h,f,m,g,w){if(h)d.call(f,m,g,w);else for(var p=d.length,C=br(d,p),_=0;_<p;++_)C[_].call(f,m,g,w)})(n,u,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),o=1;o<r;o++)i[o-1]=arguments[o];(function(d,h,f,m){if(h)d.apply(f,m);else for(var g=d.length,w=br(d,g),p=0;p<g;++p)w[p].apply(f,m)})(n,u,this,i)}return!0},_e.prototype.addListener=function(t,e){return xl(this,t,e,!1)},_e.prototype.on=_e.prototype.addListener,_e.prototype.prependListener=function(t,e){return xl(this,t,e,!0)},_e.prototype.once=function(t,e){if(typeof e!="function")throw new TypeError('"listener" argument must be a function');return this.on(t,Tl(this,t,e)),this},_e.prototype.prependOnceListener=function(t,e){if(typeof e!="function")throw new TypeError('"listener" argument must be a function');return this.prependListener(t,Tl(this,t,e)),this},_e.prototype.removeListener=function(t,e){var n,r,i,o,c;if(typeof e!="function")throw new TypeError('"listener" argument must be a function');if(!(r=this._events))return this;if(!(n=r[t]))return this;if(n===e||n.listener&&n.listener===e)--this._eventsCount==0?this._events=new un:(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if(typeof n!="function"){for(i=-1,o=n.length;o-- >0;)if(n[o]===e||n[o].listener&&n[o].listener===e){c=n[o].listener,i=o;break}if(i<0)return this;if(n.length===1){if(n[0]=void 0,--this._eventsCount==0)return this._events=new un,this;delete r[t]}else(function(s,a){for(var l=a,u=l+1,d=s.length;u<d;l+=1,u+=1)s[l]=s[u];s.pop()})(n,i);r.removeListener&&this.emit("removeListener",t,c||e)}return this},_e.prototype.off=function(t,e){return this.removeListener(t,e)},_e.prototype.removeAllListeners=function(t){var e,n;if(!(n=this._events))return this;if(!n.removeListener)return arguments.length===0?(this._events=new un,this._eventsCount=0):n[t]&&(--this._eventsCount==0?this._events=new un:delete n[t]),this;if(arguments.length===0){for(var r,i=Object.keys(n),o=0;o<i.length;++o)(r=i[o])!=="removeListener"&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=new un,this._eventsCount=0,this}if(typeof(e=n[t])=="function")this.removeListener(t,e);else if(e)do this.removeListener(t,e[e.length-1]);while(e[0]);return this},_e.prototype.listeners=function(t){var e,n,r=this._events;return n=r&&(e=r[t])?typeof e=="function"?[e.listener||e]:(function(i){for(var o=new Array(i.length),c=0;c<o.length;++c)o[c]=i[c].listener||i[c];return o})(e):[],n},_e.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Ml.call(t,e)},_e.prototype.listenerCount=Ml,_e.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var Na=Yr(Object.freeze({__proto__:null,EventEmitter:_e,default:_e}));Object.defineProperty(Nh,"__esModule",{value:!0});const Gm=Na;function Rl(t,e,n){try{Reflect.apply(t,e,n)}catch(r){setTimeout((()=>{throw r}))}}let Ym=class extends Gm.EventEmitter{emit(t,...e){let n=t==="error";const r=this._events;if(r!==void 0)n=n&&r.error===void 0;else if(!n)return!1;if(n){let o;if(e.length>0&&([o]=e),o instanceof Error)throw o;const c=new Error("Unhandled error."+(o?` (${o.message})`:""));throw c.context=o,c}const i=r[t];if(i===void 0)return!1;if(typeof i=="function")Rl(i,this,e);else{const o=i.length,c=(function(s){const a=s.length,l=new Array(a);for(let u=0;u<a;u+=1)l[u]=s[u];return l})(i);for(let s=0;s<o;s+=1)Rl(c[s],this,e)}return!0}};var uo,mn,tr,Cr,$i,Ki,ea,ji,ta,ds,Ol,Ui,na,hs,Pl,Mr,ho,fs,Il,Bh=Nh.default=Ym,Et=class Hi extends Bh{constructor({notificationHandler:e}={}){super(),St(this,Cr),St(this,Ki),St(this,ji),St(this,uo,!1),St(this,mn,void 0),St(this,tr,void 0),Ei(this,mn,[]),Ei(this,tr,e)}destroy(){bn(this,mn).forEach((e=>{"destroy"in e&&typeof e.destroy=="function"&&e.destroy()})),Ei(this,mn,[]),Ei(this,uo,!0)}push(e){Ge(this,Cr,$i).call(this),bn(this,mn).push(e)}handle(e,n){if(Ge(this,Cr,$i).call(this),n&&typeof n!="function")throw new Error('"callback" must be a function if provided.');return Array.isArray(e)?n?Ge(this,Ki,ea).call(this,e,n):Ge(this,Ki,ea).call(this,e):n?Ge(this,ji,ta).call(this,e,n):this._promiseHandle(e)}asMiddleware(){return Ge(this,Cr,$i).call(this),async(e,n,r,i)=>{var o,c;try{const[s,a,l]=await Ge(o=Hi,Ui,na).call(o,e,n,bn(this,mn));return a?(await Ge(c=Hi,Mr,ho).call(c,l),i(s)):r((async u=>{var d;try{await Ge(d=Hi,Mr,ho).call(d,l)}catch(h){return u(h)}return u()}))}catch(s){return i(s)}}}async _promiseHandle(e){return new Promise(((n,r)=>{Ge(this,ji,ta).call(this,e,((i,o)=>{i&&o===void 0?r(i):n(o)})).catch(r)}))}};uo=new WeakMap,mn=new WeakMap,tr=new WeakMap,Cr=new WeakSet,$i=function(){if(bn(this,uo))throw new Error("This engine is destroyed and can no longer be used.")},Ki=new WeakSet,ea=async function(t,e){try{if(t.length===0){const r=[{id:null,jsonrpc:"2.0",error:new Vt(pn.invalidRequest,"Request batch must contain plain objects. Received an empty array")}];return e?e(null,r):r}const n=(await Promise.all(t.map(this._promiseHandle.bind(this)))).filter((r=>r!==void 0));return e?e(null,n):n}catch(n){if(e)return e(n);throw n}},ji=new WeakSet,ta=async function(t,e){var n;if(!t||Array.isArray(t)||typeof t!="object"){const c=new Vt(pn.invalidRequest,"Requests must be plain objects. Received: "+typeof t,{request:t});return e(c,{id:null,jsonrpc:"2.0",error:c})}if(typeof t.method!="string"){const c=new Vt(pn.invalidRequest,"Must specify a string method. Received: "+typeof t.method,{request:t});return bn(this,tr)&&!El(t)?e(null):e(c,{id:t.id??null,jsonrpc:"2.0",error:c})}if(bn(this,tr)&&hr(t,jm)&&!El(t)){try{await bn(this,tr).call(this,t)}catch(c){return e(c)}return e(null)}let r=null;const i={...t},o={id:i.id,jsonrpc:i.jsonrpc};try{await Ge(n=Et,ds,Ol).call(n,i,o,bn(this,mn))}catch(c){r=c}return r&&(delete o.result,o.error||(o.error=Cl(r))),e(r,o)},ds=new WeakSet,Ol=async function(t,e,n){var r,i,o;const[c,s,a]=await Ge(r=Et,Ui,na).call(r,t,e,n);if(Ge(i=Et,fs,Il).call(i,t,e,s),await Ge(o=Et,Mr,ho).call(o,a),c)throw c},Ui=new WeakSet,na=async function(t,e,n){var r;const i=[];let o=null,c=!1;for(const s of n)if([o,c]=await Ge(r=Et,hs,Pl).call(r,t,e,s,i),c)break;return[o,c,i.reverse()]},hs=new WeakSet,Pl=async function(t,e,n,r){return new Promise((i=>{const o=s=>{const a=s||e.error;a&&(e.error=Cl(a)),i([a,!0])},c=s=>{e.error?o(e.error):(s&&(typeof s!="function"&&o(new Vt(pn.internal,`JsonRpcEngine: "next" return handlers must be functions. Received "${typeof s}" for request:
|
|
22
|
+
${ps(t)}`,{request:t})),r.push(s)),i([null,!1]))};try{n(t,e,c,o)}catch(s){o(s)}}))},Mr=new WeakSet,ho=async function(t){for(const e of t)await new Promise(((n,r)=>{e((i=>i?r(i):n()))}))},fs=new WeakSet,Il=function(t,e,n){if(!so(e,"result")&&!so(e,"error"))throw new Vt(pn.internal,`JsonRpcEngine: Response has no error or result for request:
|
|
23
|
+
${ps(t)}`,{request:t});if(!n)throw new Vt(pn.internal,`JsonRpcEngine: Nothing ended request:
|
|
24
|
+
${ps(t)}`,{request:t})},St(Et,ds),St(Et,Ui),St(Et,hs),St(Et,Mr),St(Et,fs);var Zm=Et;function ps(t){return JSON.stringify(t,null,2)}var $h=Object.freeze(["eth_subscription"]),Jm=(t=console)=>[Sm(),Xm(t),_m(t)];function Xm(t){return(e,n,r)=>{typeof e.method=="string"&&e.method||(n.error=Tr({message:"The request 'method' must be a non-empty string.",data:e})),r((i=>{const{error:o}=n;return o&&t.error(`MetaMask - RPC Error: ${o.message}`,o),i()}))}}var Fi=(t,e,n=!0)=>(r,i)=>{r||i.error?e(r||i.error):!n||Array.isArray(i)?t(i):t(i.result)},Kh=t=>!!t&&typeof t=="string"&&t.startsWith("0x"),jh=()=>{};async function Ll(t,e){try{const n=await(async function(){return{name:Qm(window),icon:await eg(window)}})();t.handle({jsonrpc:"2.0",id:1,method:"metamask_sendDomainMetadata",params:n},jh)}catch(n){e.error({message:Me.errors.sendSiteMetadata(),originalError:n})}}function Qm(t){const{document:e}=t,n=e.querySelector('head > meta[property="og:site_name"]');if(n)return n.content;const r=e.querySelector('head > meta[name="title"]');return r?r.content:e.title&&e.title.length>0?e.title:window.location.hostname}async function eg(t){const{document:e}=t,n=e.querySelectorAll('head > link[rel~="icon"]');for(const r of Array.from(n))if(r&&await tg(r.href))return r.href;return null}async function tg(t){return new Promise(((e,n)=>{try{const r=document.createElement("img");r.onload=()=>e(!0),r.onerror=()=>e(!1),r.src=t}catch(r){n(r)}}))}var Uh=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},It=(t,e,n)=>(Uh(t,e,"read from private field"),n?n.call(t):e.get(t)),ra=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},Wt=(t,e,n,r)=>(Uh(t,e,"write to private field"),e.set(t,n),n);function Nl(t,e,n){try{Reflect.apply(t,e,n)}catch(r){setTimeout((()=>{throw r}))}}class ng extends _e{emit(e,...n){let r=e==="error";const i=this._events;if(i!==void 0)r=r&&i.error===void 0;else if(!r)return!1;if(r){let c;if(n.length>0&&([c]=n),c instanceof Error)throw c;const s=new Error("Unhandled error."+(c?` (${c.message})`:""));throw s.context=c,s}const o=i[e];if(o===void 0)return!1;if(typeof o=="function")Nl(o,this,n);else{const c=o.length,s=(function(a){const l=a.length,u=new Array(l);for(let d=0;d<l;d+=1)u[d]=a[d];return u})(o);for(let a=0;a<c;a+=1)Nl(s[a],this,n)}return!0}}var dn,Rn,rg=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,i,o;if(Array.isArray(e)){if((r=e.length)!=n.length)return!1;for(i=r;i--!=0;)if(!t(e[i],n[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if((r=(o=Object.keys(e)).length)!==Object.keys(n).length)return!1;for(i=r;i--!=0;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=r;i--!=0;){var c=o[i];if(!t(e[c],n[c]))return!1}return!0}return e!=e&&n!=n},ig=Ao(rg),Hh=class Fh extends ng{constructor({logger:e=console,maxEventListeners:n=100,rpcMiddleware:r=[]}={}){super(),ra(this,dn,void 0),ra(this,Rn,void 0),this._log=e,this.setMaxListeners(n),this._state={...Fh._defaultState},Wt(this,Rn,null),Wt(this,dn,null),this._handleAccountsChanged=this._handleAccountsChanged.bind(this),this._handleConnect=this._handleConnect.bind(this),this._handleChainChanged=this._handleChainChanged.bind(this),this._handleDisconnect=this._handleDisconnect.bind(this),this._handleUnlockStateChanged=this._handleUnlockStateChanged.bind(this),this._rpcRequest=this._rpcRequest.bind(this),this.request=this.request.bind(this);const i=new Zm;r.forEach((o=>i.push(o))),this._rpcEngine=i}get chainId(){return It(this,dn)}get selectedAddress(){return It(this,Rn)}isConnected(){return this._state.isConnected}async request(e){if(!e||typeof e!="object"||Array.isArray(e))throw Tr({message:Me.errors.invalidRequestArgs(),data:e});const{method:n,params:r}=e;if(typeof n!="string"||n.length===0)throw Tr({message:Me.errors.invalidRequestMethod(),data:e});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw Tr({message:Me.errors.invalidRequestParams(),data:e});const i=r==null?{method:n}:{method:n,params:r};return new Promise(((o,c)=>{this._rpcRequest(i,Fi(o,c))}))}_initializeState(e){if(this._state.initialized)throw new Error("Provider already initialized.");if(e){const{accounts:n,chainId:r,isUnlocked:i,networkVersion:o}=e;this._handleConnect(r),this._handleChainChanged({chainId:r,networkVersion:o}),this._handleUnlockStateChanged({accounts:n,isUnlocked:i}),this._handleAccountsChanged(n)}this._state.initialized=!0,this.emit("_initialized")}_rpcRequest(e,n){let r=n;return Array.isArray(e)||(e.jsonrpc||(e.jsonrpc="2.0"),e.method!=="eth_accounts"&&e.method!=="eth_requestAccounts"||(r=(i,o)=>{this._handleAccountsChanged(o.result??[],e.method==="eth_accounts"),n(i,o)})),this._rpcEngine.handle(e,r)}_handleConnect(e){this._state.isConnected||(this._state.isConnected=!0,this.emit("connect",{chainId:e}),this._log.debug(Me.info.connected(e)))}_handleDisconnect(e,n){if(this._state.isConnected||!this._state.isPermanentlyDisconnected&&!e){let r;this._state.isConnected=!1,e?(r=new Vt(1013,n??Me.errors.disconnected()),this._log.debug(r)):(r=new Vt(1011,n??Me.errors.permanentlyDisconnected()),this._log.error(r),Wt(this,dn,null),this._state.accounts=null,Wt(this,Rn,null),this._state.isUnlocked=!1,this._state.isPermanentlyDisconnected=!0),this.emit("disconnect",r)}}_handleChainChanged({chainId:e}={}){Kh(e)?(this._handleConnect(e),e!==It(this,dn)&&(Wt(this,dn,e),this._state.initialized&&this.emit("chainChanged",It(this,dn)))):this._log.error(Me.errors.invalidNetworkParams(),{chainId:e})}_handleAccountsChanged(e,n=!1){let r=e;Array.isArray(e)||(this._log.error("MetaMask: Received invalid accounts parameter. Please report this bug.",e),r=[]);for(const i of e)if(typeof i!="string"){this._log.error("MetaMask: Received non-string account. Please report this bug.",e),r=[];break}if(!ig(this._state.accounts,r)&&(n&&this._state.accounts!==null&&this._log.error("MetaMask: 'eth_accounts' unexpectedly updated accounts. Please report this bug.",r),this._state.accounts=r,It(this,Rn)!==r[0]&&Wt(this,Rn,r[0]||null),this._state.initialized)){const i=[...r];this.emit("accountsChanged",i)}}_handleUnlockStateChanged({accounts:e,isUnlocked:n}={}){typeof n=="boolean"?n!==this._state.isUnlocked&&(this._state.isUnlocked=n,this._handleAccountsChanged(e??[])):this._log.error("MetaMask: Received invalid isUnlocked parameter. Please report this bug.")}};dn=new WeakMap,Rn=new WeakMap,Hh._defaultState={accounts:null,isConnected:!1,isUnlocked:!1,initialized:!1,isPermanentlyDisconnected:!1};var Da,og=Hh,ia={exports:{}},qh=Na.EventEmitter,Ba=Yr(w0);Da=typeof Object.create=="function"?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t};var zh=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),n={},r=0;r<e.length;r++)n[e[r]]=Object.getOwnPropertyDescriptor(t,e[r]);return n},sg=/%[sdj%]/g;function Mo(t){if(!Hr(t)){for(var e=[],n=0;n<arguments.length;n++)e.push($t(arguments[n]));return e.join(" ")}n=1;for(var r=arguments,i=r.length,o=String(t).replace(sg,(function(s){if(s==="%%")return"%";if(n>=i)return s;switch(s){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch{return"[Circular]"}default:return s}})),c=r[n];n<i;c=r[++n])Xr(c)||!jn(c)?o+=" "+c:o+=" "+$t(c);return o}function $a(t,e){if(Nt(Xe.process))return function(){return $a(t,e).apply(this,arguments)};if(Ee.noDeprecation===!0)return t;var n=!1;return function(){if(!n){if(Ee.throwDeprecation)throw new Error(e);Ee.traceDeprecation?console.trace(e):console.error(e),n=!0}return t.apply(this,arguments)}}var ms,Si={};function Vh(t){return Nt(ms)&&(ms=Ee.env.NODE_DEBUG||""),t=t.toUpperCase(),!Si[t]&&(new RegExp("\\b"+t+"\\b","i").test(ms)?Si[t]=function(){var e=Mo.apply(null,arguments);console.error("%s %d: %s",t,0,e)}:Si[t]=function(){}),Si[t]}function $t(t,e){var n={seen:[],stylize:cg};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),Ro(e)?n.showHidden=e:e&&Ha(n,e),Nt(n.showHidden)&&(n.showHidden=!1),Nt(n.depth)&&(n.depth=2),Nt(n.colors)&&(n.colors=!1),Nt(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=ag),fo(n,t,n.depth)}function ag(t,e){var n=$t.styles[e];return n?"\x1B["+$t.colors[n][0]+"m"+t+"\x1B["+$t.colors[n][1]+"m":t}function cg(t,e){return t}function fo(t,e,n){if(t.customInspect&&e&&Pr(e.inspect)&&e.inspect!==$t&&(!e.constructor||e.constructor.prototype!==e)){var r=e.inspect(n,t);return Hr(r)||(r=fo(t,r,n)),r}var i=(function(h,f){if(Nt(f))return h.stylize("undefined","undefined");if(Hr(f)){var m="'"+JSON.stringify(f).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return h.stylize(m,"string")}if(ja(f))return h.stylize(""+f,"number");if(Ro(f))return h.stylize(""+f,"boolean");if(Xr(f))return h.stylize("null","null")})(t,e);if(i)return i;var o=Object.keys(e),c=(function(h){var f={};return h.forEach((function(m,g){f[m]=!0})),f})(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),Or(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return gs(e);if(o.length===0){if(Pr(e)){var s=e.name?": "+e.name:"";return t.stylize("[Function"+s+"]","special")}if(Rr(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(po(e))return t.stylize(Date.prototype.toString.call(e),"date");if(Or(e))return gs(e)}var a,l="",u=!1,d=["{","}"];return Ka(e)&&(u=!0,d=["[","]"]),Pr(e)&&(l=" [Function"+(e.name?": "+e.name:"")+"]"),Rr(e)&&(l=" "+RegExp.prototype.toString.call(e)),po(e)&&(l=" "+Date.prototype.toUTCString.call(e)),Or(e)&&(l=" "+gs(e)),o.length!==0||u&&e.length!=0?n<0?Rr(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),a=u?(function(h,f,m,g,w){for(var p=[],C=0,_=f.length;C<_;++C)Xh(f,String(C))?p.push(ys(h,f,m,g,String(C),!0)):p.push("");return w.forEach((function(P){P.match(/^\d+$/)||p.push(ys(h,f,m,g,P,!0))})),p})(t,e,n,c,o):o.map((function(h){return ys(t,e,n,c,h,u)})),t.seen.pop(),(function(h,f,m){var g=h.reduce((function(w,p){return p.indexOf(`
|
|
25
|
+
`),w+p.replace(/\u001b\[\d\d?m/g,"").length+1}),0);return g>60?m[0]+(f===""?"":f+`
|
|
26
|
+
`)+" "+h.join(`,
|
|
27
|
+
`)+" "+m[1]:m[0]+f+" "+h.join(", ")+" "+m[1]})(a,l,d)):d[0]+l+d[1]}function gs(t){return"["+Error.prototype.toString.call(t)+"]"}function ys(t,e,n,r,i,o){var c,s,a;if((a=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?s=a.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):a.set&&(s=t.stylize("[Setter]","special")),Xh(r,i)||(c="["+i+"]"),s||(t.seen.indexOf(a.value)<0?(s=Xr(n)?fo(t,a.value,null):fo(t,a.value,n-1)).indexOf(`
|
|
28
|
+
`)>-1&&(s=o?s.split(`
|
|
29
|
+
`).map((function(l){return" "+l})).join(`
|
|
30
|
+
`).substr(2):`
|
|
31
|
+
`+s.split(`
|
|
32
|
+
`).map((function(l){return" "+l})).join(`
|
|
33
|
+
`)):s=t.stylize("[Circular]","special")),Nt(c)){if(o&&i.match(/^\d+$/))return s;(c=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(c=c.substr(1,c.length-2),c=t.stylize(c,"name")):(c=c.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),c=t.stylize(c,"string"))}return c+": "+s}function Ka(t){return Array.isArray(t)}function Ro(t){return typeof t=="boolean"}function Xr(t){return t===null}function Wh(t){return t==null}function ja(t){return typeof t=="number"}function Hr(t){return typeof t=="string"}function Gh(t){return typeof t=="symbol"}function Nt(t){return t===void 0}function Rr(t){return jn(t)&&Ua(t)==="[object RegExp]"}function jn(t){return typeof t=="object"&&t!==null}function po(t){return jn(t)&&Ua(t)==="[object Date]"}function Or(t){return jn(t)&&(Ua(t)==="[object Error]"||t instanceof Error)}function Pr(t){return typeof t=="function"}function Yh(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||typeof t=="symbol"||t===void 0}function Zh(t){return X.isBuffer(t)}function Ua(t){return Object.prototype.toString.call(t)}function vs(t){return t<10?"0"+t.toString(10):t.toString(10)}$t.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},$t.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var lg=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Jh(){var t,e;console.log("%s - %s",(t=new Date,e=[vs(t.getHours()),vs(t.getMinutes()),vs(t.getSeconds())].join(":"),[t.getDate(),lg[t.getMonth()],e].join(" ")),Mo.apply(null,arguments))}function Ha(t,e){if(!e||!jn(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t}function Xh(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var On=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;function Fa(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');if(On&&t[On]){var e;if(typeof(e=t[On])!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,On,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var n,r,i=new Promise((function(s,a){n=s,r=a})),o=[],c=0;c<arguments.length;c++)o.push(arguments[c]);o.push((function(s,a){s?r(s):n(a)}));try{t.apply(this,o)}catch(s){r(s)}return i}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),On&&Object.defineProperty(e,On,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,zh(t))}function ug(t,e){if(!t){var n=new Error("Promise was rejected with a falsy value");n.reason=t,t=n}return e(t)}function Qh(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');function e(){for(var n=[],r=0;r<arguments.length;r++)n.push(arguments[r]);var i=n.pop();if(typeof i!="function")throw new TypeError("The last argument must be of type Function");var o=this,c=function(){return i.apply(o,arguments)};t.apply(this,n).then((function(s){Ee.nextTick(c.bind(null,null,s))}),(function(s){Ee.nextTick(ug.bind(null,s,c))}))}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Object.defineProperties(e,zh(t)),e}Fa.custom=On;var bs,Dl,dg={inherits:Da,_extend:Ha,log:Jh,isBuffer:Zh,isPrimitive:Yh,isFunction:Pr,isError:Or,isDate:po,isObject:jn,isRegExp:Rr,isUndefined:Nt,isSymbol:Gh,isString:Hr,isNumber:ja,isNullOrUndefined:Wh,isNull:Xr,isBoolean:Ro,isArray:Ka,inspect:$t,deprecate:$a,format:Mo,debuglog:Vh,promisify:Fa,callbackify:Qh},ef=Yr(Object.freeze({__proto__:null,_extend:Ha,callbackify:Qh,debuglog:Vh,default:dg,deprecate:$a,format:Mo,inherits:Da,inspect:$t,isArray:Ka,isBoolean:Ro,isBuffer:Zh,isDate:po,isError:Or,isFunction:Pr,isNull:Xr,isNullOrUndefined:Wh,isNumber:ja,isObject:jn,isPrimitive:Yh,isRegExp:Rr,isString:Hr,isSymbol:Gh,isUndefined:Nt,log:Jh,promisify:Fa}));function hg(){if(Dl)return bs;function t(a,l){var u=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);l&&(d=d.filter((function(h){return Object.getOwnPropertyDescriptor(a,h).enumerable}))),u.push.apply(u,d)}return u}function e(a){for(var l=1;l<arguments.length;l++){var u=arguments[l]!=null?arguments[l]:{};l%2?t(Object(u),!0).forEach((function(d){n(a,d,u[d])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(u)):t(Object(u)).forEach((function(d){Object.defineProperty(a,d,Object.getOwnPropertyDescriptor(u,d))}))}return a}function n(a,l,u){return(l=i(l))in a?Object.defineProperty(a,l,{value:u,enumerable:!0,configurable:!0,writable:!0}):a[l]=u,a}function r(a,l,u){return l&&(function(d,h){for(var f=0;f<h.length;f++){var m=h[f];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(d,i(m.key),m)}})(a.prototype,l),Object.defineProperty(a,"prototype",{writable:!1}),a}function i(a){var l=(function(u,d){if(typeof u!="object"||u===null)return u;var h=u[Symbol.toPrimitive];if(h!==void 0){var f=h.call(u,d);if(typeof f!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(u)})(a,"string");return typeof l=="symbol"?l:String(l)}Dl=1;var o=Ba.Buffer,c=ef.inspect,s=c&&c.custom||"inspect";return bs=(function(){function a(){(function(l,u){if(!(l instanceof u))throw new TypeError("Cannot call a class as a function")})(this,a),this.head=null,this.tail=null,this.length=0}return r(a,[{key:"push",value:function(l){var u={data:l,next:null};this.length>0?this.tail.next=u:this.head=u,this.tail=u,++this.length}},{key:"unshift",value:function(l){var u={data:l,next:this.head};this.length===0&&(this.tail=u),this.head=u,++this.length}},{key:"shift",value:function(){if(this.length!==0){var l=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,l}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(l){if(this.length===0)return"";for(var u=this.head,d=""+u.data;u=u.next;)d+=l+u.data;return d}},{key:"concat",value:function(l){if(this.length===0)return o.alloc(0);for(var u,d,h,f=o.allocUnsafe(l>>>0),m=this.head,g=0;m;)u=m.data,d=f,h=g,o.prototype.copy.call(u,d,h),g+=m.data.length,m=m.next;return f}},{key:"consume",value:function(l,u){var d;return l<this.head.data.length?(d=this.head.data.slice(0,l),this.head.data=this.head.data.slice(l)):d=l===this.head.data.length?this.shift():u?this._getString(l):this._getBuffer(l),d}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(l){var u=this.head,d=1,h=u.data;for(l-=h.length;u=u.next;){var f=u.data,m=l>f.length?f.length:l;if(m===f.length?h+=f:h+=f.slice(0,l),(l-=m)===0){m===f.length?(++d,u.next?this.head=u.next:this.head=this.tail=null):(this.head=u,u.data=f.slice(m));break}++d}return this.length-=d,h}},{key:"_getBuffer",value:function(l){var u=o.allocUnsafe(l),d=this.head,h=1;for(d.data.copy(u),l-=d.data.length;d=d.next;){var f=d.data,m=l>f.length?f.length:l;if(f.copy(u,u.length-l,0,m),(l-=m)===0){m===f.length?(++h,d.next?this.head=d.next:this.head=this.tail=null):(this.head=d,d.data=f.slice(m));break}++h}return this.length-=h,u}},{key:s,value:function(l,u){return c(this,e(e({},u),{},{depth:0,customInspect:!1}))}}]),a})(),bs}function Bl(t,e){oa(t,e),qi(t)}function qi(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function oa(t,e){t.emit("error",e)}var tf={destroy:function(t,e){var n=this,r=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return r||i?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,Ee.nextTick(oa,this,t)):Ee.nextTick(oa,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(o){!e&&o?n._writableState?n._writableState.errorEmitted?Ee.nextTick(qi,n):(n._writableState.errorEmitted=!0,Ee.nextTick(Bl,n,o)):Ee.nextTick(Bl,n,o):e?(Ee.nextTick(qi,n),e(o)):Ee.nextTick(qi,n)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var n=t._readableState,r=t._writableState;n&&n.autoDestroy||r&&r.autoDestroy?t.destroy(e):t.emit("error",e)}},Un={},nf={};function dt(t,e,n){n||(n=Error);var r=(function(i){var o,c;function s(a,l,u){return i.call(this,(function(d,h,f){return typeof e=="string"?e:e(d,h,f)})(a,l,u))||this}return c=i,(o=s).prototype=Object.create(c.prototype),o.prototype.constructor=o,o.__proto__=c,s})(n);r.prototype.name=n.name,r.prototype.code=t,nf[t]=r}function $l(t,e){if(Array.isArray(t)){var n=t.length;return t=t.map((function(r){return String(r)})),n>2?"one of ".concat(e," ").concat(t.slice(0,n-1).join(", "),", or ")+t[n-1]:n===2?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}dt("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),dt("ERR_INVALID_ARG_TYPE",(function(t,e,n){var r,i,o;if(typeof e=="string"&&(i="not ",e.substr(0,i.length)===i)?(r="must not be",e=e.replace(/^not /,"")):r="must be",(function(s,a,l){return(l===void 0||l>s.length)&&(l=s.length),s.substring(l-a.length,l)===a})(t," argument"))o="The ".concat(t," ").concat(r," ").concat($l(e,"type"));else{var c=(function(s,a,l){return typeof l!="number"&&(l=0),!(l+a.length>s.length)&&s.indexOf(a,l)!==-1})(t,".")?"property":"argument";o='The "'.concat(t,'" ').concat(c," ").concat(r," ").concat($l(e,"type"))}return o+=". Received type ".concat(typeof n)}),TypeError),dt("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),dt("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),dt("ERR_STREAM_PREMATURE_CLOSE","Premature close"),dt("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),dt("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),dt("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),dt("ERR_STREAM_WRITE_AFTER_END","write after end"),dt("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),dt("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),dt("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Un.codes=nf;var fg=Un.codes.ERR_INVALID_OPT_VALUE,ws,Kl,Es,jl,rf={getHighWaterMark:function(t,e,n,r){var i=(function(o,c,s){return o.highWaterMark!=null?o.highWaterMark:c?o[s]:null})(e,r,n);if(i!=null){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new fg(r?n:"highWaterMark",i);return Math.floor(i)}return t.objectMode?16:16384}},pg=typeof Object.create=="function"?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t},Qr=Yr(Object.freeze({__proto__:null,default:pg})),mg=function(t,e){if(_s("noDeprecation"))return t;var n=!1;return function(){if(!n){if(_s("throwDeprecation"))throw new Error(e);_s("traceDeprecation")?console.trace(e):console.warn(e),n=!0}return t.apply(this,arguments)}};function _s(t){try{if(!bt.localStorage)return!1}catch{return!1}var e=bt.localStorage[t];return e!=null&&String(e).toLowerCase()==="true"}function of(){if(Kl)return ws;function t($){var O=this;this.next=null,this.entry=null,this.finish=function(){(function(M,S,I){var j=M.entry;for(M.entry=null;j;){var y=j.callback;S.pendingcb--,y(I),j=j.next}S.corkedRequestsFree.next=M})(O,$)}}var e;Kl=1,ws=L,L.WritableState=P;var n={deprecate:mg},r=qh,i=Ba.Buffer,o=(bt!==void 0?bt:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){},c,s=tf,a=rf.getHighWaterMark,l=Un.codes,u=l.ERR_INVALID_ARG_TYPE,d=l.ERR_METHOD_NOT_IMPLEMENTED,h=l.ERR_MULTIPLE_CALLBACK,f=l.ERR_STREAM_CANNOT_PIPE,m=l.ERR_STREAM_DESTROYED,g=l.ERR_STREAM_NULL_VALUES,w=l.ERR_STREAM_WRITE_AFTER_END,p=l.ERR_UNKNOWN_ENCODING,C=s.errorOrDestroy;function _(){}function P($,O,M){e=e||lr(),$=$||{},typeof M!="boolean"&&(M=O instanceof e),this.objectMode=!!$.objectMode,M&&(this.objectMode=this.objectMode||!!$.writableObjectMode),this.highWaterMark=a(this,$,"writableHighWaterMark",M),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var S=$.decodeStrings===!1;this.decodeStrings=!S,this.defaultEncoding=$.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(I){(function(j,y){var E=j._writableState,A=E.sync,T=E.writecb;if(typeof T!="function")throw new h;if((function(v){v.writing=!1,v.writecb=null,v.length-=v.writelen,v.writelen=0})(E),y)(function(v,k,x,R,B){--k.pendingcb,x?(Ee.nextTick(B,R),Ee.nextTick(H,v,k),v._writableState.errorEmitted=!0,C(v,R)):(B(R),v._writableState.errorEmitted=!0,C(v,R),H(v,k))})(j,E,A,y,T);else{var b=D(E)||j.destroyed;b||E.corked||E.bufferProcessing||!E.bufferedRequest||F(j,E),A?Ee.nextTick(q,j,E,b,T):q(j,E,b,T)}})(O,I)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=$.emitClose!==!1,this.autoDestroy=!!$.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}function L($){var O=this instanceof(e=e||lr());if(!O&&!c.call(L,this))return new L($);this._writableState=new P($,this,O),this.writable=!0,$&&(typeof $.write=="function"&&(this._write=$.write),typeof $.writev=="function"&&(this._writev=$.writev),typeof $.destroy=="function"&&(this._destroy=$.destroy),typeof $.final=="function"&&(this._final=$.final)),r.call(this)}function U($,O,M,S,I,j,y){O.writelen=S,O.writecb=y,O.writing=!0,O.sync=!0,O.destroyed?O.onwrite(new m("write")):M?$._writev(I,O.onwrite):$._write(I,j,O.onwrite),O.sync=!1}function q($,O,M,S){M||(function(I,j){j.length===0&&j.needDrain&&(j.needDrain=!1,I.emit("drain"))})($,O),O.pendingcb--,S(),H($,O)}function F($,O){O.bufferProcessing=!0;var M=O.bufferedRequest;if($._writev&&M&&M.next){var S=O.bufferedRequestCount,I=new Array(S),j=O.corkedRequestsFree;j.entry=M;for(var y=0,E=!0;M;)I[y]=M,M.isBuf||(E=!1),M=M.next,y+=1;I.allBuffers=E,U($,O,!0,O.length,I,"",j.finish),O.pendingcb++,O.lastBufferedRequest=null,j.next?(O.corkedRequestsFree=j.next,j.next=null):O.corkedRequestsFree=new t(O),O.bufferedRequestCount=0}else{for(;M;){var A=M.chunk,T=M.encoding,b=M.callback;if(U($,O,!1,O.objectMode?1:A.length,A,T,b),M=M.next,O.bufferedRequestCount--,O.writing)break}M===null&&(O.lastBufferedRequest=null)}O.bufferedRequest=M,O.bufferProcessing=!1}function D($){return $.ending&&$.length===0&&$.bufferedRequest===null&&!$.finished&&!$.writing}function N($,O){$._final((function(M){O.pendingcb--,M&&C($,M),O.prefinished=!0,$.emit("prefinish"),H($,O)}))}function H($,O){var M=D(O);if(M&&((function(I,j){j.prefinished||j.finalCalled||(typeof I._final!="function"||j.destroyed?(j.prefinished=!0,I.emit("prefinish")):(j.pendingcb++,j.finalCalled=!0,Ee.nextTick(N,I,j)))})($,O),O.pendingcb===0&&(O.finished=!0,$.emit("finish"),O.autoDestroy))){var S=$._readableState;(!S||S.autoDestroy&&S.endEmitted)&&$.destroy()}return M}return Qr(L,r),P.prototype.getBuffer=function(){for(var $=this.bufferedRequest,O=[];$;)O.push($),$=$.next;return O},(function(){try{Object.defineProperty(P.prototype,"buffer",{get:n.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})(),typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(c=Function.prototype[Symbol.hasInstance],Object.defineProperty(L,Symbol.hasInstance,{value:function($){return!!c.call(this,$)||this===L&&$&&$._writableState instanceof P}})):c=function($){return $ instanceof this},L.prototype.pipe=function(){C(this,new f)},L.prototype.write=function($,O,M){var S,I=this._writableState,j=!1,y=!I.objectMode&&(S=$,i.isBuffer(S)||S instanceof o);return y&&!i.isBuffer($)&&($=(function(E){return i.from(E)})($)),typeof O=="function"&&(M=O,O=null),y?O="buffer":O||(O=I.defaultEncoding),typeof M!="function"&&(M=_),I.ending?(function(E,A){var T=new w;C(E,T),Ee.nextTick(A,T)})(this,M):(y||(function(E,A,T,b){var v;return T===null?v=new g:typeof T=="string"||A.objectMode||(v=new u("chunk",["string","Buffer"],T)),!v||(C(E,v),Ee.nextTick(b,v),!1)})(this,I,$,M))&&(I.pendingcb++,j=(function(E,A,T,b,v,k){if(!T){var x=(function(z,V,Z){return z.objectMode||z.decodeStrings===!1||typeof V!="string"||(V=i.from(V,Z)),V})(A,b,v);b!==x&&(T=!0,v="buffer",b=x)}var R=A.objectMode?1:b.length;A.length+=R;var B=A.length<A.highWaterMark;if(B||(A.needDrain=!0),A.writing||A.corked){var K=A.lastBufferedRequest;A.lastBufferedRequest={chunk:b,encoding:v,isBuf:T,callback:k,next:null},K?K.next=A.lastBufferedRequest:A.bufferedRequest=A.lastBufferedRequest,A.bufferedRequestCount+=1}else U(E,A,!1,R,b,v,k);return B})(this,I,y,$,O,M)),j},L.prototype.cork=function(){this._writableState.corked++},L.prototype.uncork=function(){var $=this._writableState;$.corked&&($.corked--,$.writing||$.corked||$.bufferProcessing||!$.bufferedRequest||F(this,$))},L.prototype.setDefaultEncoding=function($){if(typeof $=="string"&&($=$.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf(($+"").toLowerCase())>-1))throw new p($);return this._writableState.defaultEncoding=$,this},Object.defineProperty(L.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(L.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),L.prototype._write=function($,O,M){M(new d("_write()"))},L.prototype._writev=null,L.prototype.end=function($,O,M){var S=this._writableState;return typeof $=="function"?(M=$,$=null,O=null):typeof O=="function"&&(M=O,O=null),$!=null&&this.write($,O),S.corked&&(S.corked=1,this.uncork()),S.ending||(function(I,j,y){j.ending=!0,H(I,j),y&&(j.finished?Ee.nextTick(y):I.once("finish",y)),j.ended=!0,I.writable=!1})(this,S,M),this},Object.defineProperty(L.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(L.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function($){this._writableState&&(this._writableState.destroyed=$)}}),L.prototype.destroy=s.destroy,L.prototype._undestroy=s.undestroy,L.prototype._destroy=function($,O){O($)},ws}function lr(){if(jl)return Es;jl=1;var t=Object.keys||function(l){var u=[];for(var d in l)u.push(d);return u};Es=c;var e=sf(),n=of();Qr(c,e);for(var r=t(n.prototype),i=0;i<r.length;i++){var o=r[i];c.prototype[o]||(c.prototype[o]=n.prototype[o])}function c(l){if(!(this instanceof c))return new c(l);e.call(this,l),n.call(this,l),this.allowHalfOpen=!0,l&&(l.readable===!1&&(this.readable=!1),l.writable===!1&&(this.writable=!1),l.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",s)))}function s(){this._writableState.ended||Ee.nextTick(a,this)}function a(l){l.end()}return Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(c.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(c.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._writableState!==void 0&&this._readableState.destroyed&&this._writableState.destroyed},set:function(l){this._readableState!==void 0&&this._writableState!==void 0&&(this._readableState.destroyed=l,this._writableState.destroyed=l)}}),Es}var gg=X.isEncoding||function(t){switch(t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function zi(t){switch(this.encoding=(t||"utf8").toLowerCase().replace(/[-_]/,""),(function(e){if(e&&!gg(e))throw new Error("Unknown encoding: "+e)})(t),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=vg;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=bg;break;default:return void(this.write=yg)}this.charBuffer=new X(6),this.charReceived=0,this.charLength=0}function yg(t){return t.toString(this.encoding)}function vg(t){this.charReceived=t.length%2,this.charLength=this.charReceived?2:0}function bg(t){this.charReceived=t.length%3,this.charLength=this.charReceived?3:0}zi.prototype.write=function(t){for(var e="";this.charLength;){var n=t.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:t.length;if(t.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived<this.charLength)return"";if(t=t.slice(n,t.length),!((i=(e=this.charBuffer.slice(0,this.charLength).toString(this.encoding)).charCodeAt(e.length-1))>=55296&&i<=56319)){if(this.charReceived=this.charLength=0,t.length===0)return e;break}this.charLength+=this.surrogateSize,e=""}this.detectIncompleteChar(t);var r=t.length;this.charLength&&(t.copy(this.charBuffer,0,t.length-this.charReceived,r),r-=this.charReceived);var i;if(r=(e+=t.toString(this.encoding,0,r)).length-1,(i=e.charCodeAt(r))>=55296&&i<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),t.copy(this.charBuffer,0,0,o),e.substring(0,r)}return e},zi.prototype.detectIncompleteChar=function(t){for(var e=t.length>=3?3:t.length;e>0;e--){var n=t[t.length-e];if(e==1&&n>>5==6){this.charLength=2;break}if(e<=2&&n>>4==14){this.charLength=3;break}if(e<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=e},zi.prototype.end=function(t){var e="";if(t&&t.length&&(e=this.write(t)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;e+=r.slice(0,n).toString(i)}return e};var Ul=Yr(Object.freeze({__proto__:null,StringDecoder:zi})),Hl=Un.codes.ERR_STREAM_PREMATURE_CLOSE;function wg(){}var Ss,Fl,ql,zl,Cs,Vl,qa=function t(e,n,r){if(typeof n=="function")return t(e,null,n);n||(n={}),r=(function(m){var g=!1;return function(){if(!g){g=!0;for(var w=arguments.length,p=new Array(w),C=0;C<w;C++)p[C]=arguments[C];m.apply(this,p)}}})(r||wg);var i=n.readable||n.readable!==!1&&e.readable,o=n.writable||n.writable!==!1&&e.writable,c=function(){e.writable||a()},s=e._writableState&&e._writableState.finished,a=function(){o=!1,s=!0,i||r.call(e)},l=e._readableState&&e._readableState.endEmitted,u=function(){i=!1,l=!0,o||r.call(e)},d=function(m){r.call(e,m)},h=function(){var m;return i&&!l?(e._readableState&&e._readableState.ended||(m=new Hl),r.call(e,m)):o&&!s?(e._writableState&&e._writableState.ended||(m=new Hl),r.call(e,m)):void 0},f=function(){e.req.on("finish",a)};return(function(m){return m.setHeader&&typeof m.abort=="function"})(e)?(e.on("complete",a),e.on("abort",h),e.req?f():e.on("request",f)):o&&!e._writableState&&(e.on("end",c),e.on("close",c)),e.on("end",u),e.on("finish",a),n.error!==!1&&e.on("error",d),e.on("close",h),function(){e.removeListener("complete",a),e.removeListener("abort",h),e.removeListener("request",f),e.req&&e.req.removeListener("finish",a),e.removeListener("end",c),e.removeListener("close",c),e.removeListener("finish",a),e.removeListener("end",u),e.removeListener("error",d),e.removeListener("close",h)}};function Eg(){if(Fl)return Ss;var t;function e(g,w,p){return(w=(function(C){var _=(function(P,L){if(typeof P!="object"||P===null)return P;var U=P[Symbol.toPrimitive];if(U!==void 0){var q=U.call(P,L);if(typeof q!="object")return q;throw new TypeError("@@toPrimitive must return a primitive value.")}return(L==="string"?String:Number)(P)})(C,"string");return typeof _=="symbol"?_:String(_)})(w))in g?Object.defineProperty(g,w,{value:p,enumerable:!0,configurable:!0,writable:!0}):g[w]=p,g}Fl=1;var n=qa,r=Symbol("lastResolve"),i=Symbol("lastReject"),o=Symbol("error"),c=Symbol("ended"),s=Symbol("lastPromise"),a=Symbol("handlePromise"),l=Symbol("stream");function u(g,w){return{value:g,done:w}}function d(g){var w=g[r];if(w!==null){var p=g[l].read();p!==null&&(g[s]=null,g[r]=null,g[i]=null,w(u(p,!1)))}}function h(g){Ee.nextTick(d,g)}var f=Object.getPrototypeOf((function(){})),m=Object.setPrototypeOf((e(t={get stream(){return this[l]},next:function(){var g=this,w=this[o];if(w!==null)return Promise.reject(w);if(this[c])return Promise.resolve(u(void 0,!0));if(this[l].destroyed)return new Promise((function(P,L){Ee.nextTick((function(){g[o]?L(g[o]):P(u(void 0,!0))}))}));var p,C=this[s];if(C)p=new Promise((function(P,L){return function(U,q){P.then((function(){L[c]?U(u(void 0,!0)):L[a](U,q)}),q)}})(C,this));else{var _=this[l].read();if(_!==null)return Promise.resolve(u(_,!1));p=new Promise(this[a])}return this[s]=p,p}},Symbol.asyncIterator,(function(){return this})),e(t,"return",(function(){var g=this;return new Promise((function(w,p){g[l].destroy(null,(function(C){C?p(C):w(u(void 0,!0))}))}))})),t),f);return Ss=function(g){var w,p=Object.create(m,(e(w={},l,{value:g,writable:!0}),e(w,r,{value:null,writable:!0}),e(w,i,{value:null,writable:!0}),e(w,o,{value:null,writable:!0}),e(w,c,{value:g._readableState.endEmitted,writable:!0}),e(w,a,{value:function(C,_){var P=p[l].read();P?(p[s]=null,p[r]=null,p[i]=null,C(u(P,!1))):(p[r]=C,p[i]=_)},writable:!0}),w));return p[s]=null,n(g,(function(C){if(C&&C.code!=="ERR_STREAM_PREMATURE_CLOSE"){var _=p[i];return _!==null&&(p[s]=null,p[r]=null,p[i]=null,_(C)),void(p[o]=C)}var P=p[r];P!==null&&(p[s]=null,p[r]=null,p[i]=null,P(u(void 0,!0))),p[c]=!0})),g.on("readable",h.bind(null,p)),p},Ss}function sf(){if(Vl)return Cs;var t;Vl=1,Cs=L,L.ReadableState=P,Na.EventEmitter;var e=function(b,v){return b.listeners(v).length},n=qh,r=Ba.Buffer,i=(bt!==void 0?bt:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){},o,c=ef;o=c&&c.debuglog?c.debuglog("stream"):function(){};var s,a,l,u=hg(),d=tf,h=rf.getHighWaterMark,f=Un.codes,m=f.ERR_INVALID_ARG_TYPE,g=f.ERR_STREAM_PUSH_AFTER_EOF,w=f.ERR_METHOD_NOT_IMPLEMENTED,p=f.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;Qr(L,n);var C=d.errorOrDestroy,_=["error","close","destroy","pause","resume"];function P(b,v,k){t=t||lr(),b=b||{},typeof k!="boolean"&&(k=v instanceof t),this.objectMode=!!b.objectMode,k&&(this.objectMode=this.objectMode||!!b.readableObjectMode),this.highWaterMark=h(this,b,"readableHighWaterMark",k),this.buffer=new u,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=b.emitClose!==!1,this.autoDestroy=!!b.autoDestroy,this.destroyed=!1,this.defaultEncoding=b.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,b.encoding&&(s||(s=Ul.StringDecoder),this.decoder=new s(b.encoding),this.encoding=b.encoding)}function L(b){if(t=t||lr(),!(this instanceof L))return new L(b);var v=this instanceof t;this._readableState=new P(b,this,v),this.readable=!0,b&&(typeof b.read=="function"&&(this._read=b.read),typeof b.destroy=="function"&&(this._destroy=b.destroy)),n.call(this)}function U(b,v,k,x,R){o("readableAddChunk",v);var B,K=b._readableState;if(v===null)K.reading=!1,(function(z,V){if(o("onEofChunk"),!V.ended){if(V.decoder){var Z=V.decoder.end();Z&&Z.length&&(V.buffer.push(Z),V.length+=V.objectMode?1:Z.length)}V.ended=!0,V.sync?N(z):(V.needReadable=!1,V.emittedReadable||(V.emittedReadable=!0,H(z)))}})(b,K);else if(R||(B=(function(z,V){var Z;Q=V,r.isBuffer(Q)||Q instanceof i||typeof V=="string"||V===void 0||z.objectMode||(Z=new m("chunk",["string","Buffer","Uint8Array"],V));var Q;return Z})(K,v)),B)C(b,B);else if(K.objectMode||v&&v.length>0)if(typeof v=="string"||K.objectMode||Object.getPrototypeOf(v)===r.prototype||(v=(function(z){return r.from(z)})(v)),x)K.endEmitted?C(b,new p):q(b,K,v,!0);else if(K.ended)C(b,new g);else{if(K.destroyed)return!1;K.reading=!1,K.decoder&&!k?(v=K.decoder.write(v),K.objectMode||v.length!==0?q(b,K,v,!1):$(b,K)):q(b,K,v,!1)}else x||(K.reading=!1,$(b,K));return!K.ended&&(K.length<K.highWaterMark||K.length===0)}function q(b,v,k,x){v.flowing&&v.length===0&&!v.sync?(v.awaitDrain=0,b.emit("data",k)):(v.length+=v.objectMode?1:k.length,x?v.buffer.unshift(k):v.buffer.push(k),v.needReadable&&N(b)),$(b,v)}Object.defineProperty(L.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._readableState.destroyed},set:function(b){this._readableState&&(this._readableState.destroyed=b)}}),L.prototype.destroy=d.destroy,L.prototype._undestroy=d.undestroy,L.prototype._destroy=function(b,v){v(b)},L.prototype.push=function(b,v){var k,x=this._readableState;return x.objectMode?k=!0:typeof b=="string"&&((v=v||x.defaultEncoding)!==x.encoding&&(b=r.from(b,v),v=""),k=!0),U(this,b,v,!1,k)},L.prototype.unshift=function(b){return U(this,b,null,!0,!1)},L.prototype.isPaused=function(){return this._readableState.flowing===!1},L.prototype.setEncoding=function(b){s||(s=Ul.StringDecoder);var v=new s(b);this._readableState.decoder=v,this._readableState.encoding=this._readableState.decoder.encoding;for(var k=this._readableState.buffer.head,x="";k!==null;)x+=v.write(k.data),k=k.next;return this._readableState.buffer.clear(),x!==""&&this._readableState.buffer.push(x),this._readableState.length=x.length,this};var F=1073741824;function D(b,v){return b<=0||v.length===0&&v.ended?0:v.objectMode?1:b!=b?v.flowing&&v.length?v.buffer.head.data.length:v.length:(b>v.highWaterMark&&(v.highWaterMark=(function(k){return k>=F?k=F:(k--,k|=k>>>1,k|=k>>>2,k|=k>>>4,k|=k>>>8,k|=k>>>16,k++),k})(b)),b<=v.length?b:v.ended?v.length:(v.needReadable=!0,0))}function N(b){var v=b._readableState;o("emitReadable",v.needReadable,v.emittedReadable),v.needReadable=!1,v.emittedReadable||(o("emitReadable",v.flowing),v.emittedReadable=!0,Ee.nextTick(H,b))}function H(b){var v=b._readableState;o("emitReadable_",v.destroyed,v.length,v.ended),v.destroyed||!v.length&&!v.ended||(b.emit("readable"),v.emittedReadable=!1),v.needReadable=!v.flowing&&!v.ended&&v.length<=v.highWaterMark,j(b)}function $(b,v){v.readingMore||(v.readingMore=!0,Ee.nextTick(O,b,v))}function O(b,v){for(;!v.reading&&!v.ended&&(v.length<v.highWaterMark||v.flowing&&v.length===0);){var k=v.length;if(o("maybeReadMore read 0"),b.read(0),k===v.length)break}v.readingMore=!1}function M(b){var v=b._readableState;v.readableListening=b.listenerCount("readable")>0,v.resumeScheduled&&!v.paused?v.flowing=!0:b.listenerCount("data")>0&&b.resume()}function S(b){o("readable nexttick read 0"),b.read(0)}function I(b,v){o("resume",v.reading),v.reading||b.read(0),v.resumeScheduled=!1,b.emit("resume"),j(b),v.flowing&&!v.reading&&b.read(0)}function j(b){var v=b._readableState;for(o("flow",v.flowing);v.flowing&&b.read()!==null;);}function y(b,v){return v.length===0?null:(v.objectMode?k=v.buffer.shift():!b||b>=v.length?(k=v.decoder?v.buffer.join(""):v.buffer.length===1?v.buffer.first():v.buffer.concat(v.length),v.buffer.clear()):k=v.buffer.consume(b,v.decoder),k);var k}function E(b){var v=b._readableState;o("endReadable",v.endEmitted),v.endEmitted||(v.ended=!0,Ee.nextTick(A,v,b))}function A(b,v){if(o("endReadableNT",b.endEmitted,b.length),!b.endEmitted&&b.length===0&&(b.endEmitted=!0,v.readable=!1,v.emit("end"),b.autoDestroy)){var k=v._writableState;(!k||k.autoDestroy&&k.finished)&&v.destroy()}}function T(b,v){for(var k=0,x=b.length;k<x;k++)if(b[k]===v)return k;return-1}return L.prototype.read=function(b){o("read",b),b=parseInt(b,10);var v=this._readableState,k=b;if(b!==0&&(v.emittedReadable=!1),b===0&&v.needReadable&&((v.highWaterMark!==0?v.length>=v.highWaterMark:v.length>0)||v.ended))return o("read: emitReadable",v.length,v.ended),v.length===0&&v.ended?E(this):N(this),null;if((b=D(b,v))===0&&v.ended)return v.length===0&&E(this),null;var x,R=v.needReadable;return o("need readable",R),(v.length===0||v.length-b<v.highWaterMark)&&o("length less than watermark",R=!0),v.ended||v.reading?o("reading or ended",R=!1):R&&(o("do read"),v.reading=!0,v.sync=!0,v.length===0&&(v.needReadable=!0),this._read(v.highWaterMark),v.sync=!1,v.reading||(b=D(k,v))),(x=b>0?y(b,v):null)===null?(v.needReadable=v.length<=v.highWaterMark,b=0):(v.length-=b,v.awaitDrain=0),v.length===0&&(v.ended||(v.needReadable=!0),k!==b&&v.ended&&E(this)),x!==null&&this.emit("data",x),x},L.prototype._read=function(b){C(this,new w("_read()"))},L.prototype.pipe=function(b,v){var k=this,x=this._readableState;switch(x.pipesCount){case 0:x.pipes=b;break;case 1:x.pipes=[x.pipes,b];break;default:x.pipes.push(b)}x.pipesCount+=1,o("pipe count=%d opts=%j",x.pipesCount,v);var R=(!v||v.end!==!1)&&b!==Ee.stdout&&b!==Ee.stderr?K:ue;function B(re,ie){o("onunpipe"),re===k&&ie&&ie.hasUnpiped===!1&&(ie.hasUnpiped=!0,o("cleanup"),b.removeListener("close",ne),b.removeListener("finish",oe),b.removeListener("drain",z),b.removeListener("error",Q),b.removeListener("unpipe",B),k.removeListener("end",K),k.removeListener("end",ue),k.removeListener("data",Z),V=!0,!x.awaitDrain||b._writableState&&!b._writableState.needDrain||z())}function K(){o("onend"),b.end()}x.endEmitted?Ee.nextTick(R):k.once("end",R),b.on("unpipe",B);var z=(function(re){return function(){var ie=re._readableState;o("pipeOnDrain",ie.awaitDrain),ie.awaitDrain&&ie.awaitDrain--,ie.awaitDrain===0&&e(re,"data")&&(ie.flowing=!0,j(re))}})(k);b.on("drain",z);var V=!1;function Z(re){o("ondata");var ie=b.write(re);o("dest.write",ie),ie===!1&&((x.pipesCount===1&&x.pipes===b||x.pipesCount>1&&T(x.pipes,b)!==-1)&&!V&&(o("false write response, pause",x.awaitDrain),x.awaitDrain++),k.pause())}function Q(re){o("onerror",re),ue(),b.removeListener("error",Q),e(b,"error")===0&&C(b,re)}function ne(){b.removeListener("finish",oe),ue()}function oe(){o("onfinish"),b.removeListener("close",ne),ue()}function ue(){o("unpipe"),k.unpipe(b)}return k.on("data",Z),(function(re,ie,le){if(typeof re.prependListener=="function")return re.prependListener(ie,le);re._events&&re._events[ie]?Array.isArray(re._events[ie])?re._events[ie].unshift(le):re._events[ie]=[le,re._events[ie]]:re.on(ie,le)})(b,"error",Q),b.once("close",ne),b.once("finish",oe),b.emit("pipe",k),x.flowing||(o("pipe resume"),k.resume()),b},L.prototype.unpipe=function(b){var v=this._readableState,k={hasUnpiped:!1};if(v.pipesCount===0)return this;if(v.pipesCount===1)return b&&b!==v.pipes||(b||(b=v.pipes),v.pipes=null,v.pipesCount=0,v.flowing=!1,b&&b.emit("unpipe",this,k)),this;if(!b){var x=v.pipes,R=v.pipesCount;v.pipes=null,v.pipesCount=0,v.flowing=!1;for(var B=0;B<R;B++)x[B].emit("unpipe",this,{hasUnpiped:!1});return this}var K=T(v.pipes,b);return K===-1||(v.pipes.splice(K,1),v.pipesCount-=1,v.pipesCount===1&&(v.pipes=v.pipes[0]),b.emit("unpipe",this,k)),this},L.prototype.on=function(b,v){var k=n.prototype.on.call(this,b,v),x=this._readableState;return b==="data"?(x.readableListening=this.listenerCount("readable")>0,x.flowing!==!1&&this.resume()):b==="readable"&&(x.endEmitted||x.readableListening||(x.readableListening=x.needReadable=!0,x.flowing=!1,x.emittedReadable=!1,o("on readable",x.length,x.reading),x.length?N(this):x.reading||Ee.nextTick(S,this))),k},L.prototype.addListener=L.prototype.on,L.prototype.removeListener=function(b,v){var k=n.prototype.removeListener.call(this,b,v);return b==="readable"&&Ee.nextTick(M,this),k},L.prototype.removeAllListeners=function(b){var v=n.prototype.removeAllListeners.apply(this,arguments);return b!=="readable"&&b!==void 0||Ee.nextTick(M,this),v},L.prototype.resume=function(){var b=this._readableState;return b.flowing||(o("resume"),b.flowing=!b.readableListening,(function(v,k){k.resumeScheduled||(k.resumeScheduled=!0,Ee.nextTick(I,v,k))})(this,b)),b.paused=!1,this},L.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},L.prototype.wrap=function(b){var v=this,k=this._readableState,x=!1;for(var R in b.on("end",(function(){if(o("wrapped end"),k.decoder&&!k.ended){var K=k.decoder.end();K&&K.length&&v.push(K)}v.push(null)})),b.on("data",(function(K){o("wrapped data"),k.decoder&&(K=k.decoder.write(K)),k.objectMode&&K==null||(k.objectMode||K&&K.length)&&(v.push(K)||(x=!0,b.pause()))})),b)this[R]===void 0&&typeof b[R]=="function"&&(this[R]=(function(K){return function(){return b[K].apply(b,arguments)}})(R));for(var B=0;B<_.length;B++)b.on(_[B],this.emit.bind(this,_[B]));return this._read=function(K){o("wrapped _read",K),x&&(x=!1,b.resume())},this},typeof Symbol=="function"&&(L.prototype[Symbol.asyncIterator]=function(){return a===void 0&&(a=Eg()),a(this)}),Object.defineProperty(L.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(L.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(L.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(b){this._readableState&&(this._readableState.flowing=b)}}),L._fromList=y,Object.defineProperty(L.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),typeof Symbol=="function"&&(L.from=function(b,v){return l===void 0&&(l=zl?ql:(zl=1,ql=function(){throw new Error("Readable.from is not available in the browser")})),l(L,b,v)}),Cs}var af=Gt,Oo=Un.codes,_g=Oo.ERR_METHOD_NOT_IMPLEMENTED,Sg=Oo.ERR_MULTIPLE_CALLBACK,Cg=Oo.ERR_TRANSFORM_ALREADY_TRANSFORMING,kg=Oo.ERR_TRANSFORM_WITH_LENGTH_0,Vi=lr();function Ag(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(r===null)return this.emit("error",new Sg);n.writechunk=null,n.writecb=null,e!=null&&this.push(e),r(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function Gt(t){if(!(this instanceof Gt))return new Gt(t);Vi.call(this,t),this._transformState={afterTransform:Ag.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",xg)}function xg(){var t=this;typeof this._flush!="function"||this._readableState.destroyed?Wl(this,null,null):this._flush((function(e,n){Wl(t,e,n)}))}function Wl(t,e,n){if(e)return t.emit("error",e);if(n!=null&&t.push(n),t._writableState.length)throw new kg;if(t._transformState.transforming)throw new Cg;return t.push(null)}Qr(Gt,Vi),Gt.prototype.push=function(t,e){return this._transformState.needTransform=!1,Vi.prototype.push.call(this,t,e)},Gt.prototype._transform=function(t,e,n){n(new _g("_transform()"))},Gt.prototype._write=function(t,e,n){var r=this._transformState;if(r.writecb=n,r.writechunk=t,r.writeencoding=e,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},Gt.prototype._read=function(t){var e=this._transformState;e.writechunk===null||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},Gt.prototype._destroy=function(t,e){Vi.prototype._destroy.call(this,t,(function(n){e(n)}))};var ks,Tg=Fr,cf=af;function Fr(t){if(!(this instanceof Fr))return new Fr(t);cf.call(this,t)}Qr(Fr,cf),Fr.prototype._transform=function(t,e,n){n(null,t)};var lf=Un.codes,Mg=lf.ERR_MISSING_ARGS,Rg=lf.ERR_STREAM_DESTROYED;function Gl(t){if(t)throw t}function Yl(t){t()}function Og(t,e){return t.pipe(e)}var Pg=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r,i=(function(c){return c.length?typeof c[c.length-1]!="function"?Gl:c.pop():Gl})(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new Mg("streams");var o=e.map((function(c,s){var a=s<e.length-1;return(function(l,u,d,h){h=(function(g){var w=!1;return function(){w||(w=!0,g.apply(void 0,arguments))}})(h);var f=!1;l.on("close",(function(){f=!0})),ks===void 0&&(ks=qa),ks(l,{readable:u,writable:d},(function(g){if(g)return h(g);f=!0,h()}));var m=!1;return function(g){if(!f&&!m)return m=!0,(function(w){return w.setHeader&&typeof w.abort=="function"})(l)?l.abort():typeof l.destroy=="function"?l.destroy():void h(g||new Rg("pipe"))}})(c,a,s>0,(function(l){r||(r=l),l&&o.forEach(Yl),a||(o.forEach(Yl),i(r))}))}));return e.reduce(Og)};(function(t,e){(e=ia.exports=sf()).Stream=e,e.Readable=e,e.Writable=of(),e.Duplex=lr(),e.Transform=af,e.PassThrough=Tg,e.finished=qa,e.pipeline=Pg})(0,ia.exports);var ur=ia.exports;function Ig(t={}){const e={},n=new ur.Duplex({objectMode:!0,read:()=>{},write:function(o,c,s){let a=null;try{o.id?(function(l){const{id:u}=l;if(u===null)return;const d=e[u];if(!d)return void console.warn(`StreamMiddleware - Unknown response id "${u}"`);delete e[u],Object.assign(d.res,l),setTimeout(d.end)})(o):(function(l){t!=null&&t.retryOnMessage&&l.method===t.retryOnMessage&&Object.values(e).forEach((({req:u,retryCount:d=0})=>{if(!u.id)return;if(d>=3)throw new Error(`StreamMiddleware - Retry limit exceeded for request id "${u.id}"`);const h=e[u.id];h&&(h.retryCount=d+1),i(u)})),r.emit("notification",l)})(o)}catch(l){a=l}s(a)}}),r=new Bh;return{events:r,middleware:(o,c,s,a)=>{e[o.id]={req:o,res:c,next:s,end:a},i(o)},stream:n};function i(o){n.push(o)}}var mo={},sa={exports:{}},Lg=function t(e,n){if(e&&n)return t(e)(n);if(typeof e!="function")throw new TypeError("need wrapper function");return Object.keys(e).forEach((function(i){r[i]=e[i]})),r;function r(){for(var i=new Array(arguments.length),o=0;o<i.length;o++)i[o]=arguments[o];var c=e.apply(this,i),s=i[i.length-1];return typeof c=="function"&&c!==s&&Object.keys(s).forEach((function(a){c[a]=s[a]})),c}},Zl=Lg;function Ci(t){var e=function(){return e.called?e.value:(e.called=!0,e.value=t.apply(this,arguments))};return e.called=!1,e}function Jl(t){var e=function(){if(e.called)throw new Error(e.onceError);return e.called=!0,e.value=t.apply(this,arguments)},n=t.name||"Function wrapped with `once`";return e.onceError=n+" shouldn't be called more than once",e.called=!1,e}sa.exports=Zl(Ci),sa.exports.strict=Zl(Jl),Ci.proto=Ci((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return Ci(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return Jl(this)},configurable:!0})}));var Ng=sa.exports,go={};Object.defineProperty(go,"__esModule",{value:!0}),go.Substream=void 0;const Dg=ur;class Bg extends Dg.Duplex{constructor({parent:e,name:n}){super({objectMode:!0}),this._parent=e,this._name=n}_read(){}_write(e,n,r){this._parent.push({name:this._name,data:e}),r()}}go.Substream=Bg;var $g=bt&&bt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(mo,"__esModule",{value:!0}),mo.ObjectMultiplex=void 0;const As=ur,Kg=$g(Ng),jg=go,Xl=Symbol("IGNORE_SUBSTREAM");let Ug=class extends As.Duplex{constructor(t={}){super(Object.assign(Object.assign({},t),{objectMode:!0})),this._substreams={}}createStream(t){if(this.destroyed)throw new Error(`ObjectMultiplex - parent stream for name "${t}" already destroyed`);if(this._readableState.ended||this._writableState.ended)throw new Error(`ObjectMultiplex - parent stream for name "${t}" already ended`);if(!t)throw new Error("ObjectMultiplex - name must not be empty");if(this._substreams[t])throw new Error(`ObjectMultiplex - Substream for name "${t}" already exists`);const e=new jg.Substream({parent:this,name:t});return this._substreams[t]=e,(function(n,r){const i=(0,Kg.default)(r);(0,As.finished)(n,{readable:!1},i),(0,As.finished)(n,{writable:!1},i)})(this,(n=>e.destroy(n||void 0))),e}ignoreStream(t){if(!t)throw new Error("ObjectMultiplex - name must not be empty");if(this._substreams[t])throw new Error(`ObjectMultiplex - Substream for name "${t}" already exists`);this._substreams[t]=Xl}_read(){}_write(t,e,n){const{name:r,data:i}=t;if(!r)return console.warn(`ObjectMultiplex - malformed chunk without name "${t}"`),n();const o=this._substreams[r];return o?(o!==Xl&&o.push(i),n()):(console.warn(`ObjectMultiplex - orphaned data for stream "${r}"`),n())}};mo.ObjectMultiplex=Ug;var Hg=Ao(mo.ObjectMultiplex);const Tt=t=>t!==null&&typeof t=="object"&&typeof t.pipe=="function";Tt.writable=t=>Tt(t)&&t.writable!==!1&&typeof t._write=="function"&&typeof t._writableState=="object",Tt.readable=t=>Tt(t)&&t.readable!==!1&&typeof t._read=="function"&&typeof t._readableState=="object",Tt.duplex=t=>Tt.writable(t)&&Tt.readable(t),Tt.transform=t=>Tt.duplex(t)&&typeof t._transform=="function";var Mt,Fg=Tt,qg=class extends og{constructor(t,{jsonRpcStreamName:e,logger:n=console,maxEventListeners:r=100,rpcMiddleware:i=[]}){if(super({logger:n,maxEventListeners:r,rpcMiddleware:i}),!Fg.duplex(t))throw new Error(Me.errors.invalidDuplexStream());this._handleStreamDisconnect=this._handleStreamDisconnect.bind(this);const o=new Hg;ur.pipeline(t,o,t,this._handleStreamDisconnect.bind(this,"MetaMask")),this._jsonRpcConnection=Ig({retryOnMessage:"METAMASK_EXTENSION_CONNECT_CAN_RETRY"}),ur.pipeline(this._jsonRpcConnection.stream,o.createStream(e),this._jsonRpcConnection.stream,this._handleStreamDisconnect.bind(this,"MetaMask RpcProvider")),this._rpcEngine.push(this._jsonRpcConnection.middleware),this._jsonRpcConnection.events.on("notification",(c=>{const{method:s,params:a}=c;s==="metamask_accountsChanged"?this._handleAccountsChanged(a):s==="metamask_unlockStateChanged"?this._handleUnlockStateChanged(a):s==="metamask_chainChanged"?this._handleChainChanged(a):$h.includes(s)?this.emit("message",{type:s,data:a}):s==="METAMASK_STREAM_FAILURE"&&t.destroy(new Error(Me.errors.permanentlyDisconnected()))}))}async _initializeStateAsync(){let t;try{t=await this.request({method:"metamask_getProviderState"})}catch(e){this._log.error("MetaMask: Failed to get initial state. Please report this bug.",e)}this._initializeState(t)}_handleStreamDisconnect(t,e){let n=`MetaMask: Lost connection to "${t}".`;e!=null&&e.stack&&(n+=`
|
|
34
|
+
${e.stack}`),this._log.warn(n),this.listenerCount("error")>0&&this.emit("error",n),this._handleDisconnect(!1,e?e.message:void 0)}_handleChainChanged({chainId:t,networkVersion:e}={}){Kh(t)&&(n=>!!n&&typeof n=="string")(e)?e==="loading"?this._handleDisconnect(!0):super._handleChainChanged({chainId:t}):this._log.error(Me.errors.invalidNetworkParams(),{chainId:t,networkVersion:e})}},zg=class extends qg{constructor(t,{jsonRpcStreamName:e="metamask-provider",logger:n=console,maxEventListeners:r=100,shouldSendMetadata:i}={}){if(super(t,{jsonRpcStreamName:e,logger:n,maxEventListeners:r,rpcMiddleware:Jm(n)}),this._sentWarnings={chainId:!1,networkVersion:!1,selectedAddress:!1,enable:!1,experimentalMethods:!1,send:!1,events:{close:!1,data:!1,networkChanged:!1,notification:!1}},ra(this,Mt,void 0),this._initializeStateAsync(),Wt(this,Mt,null),this.isMetaMask=!0,this._sendSync=this._sendSync.bind(this),this.enable=this.enable.bind(this),this.send=this.send.bind(this),this.sendAsync=this.sendAsync.bind(this),this._warnOfDeprecation=this._warnOfDeprecation.bind(this),this._metamask=this._getExperimentalApi(),this._jsonRpcConnection.events.on("notification",(o=>{const{method:c}=o;$h.includes(c)&&(this.emit("data",o),this.emit("notification",o.params.result))})),i)if(document.readyState==="complete")Ll(this._rpcEngine,this._log);else{const o=()=>{Ll(this._rpcEngine,this._log),window.removeEventListener("DOMContentLoaded",o)};window.addEventListener("DOMContentLoaded",o)}}get chainId(){return this._sentWarnings.chainId||(this._log.warn(Me.warnings.chainIdDeprecation),this._sentWarnings.chainId=!0),super.chainId}get networkVersion(){return this._sentWarnings.networkVersion||(this._log.warn(Me.warnings.networkVersionDeprecation),this._sentWarnings.networkVersion=!0),It(this,Mt)}get selectedAddress(){return this._sentWarnings.selectedAddress||(this._log.warn(Me.warnings.selectedAddressDeprecation),this._sentWarnings.selectedAddress=!0),super.selectedAddress}sendAsync(t,e){this._rpcRequest(t,e)}addListener(t,e){return this._warnOfDeprecation(t),super.addListener(t,e)}on(t,e){return this._warnOfDeprecation(t),super.on(t,e)}once(t,e){return this._warnOfDeprecation(t),super.once(t,e)}prependListener(t,e){return this._warnOfDeprecation(t),super.prependListener(t,e)}prependOnceListener(t,e){return this._warnOfDeprecation(t),super.prependOnceListener(t,e)}_handleDisconnect(t,e){super._handleDisconnect(t,e),It(this,Mt)&&!t&&Wt(this,Mt,null)}_warnOfDeprecation(t){var e;((e=this._sentWarnings)==null?void 0:e.events[t])===!1&&(this._log.warn(Me.warnings.events[t]),this._sentWarnings.events[t]=!0)}async enable(){return this._sentWarnings.enable||(this._log.warn(Me.warnings.enableDeprecation),this._sentWarnings.enable=!0),new Promise(((t,e)=>{try{this._rpcRequest({method:"eth_requestAccounts",params:[]},Fi(t,e))}catch(n){e(n)}}))}send(t,e){return this._sentWarnings.send||(this._log.warn(Me.warnings.sendDeprecation),this._sentWarnings.send=!0),typeof t!="string"||e&&!Array.isArray(e)?t&&typeof t=="object"&&typeof e=="function"?this._rpcRequest(t,e):this._sendSync(t):new Promise(((n,r)=>{try{this._rpcRequest({method:t,params:e},Fi(n,r,!1))}catch(i){r(i)}}))}_sendSync(t){let e;switch(t.method){case"eth_accounts":e=this.selectedAddress?[this.selectedAddress]:[];break;case"eth_coinbase":e=this.selectedAddress??null;break;case"eth_uninstallFilter":this._rpcRequest(t,jh),e=!0;break;case"net_version":e=It(this,Mt)??null;break;default:throw new Error(Me.errors.unsupportedSync(t.method))}return{id:t.id,jsonrpc:t.jsonrpc,result:e}}_getExperimentalApi(){return new Proxy({isUnlocked:async()=>(this._state.initialized||await new Promise((t=>{this.on("_initialized",(()=>t()))})),this._state.isUnlocked),requestBatch:async t=>{if(!Array.isArray(t))throw Tr({message:"Batch requests must be made with an array of request objects.",data:t});return new Promise(((e,n)=>{this._rpcRequest(t,Fi(e,n))}))}},{get:(t,e,...n)=>(this._sentWarnings.experimentalMethods||(this._log.warn(Me.warnings.experimentalMethods),this._sentWarnings.experimentalMethods=!0),Reflect.get(t,e,...n))})}_handleChainChanged({chainId:t,networkVersion:e}={}){super._handleChainChanged({chainId:t,networkVersion:e}),this._state.isConnected&&e!==It(this,Mt)&&(Wt(this,Mt,e),this._state.initialized&&this.emit("networkChanged",It(this,Mt)))}};Mt=new WeakMap;const G=Je("MM_SDK");let Ql;G.color="#FFAC1C";var uf={},Sn={};Object.defineProperty(Sn,"__esModule",{value:!0}),Sn.EthereumProviderError=Sn.EthereumRpcError=void 0;const Vg=Oh;class df extends Error{constructor(e,n,r){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!n||typeof n!="string")throw new Error('"message" must be a nonempty string.');super(n),this.code=e,r!==void 0&&(this.data=r)}serialize(){const e={code:this.code,message:this.message};return this.data!==void 0&&(e.data=this.data),this.stack&&(e.stack=this.stack),e}toString(){return Vg.default(this.serialize(),Wg,2)}}Sn.EthereumRpcError=df;function Wg(t,e){if(e!=="[Circular]")return e}Sn.EthereumProviderError=class extends df{constructor(t,e,n){if(!(function(r){return Number.isInteger(r)&&r>=1e3&&r<=4999})(t))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(t,e,n)}};var za={},gn={};Object.defineProperty(gn,"__esModule",{value:!0}),gn.errorValues=gn.errorCodes=void 0,gn.errorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901}},gn.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}},(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.serializeError=t.isValidCode=t.getMessageFromCode=t.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const e=gn,n=Sn,r=e.errorCodes.rpc.internal,i="Unspecified error message. This is a bug, please report it.",o={code:r,message:c(r)};function c(d,h=i){if(Number.isInteger(d)){const f=d.toString();if(u(e.errorValues,f))return e.errorValues[f].message;if(a(d))return t.JSON_RPC_SERVER_ERROR_MESSAGE}return h}function s(d){if(!Number.isInteger(d))return!1;const h=d.toString();return!!e.errorValues[h]||!!a(d)}function a(d){return d>=-32099&&d<=-32e3}function l(d){return d&&typeof d=="object"&&!Array.isArray(d)?Object.assign({},d):d}function u(d,h){return Object.prototype.hasOwnProperty.call(d,h)}t.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.",t.getMessageFromCode=c,t.isValidCode=s,t.serializeError=function(d,{fallbackError:h=o,shouldIncludeStack:f=!1}={}){var m,g;if(!h||!Number.isInteger(h.code)||typeof h.message!="string")throw new Error("Must provide fallback error with integer number code and string message.");if(d instanceof n.EthereumRpcError)return d.serialize();const w={};if(d&&typeof d=="object"&&!Array.isArray(d)&&u(d,"code")&&s(d.code)){const C=d;w.code=C.code,C.message&&typeof C.message=="string"?(w.message=C.message,u(C,"data")&&(w.data=C.data)):(w.message=c(w.code),w.data={originalError:l(d)})}else{w.code=h.code;const C=(m=d)===null||m===void 0?void 0:m.message;w.message=C&&typeof C=="string"?C:h.message,w.data={originalError:l(d)}}const p=(g=d)===null||g===void 0?void 0:g.stack;return f&&d&&p&&typeof p=="string"&&(w.stack=p),w}})(za);var yo={};Object.defineProperty(yo,"__esModule",{value:!0}),yo.ethErrors=void 0;const Va=Sn,hf=za,He=gn;function ht(t,e){const[n,r]=ff(e);return new Va.EthereumRpcError(t,n||hf.getMessageFromCode(t),r)}function wr(t,e){const[n,r]=ff(e);return new Va.EthereumProviderError(t,n||hf.getMessageFromCode(t),r)}function ff(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:n}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,n]}}return[]}yo.ethErrors={rpc:{parse:t=>ht(He.errorCodes.rpc.parse,t),invalidRequest:t=>ht(He.errorCodes.rpc.invalidRequest,t),invalidParams:t=>ht(He.errorCodes.rpc.invalidParams,t),methodNotFound:t=>ht(He.errorCodes.rpc.methodNotFound,t),internal:t=>ht(He.errorCodes.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return ht(e,t)},invalidInput:t=>ht(He.errorCodes.rpc.invalidInput,t),resourceNotFound:t=>ht(He.errorCodes.rpc.resourceNotFound,t),resourceUnavailable:t=>ht(He.errorCodes.rpc.resourceUnavailable,t),transactionRejected:t=>ht(He.errorCodes.rpc.transactionRejected,t),methodNotSupported:t=>ht(He.errorCodes.rpc.methodNotSupported,t),limitExceeded:t=>ht(He.errorCodes.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>wr(He.errorCodes.provider.userRejectedRequest,t),unauthorized:t=>wr(He.errorCodes.provider.unauthorized,t),unsupportedMethod:t=>wr(He.errorCodes.provider.unsupportedMethod,t),disconnected:t=>wr(He.errorCodes.provider.disconnected,t),chainDisconnected:t=>wr(He.errorCodes.provider.chainDisconnected,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:n,data:r}=t;if(!n||typeof n!="string")throw new Error('"message" must be a nonempty string');return new Va.EthereumProviderError(e,n,r)}}},(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getMessageFromCode=t.serializeError=t.EthereumProviderError=t.EthereumRpcError=t.ethErrors=t.errorCodes=void 0;const e=Sn;Object.defineProperty(t,"EthereumRpcError",{enumerable:!0,get:function(){return e.EthereumRpcError}}),Object.defineProperty(t,"EthereumProviderError",{enumerable:!0,get:function(){return e.EthereumProviderError}});const n=za;Object.defineProperty(t,"serializeError",{enumerable:!0,get:function(){return n.serializeError}}),Object.defineProperty(t,"getMessageFromCode",{enumerable:!0,get:function(){return n.getMessageFromCode}});const r=yo;Object.defineProperty(t,"ethErrors",{enumerable:!0,get:function(){return r.ethErrors}});const i=gn;Object.defineProperty(t,"errorCodes",{enumerable:!0,get:function(){return i.errorCodes}})})(uf);var pf={exports:{}};pf.exports=(function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(r,i,o){n.o(r,i)||Object.defineProperty(r,i,{enumerable:!0,get:o})},n.r=function(r){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},n.t=function(r,i){if(1&i&&(r=n(r)),8&i||4&i&&typeof r=="object"&&r&&r.__esModule)return r;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:r}),2&i&&typeof r!="string")for(var c in r)n.d(o,c,(function(s){return r[s]}).bind(null,c));return o},n.n=function(r){var i=r&&r.__esModule?function(){return r.default}:function(){return r};return n.d(i,"a",i),i},n.o=function(r,i){return Object.prototype.hasOwnProperty.call(r,i)},n.p="",n(n.s=90)})({17:function(t,e,n){e.__esModule=!0,e.default=void 0;var r=n(18),i=(function(){function o(){}return o.getFirstMatch=function(c,s){var a=s.match(c);return a&&a.length>0&&a[1]||""},o.getSecondMatch=function(c,s){var a=s.match(c);return a&&a.length>1&&a[2]||""},o.matchAndReturnConst=function(c,s,a){if(c.test(s))return a},o.getWindowsVersionName=function(c){switch(c){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},o.getMacOSVersionName=function(c){var s=c.split(".").splice(0,2).map((function(a){return parseInt(a,10)||0}));if(s.push(0),s[0]===10)switch(s[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},o.getAndroidVersionName=function(c){var s=c.split(".").splice(0,2).map((function(a){return parseInt(a,10)||0}));if(s.push(0),!(s[0]===1&&s[1]<5))return s[0]===1&&s[1]<6?"Cupcake":s[0]===1&&s[1]>=6?"Donut":s[0]===2&&s[1]<2?"Eclair":s[0]===2&&s[1]===2?"Froyo":s[0]===2&&s[1]>2?"Gingerbread":s[0]===3?"Honeycomb":s[0]===4&&s[1]<1?"Ice Cream Sandwich":s[0]===4&&s[1]<4?"Jelly Bean":s[0]===4&&s[1]>=4?"KitKat":s[0]===5?"Lollipop":s[0]===6?"Marshmallow":s[0]===7?"Nougat":s[0]===8?"Oreo":s[0]===9?"Pie":void 0},o.getVersionPrecision=function(c){return c.split(".").length},o.compareVersions=function(c,s,a){a===void 0&&(a=!1);var l=o.getVersionPrecision(c),u=o.getVersionPrecision(s),d=Math.max(l,u),h=0,f=o.map([c,s],(function(m){var g=d-o.getVersionPrecision(m),w=m+new Array(g+1).join(".0");return o.map(w.split("."),(function(p){return new Array(20-p.length).join("0")+p})).reverse()}));for(a&&(h=d-Math.min(l,u)),d-=1;d>=h;){if(f[0][d]>f[1][d])return 1;if(f[0][d]===f[1][d]){if(d===h)return 0;d-=1}else if(f[0][d]<f[1][d])return-1}},o.map=function(c,s){var a,l=[];if(Array.prototype.map)return Array.prototype.map.call(c,s);for(a=0;a<c.length;a+=1)l.push(s(c[a]));return l},o.find=function(c,s){var a,l;if(Array.prototype.find)return Array.prototype.find.call(c,s);for(a=0,l=c.length;a<l;a+=1){var u=c[a];if(s(u,a))return u}},o.assign=function(c){for(var s,a,l=c,u=arguments.length,d=new Array(u>1?u-1:0),h=1;h<u;h++)d[h-1]=arguments[h];if(Object.assign)return Object.assign.apply(Object,[c].concat(d));var f=function(){var m=d[s];typeof m=="object"&&m!==null&&Object.keys(m).forEach((function(g){l[g]=m[g]}))};for(s=0,a=d.length;s<a;s+=1)f();return c},o.getBrowserAlias=function(c){return r.BROWSER_ALIASES_MAP[c]},o.getBrowserTypeByAlias=function(c){return r.BROWSER_MAP[c]||""},o})();e.default=i,t.exports=e.default},18:function(t,e,n){e.__esModule=!0,e.ENGINE_MAP=e.OS_MAP=e.PLATFORMS_MAP=e.BROWSER_MAP=e.BROWSER_ALIASES_MAP=void 0,e.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},e.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},e.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},e.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},e.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(t,e,n){e.__esModule=!0,e.default=void 0;var r,i=(r=n(91))&&r.__esModule?r:{default:r},o=n(18);function c(a,l){for(var u=0;u<l.length;u++){var d=l[u];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}var s=(function(){function a(){}var l,u,d;return a.getParser=function(h,f){if(f===void 0&&(f=!1),typeof h!="string")throw new Error("UserAgent should be a string");return new i.default(h,f)},a.parse=function(h){return new i.default(h).getResult()},l=a,d=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}],(u=null)&&c(l.prototype,u),d&&c(l,d),a})();e.default=s,t.exports=e.default},91:function(t,e,n){e.__esModule=!0,e.default=void 0;var r=a(n(92)),i=a(n(93)),o=a(n(94)),c=a(n(95)),s=a(n(17));function a(u){return u&&u.__esModule?u:{default:u}}var l=(function(){function u(h,f){if(f===void 0&&(f=!1),h==null||h==="")throw new Error("UserAgent parameter can't be empty");this._ua=h,this.parsedResult={},f!==!0&&this.parse()}var d=u.prototype;return d.getUA=function(){return this._ua},d.test=function(h){return h.test(this._ua)},d.parseBrowser=function(){var h=this;this.parsedResult.browser={};var f=s.default.find(r.default,(function(m){if(typeof m.test=="function")return m.test(h);if(m.test instanceof Array)return m.test.some((function(g){return h.test(g)}));throw new Error("Browser's test function is not valid")}));return f&&(this.parsedResult.browser=f.describe(this.getUA())),this.parsedResult.browser},d.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},d.getBrowserName=function(h){return h?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},d.getBrowserVersion=function(){return this.getBrowser().version},d.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},d.parseOS=function(){var h=this;this.parsedResult.os={};var f=s.default.find(i.default,(function(m){if(typeof m.test=="function")return m.test(h);if(m.test instanceof Array)return m.test.some((function(g){return h.test(g)}));throw new Error("Browser's test function is not valid")}));return f&&(this.parsedResult.os=f.describe(this.getUA())),this.parsedResult.os},d.getOSName=function(h){var f=this.getOS().name;return h?String(f).toLowerCase()||"":f||""},d.getOSVersion=function(){return this.getOS().version},d.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},d.getPlatformType=function(h){h===void 0&&(h=!1);var f=this.getPlatform().type;return h?String(f).toLowerCase()||"":f||""},d.parsePlatform=function(){var h=this;this.parsedResult.platform={};var f=s.default.find(o.default,(function(m){if(typeof m.test=="function")return m.test(h);if(m.test instanceof Array)return m.test.some((function(g){return h.test(g)}));throw new Error("Browser's test function is not valid")}));return f&&(this.parsedResult.platform=f.describe(this.getUA())),this.parsedResult.platform},d.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},d.getEngineName=function(h){return h?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},d.parseEngine=function(){var h=this;this.parsedResult.engine={};var f=s.default.find(c.default,(function(m){if(typeof m.test=="function")return m.test(h);if(m.test instanceof Array)return m.test.some((function(g){return h.test(g)}));throw new Error("Browser's test function is not valid")}));return f&&(this.parsedResult.engine=f.describe(this.getUA())),this.parsedResult.engine},d.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},d.getResult=function(){return s.default.assign({},this.parsedResult)},d.satisfies=function(h){var f=this,m={},g=0,w={},p=0;if(Object.keys(h).forEach((function(D){var N=h[D];typeof N=="string"?(w[D]=N,p+=1):typeof N=="object"&&(m[D]=N,g+=1)})),g>0){var C=Object.keys(m),_=s.default.find(C,(function(D){return f.isOS(D)}));if(_){var P=this.satisfies(m[_]);if(P!==void 0)return P}var L=s.default.find(C,(function(D){return f.isPlatform(D)}));if(L){var U=this.satisfies(m[L]);if(U!==void 0)return U}}if(p>0){var q=Object.keys(w),F=s.default.find(q,(function(D){return f.isBrowser(D,!0)}));if(F!==void 0)return this.compareVersion(w[F])}},d.isBrowser=function(h,f){f===void 0&&(f=!1);var m=this.getBrowserName().toLowerCase(),g=h.toLowerCase(),w=s.default.getBrowserTypeByAlias(g);return f&&w&&(g=w.toLowerCase()),g===m},d.compareVersion=function(h){var f=[0],m=h,g=!1,w=this.getBrowserVersion();if(typeof w=="string")return h[0]===">"||h[0]==="<"?(m=h.substr(1),h[1]==="="?(g=!0,m=h.substr(2)):f=[],h[0]===">"?f.push(1):f.push(-1)):h[0]==="="?m=h.substr(1):h[0]==="~"&&(g=!0,m=h.substr(1)),f.indexOf(s.default.compareVersions(w,m,g))>-1},d.isOS=function(h){return this.getOSName(!0)===String(h).toLowerCase()},d.isPlatform=function(h){return this.getPlatformType(!0)===String(h).toLowerCase()},d.isEngine=function(h){return this.getEngineName(!0)===String(h).toLowerCase()},d.is=function(h,f){return f===void 0&&(f=!1),this.isBrowser(h,f)||this.isOS(h)||this.isPlatform(h)},d.some=function(h){var f=this;return h===void 0&&(h=[]),h.some((function(m){return f.is(m)}))},u})();e.default=l,t.exports=e.default},92:function(t,e,n){e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=/version\/(\d+(\.?_?\d+)+)/i,c=[{test:[/googlebot/i],describe:function(s){var a={name:"Googlebot"},l=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/opera/i],describe:function(s){var a={name:"Opera"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/opr\/|opios/i],describe:function(s){var a={name:"Opera"},l=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/SamsungBrowser/i],describe:function(s){var a={name:"Samsung Internet for Android"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/Whale/i],describe:function(s){var a={name:"NAVER Whale Browser"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/MZBrowser/i],describe:function(s){var a={name:"MZ Browser"},l=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/focus/i],describe:function(s){var a={name:"Focus"},l=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/swing/i],describe:function(s){var a={name:"Swing"},l=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/coast/i],describe:function(s){var a={name:"Opera Coast"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(s){var a={name:"Opera Touch"},l=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/yabrowser/i],describe:function(s){var a={name:"Yandex Browser"},l=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/ucbrowser/i],describe:function(s){var a={name:"UC Browser"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/Maxthon|mxios/i],describe:function(s){var a={name:"Maxthon"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/epiphany/i],describe:function(s){var a={name:"Epiphany"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/puffin/i],describe:function(s){var a={name:"Puffin"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/sleipnir/i],describe:function(s){var a={name:"Sleipnir"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/k-meleon/i],describe:function(s){var a={name:"K-Meleon"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/micromessenger/i],describe:function(s){var a={name:"WeChat"},l=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/qqbrowser/i],describe:function(s){var a={name:/qqbrowserlite/i.test(s)?"QQ Browser Lite":"QQ Browser"},l=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/msie|trident/i],describe:function(s){var a={name:"Internet Explorer"},l=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/\sedg\//i],describe:function(s){var a={name:"Microsoft Edge"},l=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/edg([ea]|ios)/i],describe:function(s){var a={name:"Microsoft Edge"},l=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/vivaldi/i],describe:function(s){var a={name:"Vivaldi"},l=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/seamonkey/i],describe:function(s){var a={name:"SeaMonkey"},l=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/sailfish/i],describe:function(s){var a={name:"Sailfish"},l=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,s);return l&&(a.version=l),a}},{test:[/silk/i],describe:function(s){var a={name:"Amazon Silk"},l=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/phantom/i],describe:function(s){var a={name:"PhantomJS"},l=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/slimerjs/i],describe:function(s){var a={name:"SlimerJS"},l=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(s){var a={name:"BlackBerry"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/(web|hpw)[o0]s/i],describe:function(s){var a={name:"WebOS Browser"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/bada/i],describe:function(s){var a={name:"Bada"},l=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/tizen/i],describe:function(s){var a={name:"Tizen"},l=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/qupzilla/i],describe:function(s){var a={name:"QupZilla"},l=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/firefox|iceweasel|fxios/i],describe:function(s){var a={name:"Firefox"},l=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/electron/i],describe:function(s){var a={name:"Electron"},l=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/MiuiBrowser/i],describe:function(s){var a={name:"Miui"},l=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/chromium/i],describe:function(s){var a={name:"Chromium"},l=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/chrome|crios|crmo/i],describe:function(s){var a={name:"Chrome"},l=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/GSA/i],describe:function(s){var a={name:"Google Search"},l=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:function(s){var a=!s.test(/like android/i),l=s.test(/android/i);return a&&l},describe:function(s){var a={name:"Android Browser"},l=i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/playstation 4/i],describe:function(s){var a={name:"PlayStation 4"},l=i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/safari|applewebkit/i],describe:function(s){var a={name:"Safari"},l=i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/.*/i],describe:function(s){var a=s.search("\\(")!==-1?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(a,s),version:i.default.getSecondMatch(a,s)}}}];e.default=c,t.exports=e.default},93:function(t,e,n){e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),c=[{test:[/Roku\/DVP/],describe:function(s){var a=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,s);return{name:o.OS_MAP.Roku,version:a}}},{test:[/windows phone/i],describe:function(s){var a=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,s);return{name:o.OS_MAP.WindowsPhone,version:a}}},{test:[/windows /i],describe:function(s){var a=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,s),l=i.default.getWindowsVersionName(a);return{name:o.OS_MAP.Windows,version:a,versionName:l}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(s){var a={name:o.OS_MAP.iOS},l=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,s);return l&&(a.version=l),a}},{test:[/macintosh/i],describe:function(s){var a=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,s).replace(/[_\s]/g,"."),l=i.default.getMacOSVersionName(a),u={name:o.OS_MAP.MacOS,version:a};return l&&(u.versionName=l),u}},{test:[/(ipod|iphone|ipad)/i],describe:function(s){var a=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,s).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:a}}},{test:function(s){var a=!s.test(/like android/i),l=s.test(/android/i);return a&&l},describe:function(s){var a=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,s),l=i.default.getAndroidVersionName(a),u={name:o.OS_MAP.Android,version:a};return l&&(u.versionName=l),u}},{test:[/(web|hpw)[o0]s/i],describe:function(s){var a=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,s),l={name:o.OS_MAP.WebOS};return a&&a.length&&(l.version=a),l}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(s){var a=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,s)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,s)||i.default.getFirstMatch(/\bbb(\d+)/i,s);return{name:o.OS_MAP.BlackBerry,version:a}}},{test:[/bada/i],describe:function(s){var a=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,s);return{name:o.OS_MAP.Bada,version:a}}},{test:[/tizen/i],describe:function(s){var a=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,s);return{name:o.OS_MAP.Tizen,version:a}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(s){var a=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,s);return{name:o.OS_MAP.PlayStation4,version:a}}}];e.default=c,t.exports=e.default},94:function(t,e,n){e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),c=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(s){var a=i.default.getFirstMatch(/(can-l01)/i,s)&&"Nova",l={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return a&&(l.model=a),l}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(s){var a=s.test(/ipod|iphone/i),l=s.test(/like (ipod|iphone)/i);return a&&!l},describe:function(s){var a=i.default.getFirstMatch(/(ipod|iphone)/i,s);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:a}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getBrowserName(!0)==="blackberry"},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(s){return s.getBrowserName(!0)==="bada"},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getBrowserName()==="windows phone"},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(s){var a=Number(String(s.getOSVersion()).split(".")[0]);return s.getOSName(!0)==="android"&&a>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(s){return s.getOSName(!0)==="android"},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getOSName(!0)==="macos"},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(s){return s.getOSName(!0)==="windows"},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(s){return s.getOSName(!0)==="linux"},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(s){return s.getOSName(!0)==="playstation 4"},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(s){return s.getOSName(!0)==="roku"},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];e.default=c,t.exports=e.default},95:function(t,e,n){e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),c=[{test:function(s){return s.getBrowserName(!0)==="microsoft edge"},describe:function(s){if(/\sedg\//i.test(s))return{name:o.ENGINE_MAP.Blink};var a=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,s);return{name:o.ENGINE_MAP.EdgeHTML,version:a}}},{test:[/trident/i],describe:function(s){var a={name:o.ENGINE_MAP.Trident},l=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:function(s){return s.test(/presto/i)},describe:function(s){var a={name:o.ENGINE_MAP.Presto},l=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:function(s){var a=s.test(/gecko/i),l=s.test(/like gecko/i);return a&&!l},describe:function(s){var a={name:o.ENGINE_MAP.Gecko},l=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(s){var a={name:o.ENGINE_MAP.WebKit},l=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}}];e.default=c,t.exports=e.default}});var mf=Ao(pf.exports);const nt={Initialized:"initialized",DisplayURI:"display_uri",ProviderUpdate:"provider_update",ConnectWithResponse:"connectWithResponse",ConnectionStatus:"connection_status",ServiceStatus:"service_status"};class kt{constructor({shouldSetOnWindow:e,connectionStream:n,shouldSendMetadata:r=!1,shouldShimWeb3:i,sdkInstance:o}){const c=new Gg({connectionStream:n,shouldSendMetadata:r,shouldSetOnWindow:e,shouldShimWeb3:i,autoRequestAccounts:!1}),s=new Proxy(c,{deleteProperty:()=>!0});if(this.provider=s,this.sdkInstance=o,e&&typeof window<"u")try{a=c,window.ethereum=a,window.dispatchEvent(new Event("ethereum#initialized"))}catch(l){G("[Ethereum] Unable to set global provider - window.ethereum may be read-only",l)}var a;if(i&&typeof window<"u")try{(function(l,u=console){let d=!1,h=!1;if(!window.web3){const f="__isMetaMaskShim__";let m={currentProvider:l};Object.defineProperty(m,f,{value:!0,enumerable:!0,configurable:!1,writable:!1}),m=new Proxy(m,{get:(g,w,...p)=>(w!=="currentProvider"||d?w==="currentProvider"||w===f||h||(h=!0,u.error("MetaMask no longer injects web3. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3"),l.request({method:"metamask_logWeb3ShimUsage"}).catch((C=>{u.debug("MetaMask: Failed to log web3 shim usage.",C)}))):(d=!0,u.warn("You are accessing the MetaMask window.web3.currentProvider shim. This property is deprecated; use window.ethereum instead. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3")),Reflect.get(g,w,...p)),set:(...g)=>(u.warn("You are accessing the MetaMask window.web3 shim. This object is deprecated; use window.ethereum instead. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3"),Reflect.set(...g))}),Object.defineProperty(window,"web3",{value:m,enumerable:!1,configurable:!0,writable:!0})}})(this.provider)}catch(l){G("[Ethereum] Unable to shim web3 - window.web3 may be read-only",l)}this.provider.on("display_uri",(l=>{this.sdkInstance.emit(nt.DisplayURI,l)})),this.provider.on("_initialized",(()=>{const l={chainId:this.provider.getChainId(),isConnected:this.provider.isConnected(),isMetaMask:this.provider.isMetaMask,selectedAddress:this.provider.getSelectedAddress(),networkVersion:this.provider.getNetworkVersion()};this.sdkInstance.emit(nt.Initialized,l),G("[Ethereum: constructor()] provider initialized",l)}))}static init(e){var n;return G("[Ethereum: init()] Initializing Ethereum service"),this.instance=new kt(e),(n=this.instance)===null||n===void 0?void 0:n.provider}static destroy(){}static getInstance(){var e;if(!(!((e=this.instance)===null||e===void 0)&&e.provider))throw new Error("Ethereum instance not intiialized - call Ethereum.factory first.");return this.instance}static getProvider(){var e;if(!(!((e=this.instance)===null||e===void 0)&&e.provider))throw new Error("Ethereum instance not intiialized - call Ethereum.factory first.");return this.instance.provider}}class qr{constructor({useDeepLink:e,preferredOpenLink:n,debug:r=!1}){this.state={platformType:void 0,useDeeplink:!1,preferredOpenLink:void 0,debug:!1},this.state.platformType=this.getPlatformType(),this.state.useDeeplink=e,this.state.preferredOpenLink=n,this.state.debug=r}openDeeplink(e,n,r){return(function(i,o,c,s){const{state:a}=i;G(`[PlatfformManager: openDeeplink()] universalLink --> ${o}`),G(`[PlatfformManager: openDeeplink()] deepLink --> ${c}`);try{if(a.preferredOpenLink)return void a.preferredOpenLink(a.useDeeplink?c:o,s);if(G(`[PlatfformManager: openDeeplink()] open link now useDeepLink=${a.useDeeplink} link=${a.useDeeplink?c:o}`),a.useDeeplink)typeof window<"u"&&(window.location.href=c);else if(typeof document<"u"){const l=document.createElement("a");l.href=o,l.target="_self",l.rel="noreferrer noopener",l.click()}}catch(l){console.log("[PlatfformManager: openDeeplink()] can't open link",l)}})(this,e,n,r)}isReactNative(){var e;return this.isNotBrowser()&&typeof window<"u"&&(window==null?void 0:window.navigator)&&((e=window.navigator)===null||e===void 0?void 0:e.product)==="ReactNative"}isMetaMaskInstalled(){return(function(){const e=kt.getProvider()||(window==null?void 0:window.ethereum);return G(`[PlatfformManager: isMetaMaskInstalled()] isMetaMask=${e==null?void 0:e.isMetaMask} isConnected=${e==null?void 0:e.isConnected()}`),(e==null?void 0:e.isMetaMask)&&(e==null?void 0:e.isConnected())})()}isDesktopWeb(){return this.isBrowser()&&!this.isMobileWeb()}isMobile(){var e,n;const r=mf.parse(window.navigator.userAgent);return((e=r==null?void 0:r.platform)===null||e===void 0?void 0:e.type)==="mobile"||((n=r==null?void 0:r.platform)===null||n===void 0?void 0:n.type)==="tablet"}isSecure(){return this.isReactNative()||this.isMobileWeb()}isMetaMaskMobileWebView(){return typeof window<"u"&&!!window.ReactNativeWebView&&!!navigator.userAgent.endsWith("MetaMaskMobile")}isMobileWeb(){return this.state.platformType===Ve.MobileWeb}static isNotBrowser(){var e;return typeof window>"u"||!(window!=null&&window.navigator)||Xe!==void 0&&((e=Xe==null?void 0:Xe.navigator)===null||e===void 0?void 0:e.product)==="ReactNative"||(navigator==null?void 0:navigator.product)==="ReactNative"}isNotBrowser(){return qr.isNotBrowser()}static isBrowser(){return!this.isNotBrowser()}isBrowser(){return qr.isBrowser()}isNodeJS(){return this.isNotBrowser()&&!this.isReactNative()}isUseDeepLink(){return this.state.useDeeplink}getPlatformType(){return(function(e){const{state:n}=e;return n.platformType?n.platformType:e.isReactNative()?Ve.ReactNative:e.isNotBrowser()?Ve.NonBrowser:e.isMetaMaskMobileWebView()?Ve.MetaMaskMobileWebview:e.isMobile()?Ve.MobileWeb:Ve.DesktopWeb})(this)}}const gf=t=>J(void 0,void 0,void 0,(function*(){if(qr.isBrowser()){const{StorageManagerWeb:n}=yield Promise.resolve().then((function(){return _y}));return new n(t)}const e={persistChannelConfig:()=>J(void 0,void 0,void 0,(function*(){})),getPersistedChannelConfig:()=>J(void 0,void 0,void 0,(function*(){})),persistAccounts:()=>J(void 0,void 0,void 0,(function*(){})),getCachedAccounts:()=>J(void 0,void 0,void 0,(function*(){return[]})),persistChainId:()=>J(void 0,void 0,void 0,(function*(){})),getCachedChainId:()=>J(void 0,void 0,void 0,(function*(){})),terminate:()=>J(void 0,void 0,void 0,(function*(){}))};return Promise.resolve(e)}));class Gg extends zg{constructor({connectionStream:e,shouldSendMetadata:n,autoRequestAccounts:r=!1}){super(e,{logger:console,maxEventListeners:100,shouldSendMetadata:n}),this.state={accounts:null,autoRequestAccounts:!1,providerStateRequested:!1,chainId:"",networkVersion:""},G(`[SDKProvider: constructor()] autoRequestAccounts=${r}`),this.state.autoRequestAccounts=r}forceInitializeState(){return J(this,void 0,void 0,(function*(){return G(`[SDKProvider: forceInitializeState()] autoRequestAccounts=${this.state.autoRequestAccounts}`),this._initializeStateAsync()}))}_setConnected(){G("[SDKProvider: _setConnected()] Setting connected state"),this._state.isConnected=!0}getState(){return this._state}getSDKProviderState(){return this.state}getSelectedAddress(){var e;const{accounts:n}=this._state;return n&&n.length!==0?((e=n[0])===null||e===void 0?void 0:e.toLowerCase())||"":(G("[SDKProvider: getSelectedAddress] No accounts found"),null)}getChainId(){return this.state.chainId}getNetworkVersion(){return this.state.networkVersion}setSDKProviderState(e){this.state=Object.assign(Object.assign({},this.state),e)}handleAccountsChanged(e,n){return this._handleAccountsChanged(e,n)}handleDisconnect({terminate:e=!1}){(function({terminate:n=!1,instance:r}){const{state:i}=r;G(`[SDKProvider: handleDisconnect()] cleaning up provider state terminate=${n}`,r),n&&(r._state.accounts=null,r._state.isUnlocked=!1,r._state.isPermanentlyDisconnected=!0,r._state.initialized=!1),r._handleAccountsChanged([]),r._state.isConnected=!1,r.emit("disconnect",uf.ethErrors.provider.disconnected()),i.providerStateRequested=!1})({terminate:e,instance:this})}_initializeStateAsync(){return J(this,void 0,void 0,(function*(){return(function(e){var n,r;return J(this,void 0,void 0,(function*(){e.state===void 0&&(e.state={accounts:null,autoRequestAccounts:!1,providerStateRequested:!1,chainId:""});const{state:i}=e;let o;if(i.providerStateRequested)G("[SDKProvider: initializeStateAsync()] initialization already in progress");else{let c;i.providerStateRequested=!0;let s=null,a=!1,l=!1;const u=yield gf({enabled:!0});if(u){const d=yield u.getPersistedChannelConfig({});a=(n=d==null?void 0:d.relayPersistence)!==null&&n!==void 0&&n,c=yield u.getCachedChainId();const h=yield u.getCachedAccounts();h.length>0&&(s=h[0])}if(G(`[SDKProvider: initializeStateAsync()] relayPersistence=${a}`,{relayPersistence:a,cachedChainId:c,cachedSelectedAddress:s}),a)if(c&&s)o={accounts:[s],chainId:c,isUnlocked:!1},l=!0;else try{o=yield e.request({method:"metamask_getProviderState"})}catch(d){return e._log.error("MetaMask: Failed to get initial state. Please report this bug.",d),void(i.providerStateRequested=!1)}if(((r=o==null?void 0:o.accounts)===null||r===void 0?void 0:r.length)===0)if(e.getSelectedAddress())o.accounts=[e.getSelectedAddress()];else{G("[SDKProvider: initializeStateAsync()] Fetch accounts remotely.");const d=yield e.request({method:"eth_requestAccounts",params:[]});o.accounts=d}e._initializeState(o),i.providerStateRequested=!1,l&&(e._state.isConnected=!0,e.emit("connect",{chainId:o==null?void 0:o.chainId}))}}))})(this)}))}_initializeState(e){return G("[SDKProvider: _initializeState()]",e),(function(n,r,i){return G("[SDKProvider: initializeState()] set state._initialized to false"),n._state.initialized=!1,r(i)})(this,super._initializeState.bind(this),e)}_handleChainChanged({chainId:e,networkVersion:n}={}){this.state.chainId=e,this.state.networkVersion=n,(function({instance:r,chainId:i,networkVersion:o,superHandleChainChanged:c}){G(`[SDKProvider: handleChainChanged()] chainId=${i} networkVersion=${o}`);let s=o;o||(G("[SDKProvider: handleChainChanged()] forced network version to prevent provider error"),s="1"),i!==Ql&&(Re.analytics.track("sdk_used_chain",{caip_chain_id:`eip155:${parseInt(i??"0x1",16)}`}),Ql=i),r._state.isConnected=!0,r.emit("connect",{chainId:i}),c({chainId:i,networkVersion:s})})({instance:this,chainId:e,networkVersion:n,superHandleChainChanged:super._handleChainChanged.bind(this)})}}var zr,Hn={name:"@metamask/sdk",version:"0.33.1",description:"",homepage:"https://github.com/MetaMask/metamask-sdk#readme",bugs:{url:"https://github.com/MetaMask/metamask-sdk/issues"},repository:{type:"git",url:"https://github.com/MetaMask/metamask-sdk",directory:"packages/sdk"},main:"dist/node/cjs/metamask-sdk.js",module:"dist/browser/es/metamask-sdk.js",browser:"dist/browser/es/metamask-sdk.js",unpkg:"dist/browser/umd/metamask-sdk.js","react-native":"dist/react-native/es/metamask-sdk.js",types:"dist/types/src/index.d.ts",sideEffects:!1,files:["/dist"],scripts:{"build:types":"tsc --project tsconfig.build.json --emitDeclarationOnly --outDir dist/types",build:"yarn build:types && rollup -c --bundleConfigAsCjs","build:clean":"yarn clean && yarn build","build:post-tsc":"echo 'N/A'","build:pre-tsc":"echo 'N/A'",typecheck:"tsc --noEmit",clean:"rimraf ./dist",size:"node bundle-size && size-limit",lint:"yarn lint:eslint && yarn lint:misc --check","lint:changelog":"../../scripts/validate-changelog.sh @metamask/sdk","lint:eslint":"eslint . --cache --ext js,ts","lint:fix":"yarn lint:eslint --fix && yarn lint:misc --write","lint:misc":"prettier '**/*.json' '**/*.md' '!CHANGELOG.md' --ignore-path ../../.gitignore",prepack:"../../scripts/prepack.sh","publish:preview":"yarn npm publish --tag preview",reset:"yarn clean && rimraf ./node_modules/",test:'jest --testPathIgnorePatterns "/e2e/"',"test:coverage":'jest --coverage --testPathIgnorePatterns "/e2e/"',"test:e2e":'jest --testPathPattern "/e2e/"',"test:ci":'jest --coverage --passWithNoTests --setupFilesAfterEnv ./jest-preload.js --testPathIgnorePatterns "/e2e/"',"test:dev":'jest -c ./jest.config.ts --detectOpenHandles --testPathIgnorePatterns "/e2e/"',watch:"rollup -c -w",dev:'concurrently "tsc --watch" "rollup -c -w --bundleConfigAsCjs"',"build:dev":"yarn build:types && NODE_ENV=dev rollup -c --bundleConfigAsCjs"},dependencies:{"@babel/runtime":"^7.26.0","@metamask/onboarding":"^1.0.1","@metamask/providers":"16.1.0","@metamask/sdk-analytics":"workspace:*","@metamask/sdk-communication-layer":"workspace:*","@metamask/sdk-install-modal-web":"workspace:*","@paulmillr/qr":"^0.2.1",bowser:"^2.9.0","cross-fetch":"^4.0.0",debug:"4.3.4",eciesjs:"^0.4.11","eth-rpc-errors":"^4.0.3",eventemitter2:"^6.4.9","obj-multiplex":"^1.0.0",pump:"^3.0.0","readable-stream":"^3.6.2","socket.io-client":"^4.5.1",tslib:"^2.6.0",util:"^0.12.4",uuid:"^8.3.2"},devDependencies:{"@jest/globals":"^29.3.1","@lavamoat/allow-scripts":"^2.3.1","@metamask/auto-changelog":"3.1.0","@metamask/eslint-config":"^6.0.0","@metamask/eslint-config-nodejs":"^6.0.0","@metamask/eslint-config-typescript":"^6.0.0","@react-native-async-storage/async-storage":"^1.19.6","@rollup/plugin-alias":"^5.1.1","@rollup/plugin-commonjs":"^25.0.7","@rollup/plugin-json":"^6.0.0","@rollup/plugin-node-resolve":"^15.0.2","@rollup/plugin-replace":"^6.0.1","@rollup/plugin-terser":"^0.4.1","@size-limit/preset-big-lib":"^11.0.2","@types/dom-screen-wake-lock":"^1.0.2","@types/node":"^20.1.3","@types/pump":"^1.1.1","@types/qrcode-terminal":"^0.12.0","@types/uuid":"^10.0.0","@typescript-eslint/eslint-plugin":"^4.26.0","@typescript-eslint/parser":"^4.26.0","browserify-zlib":"^0.2.0",buffer:"^6.0.3",concurrently:"^9.1.2","crypto-browserify":"^3.12.0",eslint:"^7.30.0","eslint-config-prettier":"^8.3.0","eslint-plugin-import":"^2.23.4","eslint-plugin-jest":"^24.4.0","eslint-plugin-jsdoc":"^36.1.0","eslint-plugin-node":"^11.1.0","eslint-plugin-prettier":"^3.4.0","https-browserify":"^1.0.0",jest:"^29.3.1","jest-environment-jsdom":"^29.3.1",prettier:"^2.3.0",process:"^0.11.10",rimraf:"^4.4.0",rollup:"^4.26.0","rollup-plugin-analyzer":"^4.0.0","rollup-plugin-jscc":"^2.0.0","rollup-plugin-natives":"^0.7.5","rollup-plugin-node-builtins":"^2.1.2","rollup-plugin-polyfill-node":"^0.13.0","rollup-plugin-sizes":"^1.0.6","rollup-plugin-typescript2":"^0.31.2","rollup-plugin-visualizer":"^5.12.0","size-limit":"^11.0.2","stream-browserify":"^3.0.0","stream-http":"^3.2.0","ts-jest":"^29.0.3","ts-node":"^10.9.1",typescript:"^4.3.2",url:"^0.11.0",webpack:"^5.0.0"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},lavamoat:{allowScripts:{"eciesjs>secp256k1":!1,"socket.io-client>engine.io-client>ws>bufferutil":!1,"socket.io-client>engine.io-client>ws>utf-8-validate":!1,"@metamask/sdk-communication-layer>bufferutil":!1,"@metamask/sdk-communication-layer>eciesjs>secp256k1":!1,"@metamask/sdk-communication-layer>utf-8-validate":!1}}};(function(t){t.INPAGE="metamask-inpage",t.CONTENT_SCRIPT="metamask-contentscript",t.PROVIDER="metamask-provider"})(zr||(zr={}));const eu="direct",Vr="https://metamask.app.link/connect",Wr="metamask://connect",tu={NAME:"MetaMask",RDNS:["io.metamask","io.metamask.flask"]},Yg=/(?:^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}$)|(?:^0{8}-0{4}-0{4}-0{4}-0{12}$)/u,he={METAMASK_GETPROVIDERSTATE:"metamask_getProviderState",METAMASK_CONNECTSIGN:"metamask_connectSign",METAMASK_CONNECTWITH:"metamask_connectWith",METAMASK_OPEN:"metamask_open",METAMASK_BATCH:"metamask_batch",PERSONAL_SIGN:"personal_sign",WALLET_REQUESTPERMISSIONS:"wallet_requestPermissions",WALLET_REVOKEPERMISSIONS:"wallet_revokePermissions",WALLET_GETPERMISSIONS:"wallet_getPermissions",WALLET_WATCHASSET:"wallet_watchAsset",WALLET_ADDETHEREUMCHAIN:"wallet_addEthereumChain",WALLET_SWITCHETHETHEREUMCHAIN:"wallet_switchEthereumChain",ETH_REQUESTACCOUNTS:"eth_requestAccounts",ETH_ACCOUNTS:"eth_accounts",ETH_CHAINID:"eth_chainId",ETH_SENDTRANSACTION:"eth_sendTransaction",ETH_SIGNTYPEDDATA:"eth_signTypedData",ETH_SIGNTYPEDDATA_V3:"eth_signTypedData_v3",ETH_SIGNTYPEDDATA_V4:"eth_signTypedData_v4",ETH_SIGNTRANSACTION:"eth_signTransaction",ETH_SIGN:"eth_sign",PERSONAL_EC_RECOVER:"personal_ecRecover"},Gr={[he.ETH_REQUESTACCOUNTS]:!0,[he.ETH_SENDTRANSACTION]:!0,[he.ETH_SIGNTRANSACTION]:!0,[he.ETH_SIGN]:!0,[he.PERSONAL_SIGN]:!0,[he.ETH_ACCOUNTS]:!1,[he.ETH_CHAINID]:!1,[he.PERSONAL_SIGN]:!0,[he.ETH_SIGNTYPEDDATA]:!0,[he.ETH_SIGNTYPEDDATA_V3]:!0,[he.ETH_SIGNTYPEDDATA_V4]:!0,[he.WALLET_REQUESTPERMISSIONS]:!0,[he.WALLET_GETPERMISSIONS]:!0,[he.WALLET_WATCHASSET]:!0,[he.WALLET_ADDETHEREUMCHAIN]:!0,[he.WALLET_SWITCHETHETHEREUMCHAIN]:!0,[he.METAMASK_CONNECTSIGN]:!0,[he.METAMASK_CONNECTWITH]:!0,[he.PERSONAL_EC_RECOVER]:!0,[he.METAMASK_BATCH]:!0,[he.METAMASK_OPEN]:!0},Zg=Object.keys(Gr).filter((t=>Gr[t]===!0)).map((t=>t.toLowerCase())),yf=["eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sign"].map((t=>t.toLowerCase())),xs=".sdk-comm",vo="providerType",aa=".MMSDK_cached_address",ca=".MMSDK_cached_chainId",xt={CHAIN_CHANGED:"chainChanged",ACCOUNTS_CHANGED:"accountsChanged",DISCONNECT:"disconnect",CONNECT:"connect",CONNECTED:"connected"},Jg=1e6;var Kt;(function(t){t.TERMINATE="terminate",t.EXTENSION="extension",t.INITIALIZED="initialized"})(Kt||(Kt={}));const Xg=typeof window<"u"&&window.localStorage;function Qg({instance:t,msg:e}){return J(this,void 0,void 0,(function*(){if(t._initialized||(G("[MetaMaskSDK: connectAndSign()] provider not ready -- wait for init()"),yield t.init()),G(`[MetaMaskSDK: connectAndSign()] activeProvider=${t.activeProvider}`),!t.activeProvider)throw new Error("SDK state invalid -- undefined provider");const n=/^0x([0-9A-Fa-f]{2})*$/u.test(e)?e:(function(r){let i;if(X!==void 0)i=X.from(r,"utf8").toString("hex");else if(typeof TextEncoder<"u"){const o=new TextEncoder().encode(r);i=Array.from(o).map((c=>c.toString(16).padStart(2,"0"))).join("")}else{if(typeof Xe!="object"||!("Buffer"in Xe))throw new Error("Unable to convert string to hex: No available method.");i=Xe.Buffer.from(r,"utf8").toString("hex")}return`0x${i}`})(e);return t.activeProvider.request({method:he.METAMASK_CONNECTWITH,params:[{method:he.PERSONAL_SIGN,params:[n]}]})}))}function nu(t){var e,n;return J(this,void 0,void 0,(function*(){G("[MetaMaskSDK: connectWithExtensionProvider()] ",t),t.sdkProvider=t.activeProvider,t.activeProvider=window.extension,window.ethereum=window.extension;try{const r=yield(e=window.extension)===null||e===void 0?void 0:e.request({method:"eth_requestAccounts"});G(`[MetaMaskSDK: connectWithExtensionProvider()] accounts=${r}`)}catch(r){return void console.warn("[MetaMaskSDK: connectWithExtensionProvider()] can't request accounts error",r)}localStorage.setItem(vo,"extension"),t.extensionActive=!0,t.emit(nt.ProviderUpdate,Kt.EXTENSION),t.options.enableAnalytics&&((n=t.analytics)===null||n===void 0||n.send({event:Oe.SDK_USE_EXTENSION}))}))}function bo(t){let e;if(X!==void 0)e=X.from(t,"utf8").toString("base64");else if(typeof btoa=="function")e=btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/gu,((n,r)=>String.fromCharCode(parseInt(r,16)))));else{if(typeof Xe!="object"||!("Buffer"in Xe))throw new Error("Unable to base64 encode: No available method.");e=Xe.Buffer.from(t,"utf8").toString("base64")}return e}function ey(t,e,n,r){var i,o,c,s,a,l,u,d,h,f,m,g,w,p,C,_,P,L,U,q;return J(this,void 0,void 0,(function*(){const F=(i=t.state.remote)===null||i===void 0?void 0:i.isReady(),D=(o=t.state.remote)===null||o===void 0?void 0:o.isConnected(),N=(c=t.state.remote)===null||c===void 0?void 0:c.isPaused(),H=kt.getProvider(),$=(s=t.state.remote)===null||s===void 0?void 0:s.getChannelId(),O=(a=t.state.remote)===null||a===void 0?void 0:a.isAuthorized(),{deeplinkProtocol:M}=t.state,{method:S,data:I,triggeredInstaller:j}=(T=>{var b,v,k,x;let R;X.isBuffer(T)?(R=T.toJSON(),R._isBuffer=!0):R=T;const B=(b=R==null?void 0:R.data)===null||b===void 0?void 0:b.method;let K=!1;return typeof((v=R==null?void 0:R.data)===null||v===void 0?void 0:v.params)=="object"&&((x=(k=R==null?void 0:R.data)===null||k===void 0?void 0:k.params)===null||x===void 0?void 0:x.__triggeredInstaller)===!0&&(K=!0,R.data.params=R.data.params.wrappedParams),{method:B,data:R,triggeredInstaller:K}})(e);if(G(`[RCPMS: write()] method='${S}' isRemoteReady=${F} channelId=${$} isSocketConnected=${D} isRemotePaused=${N} providerConnected=${H.isConnected()}`,e),!$)return S!==he.METAMASK_GETPROVIDERSTATE&&G(`[RCPMS: write()] ${S} --> channelId is undefined`),r(new Error("disconnected"));G(`[RCPMS: write()] remote.isPaused()=${(l=t.state.remote)===null||l===void 0?void 0:l.isPaused()} authorized=${O} ready=${F} socketConnected=${D}`,e);const y=(u=t.state.platformManager)===null||u===void 0?void 0:u.isSecure(),E=(h=(d=t.state.platformManager)===null||d===void 0?void 0:d.isMobileWeb())!==null&&h!==void 0&&h,A=(m=(f=t.state.remote)===null||f===void 0?void 0:f.hasDeeplinkProtocol())!==null&&m!==void 0&&m&&E&&O;try{if(!j){const v=JSON.stringify(I==null?void 0:I.data);if(v.length>Jg)return r(new Error(`Message size ${v.length} exceeds maximum allowed size of 1000000 bytes`));(g=t.state.remote)===null||g===void 0||g.sendMessage(I==null?void 0:I.data).then((()=>{G(`[RCPMS: _write()] ${S} sent successfully`)})).catch((k=>{G("[RCPMS: _write()] error sending message",k)}))}if(!y)return G(`[RCPMS: _write()] unsecure platform for method ${S} -- return callback`),r();if(j)return G("[RCPMS: _write()] prevent deeplink -- installation completed separately."),r();const T=(C=(p=(w=t.state.remote)===null||w===void 0?void 0:w.getKeyInfo())===null||p===void 0?void 0:p.ecies.public)!==null&&C!==void 0?C:"";let b=encodeURI(`channelId=${$}&pubkey=${T}&comm=socket&t=d&v=2`);if(A){const v=JSON.stringify(I==null?void 0:I.data),k=(_=t.state.remote)===null||_===void 0?void 0:_.encrypt(v);if(!k)return G("[RCPMS: _write()] error encrypting message"),r(new Error("RemoteCommunicationPostMessageStream - disconnected"));b+=`&scheme=${M}&rpc=${bo(k)}`}if(!(!((P=t.state.platformManager)===null||P===void 0)&&P.isMetaMaskInstalled()))return G("[RCPMS: _write()] prevent deeplink until installation is completed."),r();Gr[S]?(G(`[RCPMS: _write()] redirect link for '${S}' socketConnected=${D} connect?${b}`),(L=t.state.platformManager)===null||L===void 0||L.openDeeplink(`${Vr}?${b}`,`${Wr}?${b}`,"_self")):!((U=t.state.remote)===null||U===void 0)&&U.isPaused()?(G(`[RCPMS: _write()] MM is PAUSED! deeplink with connect! targetMethod=${S}`),(q=t.state.platformManager)===null||q===void 0||q.openDeeplink(`${Vr}?redirect=true&${b}`,`${Wr}?redirect=true&${b}`,"_self")):G(`[RCPMS: _write()] method ${S} doesn't need redirect.`)}catch(T){return G("[RCPMS: _write()] error sending message",T),r(new Error("RemoteCommunicationPostMessageStream - disconnected"))}return r()}))}class ty extends ur.Duplex{constructor({name:e,remote:n,deeplinkProtocol:r,platformManager:i}){super({objectMode:!0}),this.state={_name:null,remote:null,deeplinkProtocol:!1,platformManager:null},this.state._name=e,this.state.remote=n,this.state.deeplinkProtocol=r,this.state.platformManager=i,this._onMessage=this._onMessage.bind(this),this.state.remote.on(te.MESSAGE,this._onMessage)}_write(e,n,r){return J(this,void 0,void 0,(function*(){return ey(this,e,0,r)}))}_read(){}_onMessage(e){return(function(n,r){try{if(G("[RCPMS: onMessage()] message",r),!r||typeof r!="object"||typeof(r==null?void 0:r.data)!="object")return;if(!(r!=null&&r.name))return void G("[RCPMS: onMessage()] ignore message without name",r);if((r==null?void 0:r.name)!==zr.PROVIDER)return void G(`[RCPMS: onMessage()] ignore message with wrong name message=${r}`);if(X.isBuffer(r)){const i=X.from(r);n.push(i)}else n.push(r)}catch(i){G(`[RCPMS: onMessage()] ignore message error err=${i}`)}})(this,e)}start(){}}let ru=1;const vf=t=>new Promise((e=>{setTimeout((()=>{e(!0)}),t)})),ny=({checkInstallationOnAllCalls:t=!1,communicationLayerPreference:e,injectProvider:n,shouldShimWeb3:r,platformManager:i,installer:o,sdk:c,remoteConnection:s,debug:a})=>J(void 0,void 0,void 0,(function*(){var l,u;const d=(({name:N,remoteConnection:H})=>{if(!H||!(H!=null&&H.getConnector()))throw new Error("Missing remote connection parameter");return new ty({name:N,remote:H==null?void 0:H.getConnector(),deeplinkProtocol:H==null?void 0:H.state.deeplinkProtocol,platformManager:H==null?void 0:H.getPlatformManager()})})({name:zr.INPAGE,target:zr.CONTENT_SCRIPT,remoteConnection:s}),h=i.getPlatformType(),f=c.options.dappMetadata,m=`Sdk/Javascript SdkVersion/${Hn.version} Platform/${h} dApp/${(l=f.url)!==null&&l!==void 0?l:f.name} dAppTitle/${f.name}`;let g=null,w=null;const p=(u=c.options.storage)===null||u===void 0?void 0:u.storageManager;if(p){try{const N=yield p.getCachedAccounts();N.length>0&&(g=N[0])}catch(N){console.error(`[initializeMobileProvider] failed to get cached addresses: ${N}`)}try{const N=yield p.getCachedChainId();N&&(w=N)}catch(N){console.error(`[initializeMobileProvider] failed to parse cached chainId: ${N}`)}}G(`[initializeMobileProvider] cachedAccountAddress: ${g}, cachedChainId: ${w}`);const C=!(!n||h===Ve.NonBrowser||h===Ve.ReactNative),_=kt.init({shouldSetOnWindow:C,connectionStream:d,shouldShimWeb3:r,sdkInstance:c});let P=!1;const L=N=>{P=N},U=()=>P,q=(N,H,$,O)=>J(void 0,void 0,void 0,(function*(){var M,S,I,j,y,E,A,T,b;const v=kt.getProvider();if(P){v.emit("display_uri",(s==null?void 0:s.state.qrcodeLink)||""),s==null||s.showActiveModal();let Q=U();for(;Q;){const ne=U(),oe=s==null?void 0:s.isAuthorized();Q=ne&&!oe,G(`[initializeMobileProvider: sendRequest()] waiting for initialization to complete - initializing: ${ne} authorized: ${oe}`),yield vf(1e3)}return G("[initializeMobileProvider: sendRequest()] initial method completed -- prevent installation and call provider"),$(...H)}const k=i.isMetaMaskInstalled(),x=s==null?void 0:s.isConnected();let R=null,B=null,K=null;if(R=(M=v.getSelectedAddress())!==null&&M!==void 0?M:g,K=v.getChainId()||w,R&&p&&R!==g&&p.persistAccounts([R]).catch((Q=>{console.error(`[initializeMobileProvider] failed to persist account: ${Q}`)})),K&&(w=K,p&&p.persistChainId(K).catch((Q=>{console.error(`[initializeMobileProvider] failed to persist chainId: ${Q}`)}))),G("[initializeMobileProvider: sendRequest()]",{selectedAddress:R,chainId:K}),O&&G(`[initializeMobileProvider: sendRequest()] method=${N} ongoing=${P} selectedAddress=${R} isInstalled=${k} checkInstallationOnAllCalls=${t} socketConnected=${x}`),R&&N.toLowerCase()===he.ETH_ACCOUNTS.toLowerCase())return[R];if(K&&N.toLowerCase()===he.ETH_CHAINID.toLowerCase())return K;const z=[he.ETH_REQUESTACCOUNTS,he.WALLET_REQUESTPERMISSIONS,he.METAMASK_CONNECTSIGN,he.METAMASK_CONNECTWITH],V=!Gr[N],Z=(S=c.options.readonlyRPCMap)===null||S===void 0?void 0:S[K];if(Z&&V)try{const Q=(I=H==null?void 0:H[0])===null||I===void 0?void 0:I.params,ne=yield(({rpcEndpoint:oe,method:ue,sdkInfo:re,params:ie})=>J(void 0,void 0,void 0,(function*(){const le=JSON.stringify({jsonrpc:"2.0",method:ue,params:ie,id:(ru+=1,ru)}),se={Accept:"application/json","Content-Type":"application/json"};let fe;oe.includes("infura")&&(se["Metamask-Sdk-Info"]=re);try{fe=yield Pu(oe,{method:"POST",headers:se,body:le})}catch(ve){throw ve instanceof Error?new Error(`Failed to fetch from RPC: ${ve.message}`):new Error(`Failed to fetch from RPC: ${ve}`)}if(!fe.ok)throw new Error(`Server responded with a status of ${fe.status}`);return(yield fe.json()).result})))({rpcEndpoint:Z,sdkInfo:m,method:N,params:Q||[]});return O&&G(`initializeProvider::ReadOnlyRPCResponse ${ne}`),ne}catch(Q){console.warn(`[initializeMobileProvider: sendRequest()] method=${N} readOnlyRPCRequest failed:`,Q)}if((!k||k&&!x)&&N!==he.METAMASK_GETPROVIDERSTATE){const Q=((j=H==null?void 0:H[0])===null||j===void 0?void 0:j.params)||[];if(z.indexOf(N)!==-1||t){L(!0);const ne=N===he.METAMASK_CONNECTWITH,oe=`${Date.now()}`;try{yield o.start({wait:!1,connectWith:ne?{method:N,id:oe,params:Q}:void 0}),yield new Promise(((ue,re)=>{s!=null&&s.isAuthorized()&&(G("[initializeMobileProvider: sendRequest()] already authorized"),ue(!0)),s==null||s.getConnector().once(te.AUTHORIZED,(()=>{ue(!0)})),c.once(te.PROVIDER_UPDATE,(ie=>{G(`[initializeMobileProvider: sendRequest()] PROVIDER_UPDATE --- remote provider request interupted type=${ie}`),ie===Kt.EXTENSION?re(te.PROVIDER_UPDATE):re(new Error("Connection Terminated"))}))}))}catch(ue){if(Kt.EXTENSION===ue){if(G(`[initializeMobileProvider: sendRequest()] extension provider detect: re-create ${N} on the active provider`),N.toLowerCase()===he.METAMASK_CONNECTSIGN.toLowerCase()){const re=yield(y=c.getProvider())===null||y===void 0?void 0:y.request({method:he.ETH_REQUESTACCOUNTS,params:[]});if(!re.length)throw new Error("SDK state invalid -- undefined accounts");const ie=yield(E=c.getProvider())===null||E===void 0?void 0:E.request({method:he.PERSONAL_SIGN,params:[Q[0],re[0]]});return c.emit(nt.ConnectWithResponse,ie),ie}if(N.toLowerCase()===he.METAMASK_CONNECTWITH.toLowerCase()){const[re]=Q,ie=yield(({method:le,sdk:se,params:fe})=>J(void 0,void 0,void 0,(function*(){var ve,ce,de,me;if(!se.isExtensionActive())throw new Error("SDK state invalid -- extension is not active");G("[MetaMaskProvider: extensionConnectWithOverwrite()] Overwriting request method",le,fe);const Ae=yield(ve=se.getProvider())===null||ve===void 0?void 0:ve.request({method:he.ETH_REQUESTACCOUNTS,params:[]});if(!Ae.length)throw new Error("SDK state invalid -- undefined accounts");if((le==null?void 0:le.toLowerCase())===he.PERSONAL_SIGN.toLowerCase()){const Ie={method:le,params:[fe[0],Ae[0]]};return yield(ce=se.getProvider())===null||ce===void 0?void 0:ce.request(Ie)}if((le==null?void 0:le.toLowerCase())===he.ETH_SENDTRANSACTION.toLowerCase()){const Ie={method:le,params:[Object.assign(Object.assign({},fe[0]),{from:Ae[0]})]};return yield(de=se.getProvider())===null||de===void 0?void 0:de.request(Ie)}return yf.includes(le.toLowerCase())?(console.warn(`MetaMaskSDK connectWith method=${le} -- not handled by the extension -- call separately`),Ae):yield(me=se.getProvider())===null||me===void 0?void 0:me.request({method:le,params:fe})})))({method:re.method,sdk:c,params:re.params});return c.emit(nt.ConnectWithResponse,ie),ie}return G(`[initializeMobileProvider: sendRequest()] sending '${N}' on active provider`,Q),yield(A=c.getProvider())===null||A===void 0?void 0:A.request({method:N,params:Q})}throw ue===te.REJECTED?(s==null||s.closeModal(),(T=c.getProvider())===null||T===void 0||T.handleDisconnect({terminate:!1}),Object.assign(new Error("User rejected connection"),{code:4001})):(G(`[initializeMobileProvider: sendRequest()] failed to start installer: ${ue}`),ue)}finally{L(!1)}if(N===he.ETH_REQUESTACCOUNTS)return B=yield new Promise((ue=>{const re=setInterval((()=>{const{accounts:ie}=v.getState();ie&&(clearInterval(re),ue(ie))}),100)})),G(`[initializeMobileProvider: sendRequest()] selectedAddress: ${R} --- SKIP rpc call`),B;if(N===he.METAMASK_CONNECTWITH)try{let ue=0;const re=5,ie=({resolve:ve,reject:ce})=>{ue+=1;const de=s==null?void 0:s.getConnector().getRPCMethodTracker(),me=de==null?void 0:de[oe];return G(`TRACKER: update method ${oe}`,me),me!=null&&me.result?(G("[initializeMobileProvider: sendRequest()] found result",me.result),c.emit(nt.ConnectWithResponse,me.result),void ve(me.result)):me!=null&&me.error?(G("[initializeMobileProvider: sendRequest()] found error",me.error),void ce(me.error)):ue>=re?(G("[initializeMobileProvider: sendRequest()] max message count reached without result"),void ce(new Error("Max message count reached without result"))):void G("[initializeMobileProvider: sendRequest()] not found yet, need to wait for next update")};let le,se;const fe=yield new Promise(((ve,ce)=>{const de=s==null?void 0:s.getConnector().getRPCMethodTracker();G(`TRACKER: method ${oe}`,de),de!=null&&de[oe].result?(G("[initializeMobileProvider: sendRequest()] found result",de==null?void 0:de[oe].result),ve(de==null?void 0:de[oe].result)):de!=null&&de[oe].error&&(G("[initializeMobileProvider: sendRequest()] found error",de==null?void 0:de[oe].error),ce(de==null?void 0:de[oe].error)),se=()=>ie({resolve:ve,reject:ce}),le=s==null?void 0:s.getConnector().on(te.RPC_UPDATE,se)}));return se&&(le==null||le.off(te.RPC_UPDATE,se)),G("TRACKER: result",fe),fe}catch(ue){throw G("[initializeMobileProvider: sendRequest()] error:",ue),ue}return H[0]&&typeof H[0]=="object"&&(H[0].params={__triggeredInstaller:!0,wrappedParams:H[0].params}),$(...H)}if(i.isSecure()&&Gr[N])return $(...H);if(c.isExtensionActive())return G(`[initializeMobileProvider: sendRequest()] EXTENSION active - redirect request '${N}' to it`,H,Q),yield(b=c.getProvider())===null||b===void 0?void 0:b.request({method:N,params:Q});throw G(`[initializeMobileProvider: sendRequest()] method=${N} --- skip --- not connected/installed`),new Error("MetaMask is not connected/installed, please call eth_requestAccounts to connect first.")}try{const Q=yield $(...H);if(G(`[initializeMobileProvider: sendRequest()] method=${N} rpcResponse`,Q),N===he.WALLET_REQUESTPERMISSIONS){const ne=Q.reduce(((oe,ue)=>{var re;if(ue.parentCapability==="eth_accounts"){const ie=(re=ue.caveats.find((le=>le.type==="restrictReturnedAccounts")))===null||re===void 0?void 0:re.value;ie&&oe.push(...ie)}return oe}),[]);G("[initializeMobileProvider: sendRequest()] accountsToPersist:",ne),ne.length>0&&(v.handleAccountsChanged(ne,!1),p==null||p.persistAccounts(ne))}return Q}catch(Q){throw console.error("[initializeMobileProvider: sendRequest()] error:",Q),Q}})),{request:F}=_;_.request=(...N)=>J(void 0,void 0,void 0,(function*(){return q(N==null?void 0:N[0].method,N,F,a)}));const{send:D}=_;return _.send=(...N)=>J(void 0,void 0,void 0,(function*(){return q(N==null?void 0:N[0],N,D,a)})),G("[initializeMobileProvider: sendRequest()] metamaskStream.start()"),d.start(),_}));function ry(t){var e,n,r,i;return J(this,void 0,void 0,(function*(){const{options:o}=t,c={communicationLayerPreference:(e=o.communicationLayerPreference)!==null&&e!==void 0?e:Bn.SOCKET,platformManager:t.platformManager,sdk:t,checkInstallationOnAllCalls:o.checkInstallationOnAllCalls,injectProvider:(n=o.injectProvider)===null||n===void 0||n,shouldShimWeb3:(r=o.shouldShimWeb3)===null||r===void 0||r,extensionOnly:(i=o.extensionOnly)===null||i===void 0||i,installer:t.installer,remoteConnection:t.remoteConnection,debug:t.debug},s=yield ny(c);t.activeProvider=s,(function(a){var l,u,d,h;(u=(l=a.remoteConnection)===null||l===void 0?void 0:l.getConnector())===null||u===void 0||u.on(nt.ConnectionStatus,(f=>{a.emit(nt.ConnectionStatus,f)})),(h=(d=a.remoteConnection)===null||d===void 0?void 0:d.getConnector())===null||h===void 0||h.on(nt.ServiceStatus,(f=>{a.emit(nt.ServiceStatus,f)}))})(t)}))}const iy="sdk";class oy{constructor({serverUrl:e,enabled:n,originatorInfo:r}){this.serverURL=ar,this.serverURL=e,this.originatorInfo=r,this.enabled=n==null||n}send({event:e,params:n}){if(!this.enabled)return;const r=Object.assign(Object.assign({id:iy,event:e,sdkVersion:Hn.version},this.originatorInfo),{params:n});G(`[Analytics: send()] event: ${e}`,r),en(r,this.serverURL).catch((i=>{G(`[Analytics: send()] error: ${i}`)}))}}const sy=()=>{if(typeof document>"u")return;let t;const e=document.getElementsByTagName("link");for(let n=0;n<e.length;n++)e[n].getAttribute("rel")!=="icon"&&e[n].getAttribute("rel")!=="shortcut icon"||(t=e[n].getAttribute("href"));return t},ay=163400;function iu(t){var e,n,r;const{dappMetadata:i}=t,o=(function({url:u,name:d}){var h;const f=u+d,m=bo(f);if(!localStorage)return"";let g=(h=localStorage.getItem(m))!==null&&h!==void 0?h:"";if(!g){g=yn();try{localStorage.setItem(m,g)}catch{return""}}return g})({url:(e=i==null?void 0:i.url)!==null&&e!==void 0?e:"no_url",name:(n=i==null?void 0:i.name)!==null&&n!==void 0?n:"no_name"}),c=(r=t.platformManager)===null||r===void 0?void 0:r.getPlatformType(),s=c===Ve.DesktopWeb,a=c===Ve.MetaMaskMobileWebview;let l="N/A";return s?l="extension":a&&(l="mobile"),{id:o,from:l}}const ki=(t,e,n)=>{if(Jr(t))if(n||e&&typeof e=="object"&&e!==null&&"error"in e){const r=n||(e==null?void 0:e.error);r&&r.code===4001?Re.analytics.track("sdk_action_rejected",{action:t}):Re.analytics.track("sdk_action_failed",{action:t})}else Re.analytics.track("sdk_action_succeeded",{action:t})},bf=({provider:t,sdkInstance:e})=>{if("state"in t)throw new Error("INVALID EXTENSION PROVIDER");return new Proxy(t,{get:(n,r)=>r==="request"?function(i){var o,c;return J(this,void 0,void 0,(function*(){G("[wrapExtensionProvider()] Overwriting request method",i);const{method:s,params:a}=i,l=Zg.includes(s.toLowerCase()),{id:u,from:d}=iu(e);if(l&&((o=e.analytics)===null||o===void 0||o.send({event:Oe.SDK_RPC_REQUEST,params:{method:s,from:d,id:u}})),Jr(s)&&Re.analytics.track("sdk_action_requested",{action:s}),s===he.METAMASK_BATCH&&Array.isArray(a))return(({target:m,args:g,trackEvent:w,sdkInstance:p})=>J(void 0,void 0,void 0,(function*(){var C,_;if(g.method!=="metamask_batch")throw new Error("Invalid usage");const P=[],L=(C=g==null?void 0:g.params)!==null&&C!==void 0?C:[];for(const F of L){const D=yield m==null?void 0:m.request({method:F.method,params:F.params});P.push(D)}const{id:U,from:q}=iu(p);w&&((_=p.analytics)===null||_===void 0||_.send({event:Oe.SDK_RPC_REQUEST_DONE,params:{method:g.method,from:q,id:U}}));for(const F of P)ki(g.method,F,null);return P})))({target:n,args:i,trackEvent:l,sdkInstance:e});if(s.toLowerCase()===he.METAMASK_CONNECTSIGN.toLowerCase()&&Array.isArray(a))return(({target:m,params:g})=>J(void 0,void 0,void 0,(function*(){let w,p=null;try{const C=yield m.request({method:he.ETH_REQUESTACCOUNTS,params:[]});if(!C.length)throw new Error("SDK state invalid -- undefined accounts");return w=yield m.request({method:he.PERSONAL_SIGN,params:[g[0],C[0]]}),w}catch(C){throw p=C,C}finally{ki(he.PERSONAL_SIGN,w,p)}})))({target:n,params:a});if(s.toLowerCase()===he.METAMASK_CONNECTWITH.toLowerCase()&&Array.isArray(a))return(({target:m,params:g})=>J(void 0,void 0,void 0,(function*(){const[w]=g,p=w.method,C=w.params;let _,P=null;try{const L=yield m.request({method:he.ETH_REQUESTACCOUNTS,params:[]});if(!Array.isArray(L)||!L.length)throw new Error("SDK state invalid -- undefined accounts");return(p==null?void 0:p.toLowerCase())===he.PERSONAL_SIGN.toLowerCase()?(_=yield m.request({method:p,params:[C[0],L[0]]}),_):(p==null?void 0:p.toLowerCase())===he.ETH_SENDTRANSACTION.toLowerCase()?(_=yield m.request({method:p,params:[Object.assign(Object.assign({},C[0]),{from:L[0]})]}),_):yf.includes(p.toLowerCase())?(console.warn(`MetaMaskSDK connectWith method=${p} -- not handled by the extension -- call separately`),_=L,_):(_=yield m.request({method:p,params:C}),_)}catch(L){throw P=L,L}finally{ki(p,_,P)}})))({target:n,params:a});let h,f=null;try{return h=yield n.request(i),h}catch(m){throw f=m,m}finally{l&&((c=e.analytics)===null||c===void 0||c.send({event:Oe.SDK_RPC_REQUEST_DONE,params:{method:s,from:d,id:u}})),ki(s,h,f)}}))}:r==="getChainId"?function(){return t.chainId}:r==="getNetworkVersion"?function(){return t.networkVersion}:r==="getSelectedAddress"?function(){return t.selectedAddress}:r==="isConnected"?function(){return t._state.isConnected}:n[r]})};var wo;function cy({mustBeMetaMask:t,sdkInstance:e}){return J(this,void 0,void 0,(function*(){if(typeof window>"u")throw new Error("window not available");try{const n=yield new Promise(((r,i)=>{const o=setTimeout((()=>{i(new Error("eip6963RequestProvider timed out"))}),500);window.addEventListener(wo.Announce,(c=>{const s=c,{detail:{info:a,provider:l}={}}=s,{name:u,rdns:d,uuid:h}=a??{};Yg.test(h)&&u.startsWith(tu.NAME)&&tu.RDNS.includes(d)&&(clearTimeout(o),r(l))})),window.dispatchEvent(new Event(wo.Request))}));return bf({provider:n,sdkInstance:e})}catch{throw new Error("Provider not found")}}))}(function(t){t.Announce="eip6963:announceProvider",t.Request="eip6963:requestProvider"})(wo||(wo={}));const ly=t=>J(void 0,void 0,void 0,(function*(){const{options:e}=t,{infuraAPIKey:n}=e;if(!n)return;const r={"0x1":`https://mainnet.infura.io/v3/${n}`,"0x5":`https://goerli.infura.io/v3/${n}`,"0xaa36a7":`https://sepolia.infura.io/v3/${n}`,"0xe708":`https://linea-mainnet.infura.io/v3/${n}`,"0xe704":`https://linea-goerli.infura.io/v3/${n}`,"0x89":`https://polygon-mainnet.infura.io/v3/${n}`,"0x13881":`https://polygon-mumbai.infura.io/v3/${n}`,"0x45":`https://optimism-mainnet.infura.io/v3/${n}`,"0x1a4":`https://optimism-goerli.infura.io/v3/${n}`,"0xa4b1":`https://arbitrum-mainnet.infura.io/v3/${n}`,"0x66eed":`https://arbitrum-goerli.infura.io/v3/${n}`,"0x2a15c308d":`https://palm-mainnet.infura.io/v3/${n}`,"0x2a15c3083":`https://palm-testnet.infura.io/v3/${n}`,"0xa86a":`https://avalanche-mainnet.infura.io/v3/${n}`,"0xa869":`https://avalanche-fuji.infura.io/v3/${n}`,"0x4e454152":`https://aurora-mainnet.infura.io/v3/${n}`,"0x4e454153":`https://aurora-testnet.infura.io/v3/${n}`,"0x534e5f4d41494e":`https://starknet-mainnet.infura.io/v3/${n}`,"0x534e5f474f45524c49":`https://starknet-goerli.infura.io/v3/${n}`,"0x534e5f474f45524c4932":`https://starknet-goerli2.infura.io/v3/${n}`,"0xa4ec":`https://celo-mainnet.infura.io/v3/${n}`,"0xaef3":`https://celo-alfajores.infura.io/v3/${n}`};t.options.readonlyRPCMap?t.options.readonlyRPCMap=Object.assign(Object.assign({},t.options.readonlyRPCMap),r):t.options.readonlyRPCMap=r})),uy=t=>J(void 0,void 0,void 0,(function*(){const{options:e}=t,{readonlyRPCMap:n}=e;if(n)try{G("[MetaMaskSDK: setupReadOnlyRPCProviders()] Setting up Readonly RPC Providers",n),t.setReadOnlyRPCCalls(!0)}catch{throw new Error("Invalid Infura Settings")}}));function dy(t,e,n,r){return new(n||(n=Promise))((function(i,o){function c(l){try{a(r.next(l))}catch(u){o(u)}}function s(l){try{a(r.throw(l))}catch(u){o(u)}}function a(l){var u;l.done?i(l.value):(u=l.value,u instanceof n?u:new n((function(d){d(u)}))).then(c,s)}a((r=r.apply(t,[])).next())}))}function hy(t,e){var n,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(a){return function(l){return(function(u){if(n)throw new TypeError("Generator is already executing.");for(;c;)try{if(n=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(i=c.trys,!((i=i.length>0&&i[i.length-1])||u[0]!==6&&u[0]!==2)){c=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(u[0]===6&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=e.call(t,c)}catch(d){u=[6,d],r=0}finally{n=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}})([a,l])}}}var ou="INSTALLED",su="NOT_INSTALLED",au="REGISTERED",cu="REGISTERING",lu="RELOADING",uu={CHROME:"https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",FIREFOX:"https://addons.mozilla.org/firefox/addon/ether-metamask/",DEFAULT:"https://metamask.io"},Ai="REGISTRATION_IN_PROGRESS",du="FORWARDER_ID",fy=(function(){function t(e){var n=e===void 0?{}:e,r=n.forwarderOrigin,i=r===void 0?"https://fwd.metamask.io":r,o=n.forwarderMode,c=o===void 0?t.FORWARDER_MODE.INJECT:o;this.forwarderOrigin=i,this.forwarderMode=c,this.state=t.isMetaMaskInstalled()?ou:su;var s=t._detectBrowser();this.downloadUrl=s?uu[s]:uu.DEFAULT,this._onMessage=this._onMessage.bind(this),this._onMessageFromForwarder=this._onMessageFromForwarder.bind(this),this._openForwarder=this._openForwarder.bind(this),this._openDownloadPage=this._openDownloadPage.bind(this),this.startOnboarding=this.startOnboarding.bind(this),this.stopOnboarding=this.stopOnboarding.bind(this),window.addEventListener("message",this._onMessage),c===t.FORWARDER_MODE.INJECT&&sessionStorage.getItem(Ai)==="true"&&t._injectForwarder(this.forwarderOrigin)}return t.prototype._onMessage=function(e){if(e.origin===this.forwarderOrigin)return e.data.type==="metamask:reload"?this._onMessageFromForwarder(e):void console.debug("Unknown message from '"+e.origin+"' with data "+JSON.stringify(e.data))},t.prototype._onMessageUnknownStateError=function(e){throw new Error("Unknown state: '"+e+"'")},t.prototype._onMessageFromForwarder=function(e){return dy(this,0,void 0,(function(){return hy(this,(function(n){switch(n.label){case 0:switch(this.state){case lu:return[3,1];case su:return[3,2];case ou:return[3,3];case cu:return[3,5];case au:return[3,6]}return[3,7];case 1:return console.debug("Ignoring message while reloading"),[3,8];case 2:return console.debug("Reloading now to register with MetaMask"),this.state=lu,location.reload(),[3,8];case 3:return console.debug("Registering with MetaMask"),this.state=cu,[4,t._register()];case 4:return n.sent(),this.state=au,e.source.postMessage({type:"metamask:registrationCompleted"},e.origin),this.stopOnboarding(),[3,8];case 5:return console.debug("Already registering - ignoring reload message"),[3,8];case 6:return console.debug("Already registered - ignoring reload message"),[3,8];case 7:this._onMessageUnknownStateError(this.state),n.label=8;case 8:return[2]}}))}))},t.prototype.startOnboarding=function(){sessionStorage.setItem(Ai,"true"),this._openDownloadPage(),this._openForwarder()},t.prototype.stopOnboarding=function(){sessionStorage.getItem(Ai)==="true"&&(this.forwarderMode===t.FORWARDER_MODE.INJECT&&(console.debug("Removing forwarder"),t._removeForwarder()),sessionStorage.setItem(Ai,"false"))},t.prototype._openForwarder=function(){this.forwarderMode===t.FORWARDER_MODE.OPEN_TAB?window.open(this.forwarderOrigin,"_blank"):t._injectForwarder(this.forwarderOrigin)},t.prototype._openDownloadPage=function(){window.open(this.downloadUrl,"_blank")},t.isMetaMaskInstalled=function(){return!!(window.ethereum&&window.ethereum.isMetaMask)},t._register=function(){return window.ethereum.request({method:"wallet_registerOnboarding"})},t._injectForwarder=function(e){var n=document.body,r=document.createElement("iframe");r.setAttribute("height","0"),r.setAttribute("width","0"),r.setAttribute("style","display: none;"),r.setAttribute("src",e),r.setAttribute("id",du),n.insertBefore(r,n.children[0])},t._removeForwarder=function(){var e;(e=document.getElementById(du))===null||e===void 0||e.remove()},t._detectBrowser=function(){var e=mf.parse(window.navigator.userAgent);return e.browser.name==="Firefox"?"FIREFOX":["Chrome","Chromium"].includes(e.browser.name||"")?"CHROME":null},t.FORWARDER_MODE={INJECT:"INJECT",OPEN_TAB:"OPEN_TAB"},t})();function py(t,{wait:e=!1}){return J(this,void 0,void 0,(function*(){return G(`[MetamaskInstaller: startInstaller()] wait=${e}`),e&&(yield vf(1e3)),yield t.checkInstallation()}))}class my{constructor({remote:e,preferDesktop:n,platformManager:r,debug:i=!1}){this.state={isInstalling:!1,hasInstalled:!1,resendRequest:null,preferDesktop:!1,platformManager:null,remote:null,debug:!1,connectWith:void 0},this.state.remote=e,this.state.preferDesktop=n,this.state.platformManager=r,this.state.debug=i}startDesktopOnboarding(){return(function(){return J(this,void 0,void 0,(function*(){G("[MetamaskInstaller: startDesktopOnboarding() starting desktop onboarding"),window.ethereum&&(window.ethereum=void 0),new fy().startOnboarding()}))})()}redirectToProperInstall(){return J(this,void 0,void 0,(function*(){return(function(e){var n,r;return J(this,void 0,void 0,(function*(){const{state:i}=e,o=(n=i.platformManager)===null||n===void 0?void 0:n.getPlatformType();if(G(`[MetamaskInstaller: redirectToProperInstall()] platform=${o}`),o===Ve.MetaMaskMobileWebview)return!1;i.isInstalling=!0;try{yield(r=i.remote)===null||r===void 0?void 0:r.startConnection({connectWith:i.connectWith}),i.isInstalling=!1,i.hasInstalled=!0}catch(c){throw i.isInstalling=!1,c}return!0}))})(this)}))}checkInstallation(){return J(this,void 0,void 0,(function*(){return(function(e){var n;return J(this,void 0,void 0,(function*(){const{state:r}=e,i=(n=r.platformManager)===null||n===void 0?void 0:n.isMetaMaskInstalled();return G(`[MetamaskInstaller: checkInstallation()] isInstalled=${i}`),!!i||(yield e.redirectToProperInstall())}))})(this)}))}start({wait:e=!1,connectWith:n}){return J(this,void 0,void 0,(function*(){this.state.connectWith=n,G(`[MetaMaskInstaller: start()] wait=${e}`,n),yield py(this,{wait:e})}))}}class wf{constructor({debug:e,sdkVersion:n}){this.containers={install:void 0,pending:void 0,select:void 0},this.defined={install:!1,pending:!1,select:!1},this.debug=e!=null&&e,this.sdkVersion=n}loadComponent(e){return J(this,void 0,void 0,(function*(){if(!this.defined[e]){this.defined[e]=!0;try{const n=yield Promise.resolve().then((function(){return Gy}));console.log("loader",n),n.defineCustomElements()}catch(n){console.error(`Failed to load ${e} modal:`,n)}}}))}renderInstallModal(e){var n;return J(this,void 0,void 0,(function*(){this.debug&&console.debug("ModalLoader: renderInstallModal",e),this.containers.install=e.parentElement,yield this.loadComponent("install");const r=document.createElement("mm-install-modal");r.link=e.link,r.preferDesktop=e.preferDesktop,r.sdkVersion=(n=e.sdkVersion)!==null&&n!==void 0?n:this.sdkVersion,r.addEventListener("close",(({detail:{shouldTerminate:i}})=>e.onClose(i))),r.addEventListener("startDesktopOnboarding",e.metaMaskInstaller.startDesktopOnboarding),r.addEventListener("trackAnalytics",(i=>{var o;return(o=e.onAnalyticsEvent)===null||o===void 0?void 0:o.call(e,i.detail)})),e.parentElement.appendChild(r)}))}renderSelectModal(e){var n;return J(this,void 0,void 0,(function*(){this.containers.select=e.parentElement,yield this.loadComponent("select");const r=document.createElement("mm-select-modal");r.link=e.link,r.sdkVersion=(n=e.sdkVersion)!==null&&n!==void 0?n:this.sdkVersion,r.preferDesktop=e.preferDesktop,r.addEventListener("close",(({detail:{shouldTerminate:i}})=>e.onClose(i))),r.addEventListener("connectWithExtension",e.connectWithExtension),e.parentElement.appendChild(r),setTimeout((()=>this.updateQRCode(e.link)),100)}))}renderPendingModal(e){var n;return J(this,void 0,void 0,(function*(){this.containers.pending=e.parentElement,yield this.loadComponent("pending");const r=document.createElement("mm-pending-modal");r.sdkVersion=(n=e.sdkVersion)!==null&&n!==void 0?n:this.sdkVersion,r.displayOTP=e.displayOTP,r.addEventListener("close",e.onClose),r.addEventListener("updateOTPValue",(({detail:{otpValue:i}})=>e.updateOTPValue(i))),e.onDisconnect&&r.addEventListener("disconnect",e.onDisconnect),e.parentElement.appendChild(r)}))}updateOTPValue(e){const n=()=>{var r;const i=(r=this.containers.pending)===null||r===void 0?void 0:r.querySelector("mm-pending-modal");return!!i&&(i.otpCode=e,!0)};setTimeout((()=>{n()}),800)}updateQRCode(e){var n,r;const i=(n=this.containers.install)===null||n===void 0?void 0:n.querySelector("mm-install-modal");if(i)i.link=e;else{const o=(r=this.containers.select)===null||r===void 0?void 0:r.querySelector("mm-select-modal");o&&(o.link=e)}}unmount(){Object.entries(this.containers).forEach((([e,n])=>{var r;(r=n==null?void 0:n.parentNode)===null||r===void 0||r.removeChild(n),this.containers[e]=void 0}))}}const gy=({link:t,debug:e,installer:n,terminate:r,connectWithExtension:i,preferDesktop:o,onAnalyticsEvent:c})=>{let s=null,a=null;G("[UI: InstallModal-web: sdkWebInstallModal()] ################## Installing Modal #################"),G(`[UI: InstallModal-web: sdkWebInstallModal()] link=${t}`),G(`[UI: InstallModal-web: sdkWebInstallModal()] npx uri-scheme open "${t}" --ios`),G(`[UI: InstallModal-web: sdkWebInstallModal()] npx uri-scheme open "${t}" --android`),G(`[UI: InstallModal-web: sdkWebInstallModal()] adb shell am start -a android.intent.action.VIEW -d "${t}"`);const l=u=>{var d;G("[UI: InstallModal-web: sdkWebInstallModal()] installModal-web unmounting install modal -- shouldTerminate:",u,a),a!=null&&a.parentNode&&((d=a.parentNode)===null||d===void 0||d.removeChild(a)),a=null,s=null,u===!0&&(r==null||r())};return{mount:u=>{if(G("[UI: InstallModal-web: sdkWebInstallModal()] installModal-web mounting install modal",a),a)return a.style.display="block",void(s==null||s.updateQRCode(u));s=new wf({debug:e,sdkVersion:Hn.version}),a=document.createElement("div"),document.body.appendChild(a),window.extension?s.renderSelectModal({parentElement:a,connectWithExtension:()=>{l(),i==null||i()},onClose:l,link:t,preferDesktop:o!=null&&o}).catch((d=>{console.error(d)})):s.renderInstallModal({parentElement:a,preferDesktop:o!=null&&o,link:t,metaMaskInstaller:n,onClose:l,onAnalyticsEvent:c}).catch((d=>{console.error("[UI: InstallModal-web: sdkWebInstallModal()]",d)}))},unmount:l}},yy=({onDisconnect:t,debug:e})=>{let n=null,r=null;const i=()=>{G("[UI: pendingModal-web: sdkWebPendingModal()] pendingModal-web unmount",n),n!=null&&n.parentNode&&n.parentNode.removeChild(n),n=null,r=null},o=s=>{G("[UI: pendingModal-web: sdkWebPendingModal()] pendingModal-web updateOTPValue",s),r&&r.updateOTPValue(s)},c=({displayOTP:s}={displayOTP:!0})=>{G("[UI: pendingModal-web: sdkWebPendingModal()] pendingModal-web mount",n),n?n.style.display="block":(r=new wf({debug:e,sdkVersion:Hn.version}),n=document.createElement("div"),document.body.appendChild(n),r.renderPendingModal({parentElement:n,onClose:i,onDisconnect:t,updateOTPValue:o,displayOTP:s}).catch((a=>{console.error("[UI: pendingModal-web: sdkWebPendingModal()]",a)})))};return c(),{mount:c,unmount:i,updateOTPValue:o}};function Ef(t,e){var n,r,i,o;t.connector||(G("[RemoteConnection: initializeConnector()] initialize connector"),t.connector=new bm({anonId:e.anonId,platformType:e.platformManager.getPlatformType(),communicationLayerPreference:e.communicationLayerPreference,transports:e.transports,dappMetadata:Object.assign(Object.assign({},e.dappMetadata),{source:e._source}),analytics:e.enableAnalytics,communicationServerUrl:e.communicationServerUrl,sdkVersion:Hn.version,context:"dapp",ecies:e.ecies,storage:e.storage,logging:e.logging}),e.timer&&(G("[RemoteConnection: initializeConnector()] reset background timer",e.timer),(r=(n=e.timer)===null||n===void 0?void 0:n.stopBackgroundTimer)===null||r===void 0||r.call(n),(o=(i=e.timer)===null||i===void 0?void 0:i.runBackgroundTimer)===null||o===void 0||o.call(i,(()=>!1),1e4)))}function la(t){t.listeners.forEach((({event:e,handler:n})=>{var r;(r=t.connector)===null||r===void 0||r.off(e,n)})),t.listeners=[]}function vy(t,e,n){return J(this,void 0,void 0,(function*(){const r=setTimeout((()=>{Re.analytics.track("sdk_connection_failed",{transport_type:"websocket"})}),6e4);return new Promise(((i,o)=>{if(!t.connector)return void o(new Error("No connector available"));G("[RemoteConnection: connectWithModalInstaller()]",{state:t,options:e,linkParams:n});const c=`${t.useDeeplink?Wr:Vr}?${n}`;(function(s,a,l){var u,d,h,f;s.installModal=(d=(u=a.modals).install)===null||d===void 0?void 0:d.call(u,{link:l,preferDesktop:s.preferDesktop,installer:a.getMetaMaskInstaller(),terminate:()=>{G("[RemoteConnection: showInstallModal() => terminate()] terminate connection"),a.sdk.terminate().catch((m=>{console.warn("[MMSDK] failed to terminate connection",m)}))},debug:s.developerMode,connectWithExtension:()=>{var m;return(m=a.connectWithExtensionProvider)===null||m===void 0||m.call(a),!1},onAnalyticsEvent:({event:m,params:g})=>{var w,p,C;const _=Object.assign(Object.assign({},g),{sdkVersion:a.sdk.getVersion(),dappId:(w=a.dappMetadata)===null||w===void 0?void 0:w.name,source:a._source,url:(p=a.dappMetadata)===null||p===void 0?void 0:p.url});(C=s.analytics)===null||C===void 0||C.send({event:m,params:_})}}),(f=(h=s.installModal)===null||h===void 0?void 0:h.mount)===null||f===void 0||f.call(h,l)})(t,e,c),e.sdk.once(te.PROVIDER_UPDATE,(s=>J(this,void 0,void 0,(function*(){if(G("[RemoteConnection: connectWithModalInstaller()] once provider_update -- resolving startConnection promise"),s===Kt.TERMINATE){const a={code:4001,message:"User rejected the request."};return clearTimeout(r),void o(a)}o(s)})))),t.connector.once(te.AUTHORIZED,(()=>{clearTimeout(r),i()})),t.connector.once(te.REJECTED,(()=>{clearTimeout(r),o(te.REJECTED)})),t.connector.once(te.CLIENTS_READY,(()=>J(this,void 0,void 0,(function*(){G("[RemoteConnection: connectWithModalInstaller()] once clients_ready -- resolving startConnection promise"),clearTimeout(r),i()}))))}))}))}function _f(t,e){function n(r,i){var o;(o=t.connector)===null||o===void 0||o.on(r,i),t.listeners.push({event:r,handler:i})}t.connector&&(la(t),n(te.WALLET_INIT,(({accounts:r,chainId:i})=>J(this,void 0,void 0,(function*(){G(`[RemoteConnection: setupListeners() => EventType.WALLET_INIT] 'wallet_init' accounts=${r} chainId=${i}`);const o=kt.getProvider();o._setConnected();const c={accounts:r,chainId:i,isUnlocked:!1};o._initializeState(c),o.emit("chainChanged",i),o.emit("accountsChanged",r)})))),n(te.AUTHORIZED,(()=>J(this,void 0,void 0,(function*(){var r,i,o,c;try{G("[RemoteConnection: setupListeners() => EventType.AUTHORIZED] 'authorized' closing modals",t.pendingModal,t.installModal);const s=kt.getProvider();s._setConnected(),(i=(r=t.pendingModal)===null||r===void 0?void 0:r.unmount)===null||i===void 0||i.call(r),(c=(o=t.installModal)===null||o===void 0?void 0:o.unmount)===null||c===void 0||c.call(o,!1),t.otpAnswer=void 0,t.authorized=!0,G("[RemoteConnection: setupListeners() => EventType.AUTHORIZED] 'authorized' provider.state",s.getState()),yield s.forceInitializeState()}catch{}})))),n(te.TERMINATE,(()=>{var r,i,o,c,s;(i=(r=t.pendingModal)===null||r===void 0?void 0:r.unmount)===null||i===void 0||i.call(r),(c=(o=t.installModal)===null||o===void 0?void 0:o.unmount)===null||c===void 0||c.call(o,!0),t.pendingModal=void 0,t.installModal=void 0,t.otpAnswer=void 0,(s=t.connector)===null||s===void 0||s.disconnect({terminate:!0}),t.authorized=!1,kt.getProvider().handleDisconnect({terminate:!0}),la(t),G("[RemoteConnection: setupListeners()] All listeners cleaned up")})))}function by(t,e,{initialCheck:n,connectWith:r}={}){var i,o,c,s,a,l,u,d,h,f,m,g,w,p,C,_,P,L,U;return J(this,void 0,void 0,(function*(){try{if(Ef(t,e),!t.connector)throw new Error("no connector defined");_f(t);const q=kt.getProvider();t.authorized=!1,q.emit("connecting");const F=yield(i=t.connector)===null||i===void 0?void 0:i.originatorSessionConnect();G(`[RemoteConnection: startConnection()] after originatorSessionConnect initialCheck=${n}`,F);let D=(o=F==null?void 0:F.channelId)!==null&&o!==void 0?o:"",N=(s=(c=t.connector.getKeyInfo())===null||c===void 0?void 0:c.ecies.public)!==null&&s!==void 0?s:"",H=(l=(a=t.connector.getKeyInfo())===null||a===void 0?void 0:a.ecies.private)!==null&&l!==void 0?l:"";if(n&&!F)return Promise.resolve();if(!F&&!n){const x=yield t.connector.generateChannelIdConnect();D=(u=x.channelId)!==null&&u!==void 0?u:"",N=(d=x.pubKey)!==null&&d!==void 0?d:"",H=(h=x.privKey)!==null&&h!==void 0?h:"";const R=Date.now();(f=t.connector.state.storageManager)===null||f===void 0||f.persistChannelConfig({channelId:D,localKey:H,lastActive:R,validUntil:R+cr})}if(n&&(F!=null&&F.channelId))return!((m=t.connector)===null||m===void 0)&&m.isConnected()||(G(`[RemoteConnection: startConnection()] reconnecting to channel initialCheck=${n}`,F),yield(g=t.connector)===null||g===void 0?void 0:g.connectToChannel({channelId:D})),Promise.resolve();F&&!(!((w=t.connector)===null||w===void 0)&&w.isConnected())&&(G("[RemoteConnection: startConnection()] reconnecting to channel",F),yield(p=t.connector)===null||p===void 0?void 0:p.connectToChannel({channelId:D}));const $=!((C=t.platformManager)===null||C===void 0)&&C.isSecure()?"":"&t=q",O=Hn.version,{iconUrl:M,name:S,url:I,scheme:j}=e.dappMetadata||{},y=(_=t.platformManager)===null||_===void 0?void 0:_.getPlatformType();let E="N/A";typeof window<"u"&&window.location&&window.location.hostname?E=window.location.hostname:S!==void 0?E=S:I!==void 0&&(E=I);const A={url:I??"",title:S??"",icon:M,scheme:j??"",apiVersion:O,dappId:E||I||"N/A",anonId:e.anonId,platform:y??"",source:(P=e._source)!==null&&P!==void 0?P:""},T=bo(JSON.stringify(A));let b=`channelId=${D}&v=2&comm=${(L=t.communicationLayerPreference)!==null&&L!==void 0?L:""}&pubkey=${N}${$}&originatorInfo=${T}`;if(r){b+=`&rpc=${bo(JSON.stringify(r))}`;const x=t.connector.getRPCMethodTracker();x&&(x[`${r.id}`]=Object.assign(Object.assign({},r),{id:`${r.id}`,timestamp:Date.now()}))}const v=encodeURI(b),k=`${t.useDeeplink?Wr:Vr}?${b}`;if(t.qrcodeLink=k,t.developerMode&&G(`[RemoteConnection: startConnection()] qrcodeLink=${v}`),q.emit("display_uri",k),Re.analytics.track("sdk_connection_initiated",{transport_type:"websocket"}),(U=t.platformManager)===null||U===void 0?void 0:U.isSecure()){const x=setTimeout((()=>{Re.analytics.track("sdk_connection_failed",{transport_type:"websocket"})}),6e4);return yield(function(R,B){var K,z;return J(this,void 0,void 0,(function*(){const V=`${Vr}?${B}`,Z=`${Wr}?${B}`;(z=(K=R.platformManager)===null||K===void 0?void 0:K.openDeeplink)===null||z===void 0||z.call(K,V,Z,"_self")}))})(t,v),new Promise(((R,B)=>{var K,z,V;if(!((K=t.connector)===null||K===void 0)&&K.isAuthorized())return clearTimeout(x),void R();(z=t.connector)===null||z===void 0||z.once(te.AUTHORIZED,(()=>{clearTimeout(x),R()})),(V=t.connector)===null||V===void 0||V.once(te.REJECTED,(()=>{clearTimeout(x),B(te.REJECTED)}))}))}return vy(t,e,v)}catch(q){throw console.error("[startConnection] error",q),q}}))}class wy{constructor(e){var n,r,i;this.state={connector:void 0,qrcodeLink:void 0,analytics:void 0,developerMode:!1,authorized:!1,reconnection:!1,preferDesktop:!1,deeplinkProtocol:!1,listeners:[],communicationLayerPreference:void 0,platformManager:void 0,pendingModal:void 0,installModal:void 0,otpAnswer:void 0},this.options=e;const o=((n=e.logging)===null||n===void 0?void 0:n.developerMode)===!0||((r=e.logging)===null||r===void 0?void 0:r.sdk)===!0;this.state.developerMode=o,this.state.analytics=e.analytics,this.state.preferDesktop=(i=e.preferDesktop)!==null&&i!==void 0&&i,this.state.useDeeplink=e.sdk.options.useDeeplink,this.state.communicationLayerPreference=e.communicationLayerPreference,this.state.platformManager=e.platformManager,e.modals.install||(e.modals.install=gy),e.modals.otp||(e.modals.otp=yy)}startConnection(e){return J(this,void 0,void 0,(function*(){return by(this.state,this.options,e)}))}initRemoteCommunication({sdkInstance:e}){var n,r,i;return J(this,void 0,void 0,(function*(){const o=yield(r=(n=e.options.storage)===null||n===void 0?void 0:n.storageManager)===null||r===void 0?void 0:r.getPersistedChannelConfig();if(!this.options.ecies){const c={privateKey:o==null?void 0:o.localKey};this.options.ecies=c}Ef(this.state,this.options),yield(i=this.getConnector())===null||i===void 0?void 0:i.initFromDappStorage(),_f(this.state,this.options)}))}showActiveModal(){return(function(e){var n,r,i,o;e.authorized?G("[RemoteConnection: showActiveModal()] already authorized"):e.pendingModal?(r=(n=e.pendingModal).mount)===null||r===void 0||r.call(n):e.installModal&&((o=(i=e.installModal).mount)===null||o===void 0||o.call(i,e.qrcodeLink||""))})(this.state)}closeModal(){var e,n,r,i;(n=(e=this.state.pendingModal)===null||e===void 0?void 0:e.unmount)===null||n===void 0||n.call(e),(i=(r=this.state.installModal)===null||r===void 0?void 0:r.unmount)===null||i===void 0||i.call(r,!1)}getUniversalLink(){if(!this.state.qrcodeLink)throw new Error("connection not started. run startConnection() first.");return this.state.qrcodeLink}getChannelConfig(){var e;return(e=this.state.connector)===null||e===void 0?void 0:e.getChannelConfig()}getKeyInfo(){var e;return(e=this.state.connector)===null||e===void 0?void 0:e.getKeyInfo()}getConnector(){if(!this.state.connector)throw new Error("invalid remote connector");return this.state.connector}getPlatformManager(){if(!this.state.platformManager)throw new Error("PlatformManager not available");return this.state.platformManager}isConnected(){var e;return((e=this.state.connector)===null||e===void 0?void 0:e.isReady())||!1}isAuthorized(){var e;return((e=this.state.connector)===null||e===void 0?void 0:e.isAuthorized())||!1}isPaused(){var e;return(e=this.state.connector)===null||e===void 0?void 0:e.isPaused()}disconnect(e){var n,r,i;G("[RemoteConnection: disconnect()]",e),e!=null&&e.terminate&&(kt.getProvider().handleDisconnect({terminate:!0}),(r=(n=this.state.pendingModal)===null||n===void 0?void 0:n.unmount)===null||r===void 0||r.call(n),this.state.otpAnswer=void 0),(i=this.state.connector)===null||i===void 0||i.disconnect(e),(function(o){G("[RemoteConnection: cleanupConnector()] cleaning up connector"),o.connector&&(la(o),o.connector.disconnect({terminate:!0}).catch((c=>{G("[RemoteConnection: cleanupConnector()] error disconnecting connector",c)})))})(this.state)}}function Ey(t){var e,n,r,i,o,c,s,a,l,u,d;return J(this,void 0,void 0,(function*(){const{options:h}=t;if(h.logging=(e=h.logging)!==null&&e!==void 0?e:{},h.communicationLayerPreference=(n=h.communicationLayerPreference)!==null&&n!==void 0?n:Bn.SOCKET,h.enableDebug!==void 0&&(Je.enable("MM_SDK"),console.warn("enableDebug is removed. Please use enableAnalytics instead.")),h.enableAnalytics=(r=h.enableAnalytics)===null||r===void 0||r,h.injectProvider=(i=h.injectProvider)===null||i===void 0||i,h.shouldShimWeb3=(o=h.shouldShimWeb3)===null||o===void 0||o,h.extensionOnly=(c=h.extensionOnly)===null||c===void 0||c,h.useDeeplink=(s=h.useDeeplink)===null||s===void 0||s,h.storage=(a=h.storage)!==null&&a!==void 0?a:{enabled:!0},h.headless){Je("[MetaMaskSDK: performSDKInitialization()] headless mode enabled");const C=()=>{},_={install:()=>({mount:C,unmount:C})},P={installer:C};h.modals=_,h.ui=P}const f=((l=h.logging)===null||l===void 0?void 0:l.developerMode)===!0;t.debug=((u=h.logging)===null||u===void 0?void 0:u.sdk)||f,G("[MetaMaskSDK: performSDKInitialization()] options",t.options);const m=Object.assign({},h.logging);f&&(m.sdk=!0,m.eciesLayer=!0,m.keyExchangeLayer=!0,m.remoteLayer=!0,m.serviceLayer=!0,m.plaintext=!0),yield(function(C){var _;return J(this,void 0,void 0,(function*(){const{options:P}=C;C.platformManager=new qr({useDeepLink:(_=P.useDeeplink)!==null&&_!==void 0&&_,preferredOpenLink:P.openDeeplink,debug:C.debug})}))})(t),yield(function(C){var _,P,L,U,q;return J(this,void 0,void 0,(function*(){const{options:F}=C,D=(_=C.platformManager)===null||_===void 0?void 0:_.getPlatformType();C.analytics=new oy({serverUrl:(P=F.communicationServerUrl)!==null&&P!==void 0?P:ar,enabled:F.enableAnalytics,originatorInfo:{url:(L=F.dappMetadata.url)!==null&&L!==void 0?L:"",title:(U=F.dappMetadata.name)!==null&&U!==void 0?U:"",dappId:C.getDappId(),platform:D??"",source:(q=F._source)!==null&&q!==void 0?q:"",anonId:""}})}))})(t),yield(function(C){var _,P,L;return J(this,void 0,void 0,(function*(){if(!C.options.enableAnalytics||!(!((_=C.platformManager)===null||_===void 0)&&_.isBrowser())&&!(!((P=C.platformManager)===null||P===void 0)&&P.isReactNative()))return;const U=C.getVersion(),q=C.getDappId(),F=yield C.getAnonId(),D=(L=C.platformManager)===null||L===void 0?void 0:L.getPlatformType(),N=C.options._source;Re.analytics.setGlobalProperty("sdk_version",U),Re.analytics.setGlobalProperty("dapp_id",q),Re.analytics.setGlobalProperty("anon_id",F),Re.analytics.setGlobalProperty("platform",D),Re.analytics.setGlobalProperty("integration_type",N),Re.analytics.enable(),Re.analytics.track("sdk_initialized",{})}))})(t),yield(function(C){var _;return J(this,void 0,void 0,(function*(){const{options:P}=C;((_=P.storage)===null||_===void 0?void 0:_.enabled)!==!0||P.storage.storageManager||(P.storage.storageManager=yield gf(P.storage))}))})(t),yield(function(C){return J(this,void 0,void 0,(function*(){const{options:_}=C,P=/^(http|https):\/\/[^\s]*$/;if(_.dappMetadata){_.dappMetadata.iconUrl&&!P.test(_.dappMetadata.iconUrl)&&(console.warn("Invalid dappMetadata.iconUrl: URL must start with http:// or https://"),_.dappMetadata.iconUrl=void 0),_.dappMetadata.base64Icon&&_.dappMetadata.base64Icon.length>ay&&(console.warn("Invalid dappMetadata.base64Icon: Base64-encoded icon string length must be less than 163400 characters"),_.dappMetadata.base64Icon=void 0),_.dappMetadata.url&&!P.test(_.dappMetadata.url)&&console.warn("Invalid dappMetadata.url: URL must start with http:// or https://");const L=sy();if(L&&!_.dappMetadata.iconUrl&&!_.dappMetadata.base64Icon){const U=`${window.location.protocol}//${window.location.host}${L}`;_.dappMetadata.iconUrl=U}}C.dappMetadata=_.dappMetadata}))})(t),yield ly(t),yield uy(t);const{metamaskBrowserExtension:g,preferExtension:w,shouldReturn:p}=yield(function(C){var _,P,L,U;return J(this,void 0,void 0,(function*(){const{options:q}=C;let F,D=!1,N=!1;if(typeof window<"u"&&window.ethereum&&!(!((_=C.platformManager)===null||_===void 0)&&_.isMetaMaskMobileWebView())){D=localStorage.getItem(vo)==="extension";try{F=yield cy({mustBeMetaMask:!0,sdkInstance:C}),window.extension=F,F.on(xt.CHAIN_CHANGED,(H=>{G(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE chainChanged chainId=${H}`),C.sdkProvider&&C.getMobileProvider().emit(xt.CHAIN_CHANGED,H)})),F.on(xt.ACCOUNTS_CHANGED,(H=>J(this,void 0,void 0,(function*(){var $;G(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE accountsChanged accounts=${H}`);const O=!!C.sdkProvider,M=!!C.extensionActive;if(O&&C.getMobileProvider().emit(xt.ACCOUNTS_CHANGED,H),M&&(H==null?void 0:H.length)===0&&(yield($=C.getProvider())===null||$===void 0?void 0:$.request({method:he.WALLET_GETPERMISSIONS,params:[]})).length===0)try{yield C.terminate()}catch(S){G("[MetaMaskSDK: setupExtensionPreferences()] error terminating on permissions revoked",S)}})))),F.on(xt.DISCONNECT,(H=>{G(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE disconnect error=${H}`),C.sdkProvider&&C.getMobileProvider().emit(xt.DISCONNECT,H)})),F.on(xt.CONNECT,(H=>{G(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE connect args=${H}`),C.sdkProvider&&C.getMobileProvider().emit(xt.CONNECT,H)})),F.on(xt.CONNECTED,(H=>{G("[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE connected",H),C.sdkProvider&&C.getMobileProvider().emit(xt.CONNECTED,H)}))}catch{window.extension=void 0}}else!((P=C.platformManager)===null||P===void 0)&&P.isMetaMaskMobileWebView()&&((L=C.analytics)===null||L===void 0||L.send({event:Oe.SDK_USE_INAPP_BROWSER}),C.activeProvider=bf({provider:window.ethereum,sdkInstance:C}),C._initialized=!0,N=!0);return F&&q.extensionOnly&&(G("[MetaMaskSDK: setupExtensionPreferences()] EXTENSION ONLY --- prevent sdk initialization"),(U=C.analytics)===null||U===void 0||U.send({event:Oe.SDK_USE_EXTENSION}),C.activeProvider=F,C.extensionActive=!0,C.extension=F,C._initialized=!0,N=!0),{preferExtension:D,shouldReturn:N,metamaskBrowserExtension:F}}))})(t);if(p)G("[MetaMaskSDK: performSDKInitialization()] shouldReturn=true --- prevent sdk initialization");else{yield(function(C,_){var P,L,U,q,F;return J(this,void 0,void 0,(function*(){const{options:D}=C,N=Object.assign({},D.logging);C.remoteConnection=new wy({anonId:yield C.getAnonId(),preferDesktop:(P=D.preferDesktop)!==null&&P!==void 0&&P,communicationLayerPreference:(L=D.communicationLayerPreference)!==null&&L!==void 0?L:Bn.SOCKET,analytics:C.analytics,dappMetadata:D.dappMetadata,_source:D._source,enableAnalytics:(U=D.enableAnalytics)===null||U===void 0||U,timer:D.timer,sdk:C,platformManager:C.platformManager,transports:D.transports,communicationServerUrl:D.communicationServerUrl,storage:(q=D.storage)!==null&&q!==void 0?q:{enabled:!0},getMetaMaskInstaller:()=>{if(!C.installer)throw new Error("Invalid SDK status -- installer not initialized");return C.installer},logging:N,connectWithExtensionProvider:_===void 0?void 0:()=>nu(C),modals:Object.assign(Object.assign({},D.modals),{onPendingModalDisconnect:C.terminate.bind(C)})}),yield C.remoteConnection.initRemoteCommunication({sdkInstance:C}),C.installer=new my({remote:C.remoteConnection,preferDesktop:(F=D.preferDesktop)!==null&&F!==void 0&&F,platformManager:C.platformManager,debug:C.debug})}))})(t,g),yield ry(t),yield(function(C,_){var P,L;return J(this,void 0,void 0,(function*(){const{options:U}=C;_?(G("[MetaMaskSDK: handleAutoAndExtensionConnections()] preferExtension is detected -- connect with it."),(P=C.analytics)===null||P===void 0||P.send({event:Oe.SDK_EXTENSION_UTILIZED}),nu(C).catch((q=>{console.warn("Can't connect with MetaMask extension...",q),localStorage.removeItem(vo)}))):U.checkInstallationImmediately&&(!((L=C.platformManager)===null||L===void 0)&&L.isDesktopWeb()?(G("[MetaMaskSDK: handleAutoAndExtensionConnections()] checkInstallationImmediately"),C.connect().catch((q=>{G(`[MetaMaskSDK: handleAutoAndExtensionConnections()] checkInstallationImmediately --- IGNORED --- error on autoconnect _err=${q}`)}))):console.warn("[handleAutoAndExtensionConnections()] checkInstallationImmediately --- IGNORED --- only for web desktop")),C._initialized=!0}))})(t,w);try{yield(d=t.remoteConnection)===null||d===void 0?void 0:d.startConnection({initialCheck:!0})}catch(C){console.error("[MetaMaskSDK: setupRemoteConnectionAndInstaller()] Error while checking installation",C)}t.emit(nt.ProviderUpdate,Kt.INITIALIZED)}}))}class dv extends op{constructor(e={storage:{enabled:!0},injectProvider:!0,forceInjectProvider:!1,enableAnalytics:!0,shouldShimWeb3:!0,useDeeplink:!0,extensionOnly:!0,headless:!1,dappMetadata:{name:"",url:"",iconUrl:""},_source:eu,i18nOptions:{enabled:!1}}){var n,r,i;super(),this.extensionActive=!1,this._initialized=!1,this.sdkInitPromise=void 0,this.debug=!1,this.readonlyRPCCalls=!1,this.availableLanguages=["en"],this.ANON_ID_STORAGE_KEY="mm-sdk-anon-id",Je.disable();const o=((n=e.logging)===null||n===void 0?void 0:n.developerMode)===!0;if((!((r=e.logging)===null||r===void 0)&&r.sdk||o)&&Je.enable("MM_SDK"),G("[MetaMaskSDK: constructor()]: begin."),this.setMaxListeners(50),!(!((i=e.dappMetadata)===null||i===void 0)&&i.url)){if(typeof window>"u"||typeof document>"u")throw new Error("You must provide dAppMetadata url");e.dappMetadata=Object.assign(Object.assign({},e.dappMetadata),{url:`${window.location.protocol}//${window.location.host}`})}this.options=e,this.options._source||(e._source=eu),this.init().then((()=>{G("[MetaMaskSDK: constructor()]: initialized successfully."),typeof window<"u"&&(window.mmsdk=this)})).catch((c=>{console.error("[MetaMaskSDK: constructor()] error during initialization",c)}))}init(){return J(this,void 0,void 0,(function*(){return(function(e){var n;return J(this,void 0,void 0,(function*(){if(typeof window<"u"&&(!((n=window.mmsdk)===null||n===void 0)&&n.isInitialized()))return G("[MetaMaskSDK: initializeMetaMaskSDK()] already initialized"),Promise.resolve(window.mmsdk);if(e._initialized)return G("[MetaMaskSDK: initializeMetaMaskSDK()] already initialized"),e.sdkInitPromise;if(e.sdkInitPromise)return G("[MetaMaskSDK: initializeMetaMaskSDK()] already initializing"),e.sdkInitPromise;try{e.sdkInitPromise=Ey(e),yield e.sdkInitPromise}catch(r){throw console.error(r),r}return e.sdkInitPromise}))})(this)}))}isExtensionActive(){return this.extensionActive}checkExtensionAvailability(){var e;return typeof window<"u"&&!!(!((e=window.ethereum)===null||e===void 0)&&e.isMetaMask)}connect(){return J(this,void 0,void 0,(function*(){return(function(e){return J(this,void 0,void 0,(function*(){if(e._initialized||(G("[MetaMaskSDK: connect()] provider not ready -- wait for init()"),yield e.init()),G(`[MetaMaskSDK: connect()] isExtensionActive=${e.isExtensionActive()} activeProvider`,e.activeProvider),!e.activeProvider)throw new Error("SDK state invalid -- undefined provider");const n=e.activeProvider.getSelectedAddress();return n?[n]:e.activeProvider.request({method:he.ETH_REQUESTACCOUNTS,params:[]})}))})(this)}))}connectAndSign({msg:e}){return J(this,void 0,void 0,(function*(){return Qg({instance:this,msg:e})}))}connectWith(e){return J(this,void 0,void 0,(function*(){return(function({instance:n,rpc:r}){return J(this,void 0,void 0,(function*(){if(n._initialized||(G("[MetaMaskSDK: connectWith()] provider not ready -- wait for init()"),yield n.init()),G(`[MetaMaskSDK: connectWith()] method: ${r.method} rpc=${r}`),!n.activeProvider)throw new Error("SDK state invalid -- undefined provider");return n.activeProvider.request({method:he.METAMASK_CONNECTWITH,params:[r]})}))})({instance:this,rpc:e})}))}resume(){return(function(e){var n,r,i;return J(this,void 0,void 0,(function*(){if(!(!((r=(n=e.remoteConnection)===null||n===void 0?void 0:n.getConnector())===null||r===void 0)&&r.isReady()))return G("[MetaMaskSDK: resume()] channel is not ready -- starting connection"),void((i=e.remoteConnection)===null||i===void 0||i.startConnection());G("[MetaMaskSDK: resume()] channel is ready")}))})(this)}disconnect(){return console.warn("MetaMaskSDK.disconnect() is deprecated, use terminate()"),this.terminate()}isAuthorized(){var e;(e=this.remoteConnection)===null||e===void 0||e.isAuthorized()}terminate(){return(function(e){var n,r,i;return J(this,void 0,void 0,(function*(){if(!(!((n=e.platformManager)===null||n===void 0)&&n.isMetaMaskMobileWebView())){if(Xg&&(window.localStorage.removeItem(vo),window.localStorage.removeItem(ca),window.localStorage.removeItem(aa)),e.extensionActive){try{yield(r=e.activeProvider)===null||r===void 0?void 0:r.request({method:he.WALLET_REVOKEPERMISSIONS,params:[{eth_accounts:{}}]})}catch(o){G("[MetaMaskSDK: terminate()] error revoking permissions",o)}return e.options.extensionOnly?(e.emit(nt.ProviderUpdate,Kt.TERMINATE),void G("[MetaMaskSDK: terminate()] extensionOnly --- prevent switching providers")):(e.activeProvider=e.sdkProvider,window.ethereum=e.activeProvider,e.extensionActive=!1,void e.emit(nt.ProviderUpdate,Kt.TERMINATE))}e.emit(nt.ProviderUpdate,Kt.TERMINATE),G(`[MetaMaskSDK: terminate()] remoteConnection=${e.remoteConnection}`),(i=e.remoteConnection)===null||i===void 0||i.disconnect({terminate:!0,sendMessage:!0})}}))})(this)}isInitialized(){return this._initialized}setReadOnlyRPCCalls(e){this.readonlyRPCCalls=e}hasReadOnlyRPCCalls(){return this.readonlyRPCCalls}getProvider(){if(this.activeProvider)return this.activeProvider;console.warn("MetaMaskSDK: No active provider found")}getMobileProvider(){if(!this.sdkProvider)throw new Error("SDK state invalid -- undefined mobile provider");return this.sdkProvider}getUniversalLink(){var e;const n=(e=this.remoteConnection)===null||e===void 0?void 0:e.getUniversalLink();if(!n)throw new Error("No Universal Link available, please call eth_requestAccounts first.");return n}getChannelId(){var e,n;return(n=(e=this.remoteConnection)===null||e===void 0?void 0:e.getChannelConfig())===null||n===void 0?void 0:n.channelId}getRPCHistory(){var e,n;return(n=(e=this.remoteConnection)===null||e===void 0?void 0:e.getConnector())===null||n===void 0?void 0:n.getRPCMethodTracker()}getVersion(){return Hn.version}getDappId(){var e,n,r,i;return typeof window>"u"||window.location===void 0?(i=(n=(e=this.options.dappMetadata)===null||e===void 0?void 0:e.name)!==null&&n!==void 0?n:(r=this.options.dappMetadata)===null||r===void 0?void 0:r.url)!==null&&i!==void 0?i:"N/A":window.location.hostname}getAnonId(){var e,n;return J(this,void 0,void 0,(function*(){if(this._anonId)return this._anonId;let r;return r=!((e=this.platformManager)===null||e===void 0)&&e.isBrowser()?this.getBrowserAnonId():!((n=this.platformManager)===null||n===void 0)&&n.isReactNative()?yield this.getReactNativeAnonId():yn(),this._anonId=r,r}))}getBrowserAnonId(){const e=this.ANON_ID_STORAGE_KEY;try{const n=localStorage.getItem(e);if(n)return n;const r=yn();return localStorage.setItem(e,r),r}catch(n){return console.error("[MetaMaskSDK: getBrowserAnonId()] LocalStorage access error:",n),yn()}}getReactNativeAnonId(){return J(this,void 0,void 0,(function*(){const e=this.ANON_ID_STORAGE_KEY;try{const n=require("@react-native-async-storage/async-storage").default,r=yield n.getItem(e);if(r)return r;const i=yn();return yield n.setItem(e,i),i}catch(n){return console.error("[MetaMaskSDK: getReactNativeAnonId()] Error accessing AsyncStorage:",n),yn()}}))}getWalletStatus(){var e,n;return(n=(e=this.remoteConnection)===null||e===void 0?void 0:e.getConnector())===null||n===void 0?void 0:n.getConnectionStatus()}_getChannelConfig(){var e;return(e=this.remoteConnection)===null||e===void 0?void 0:e.getChannelConfig()}_ping(){var e,n;(n=(e=this.remoteConnection)===null||e===void 0?void 0:e.getConnector())===null||n===void 0||n.ping()}_keyCheck(){var e,n;(n=(e=this.remoteConnection)===null||e===void 0?void 0:e.getConnector())===null||n===void 0||n.keyCheck()}_getServiceStatus(){var e,n;return(n=(e=this.remoteConnection)===null||e===void 0?void 0:e.getConnector())===null||n===void 0?void 0:n.getServiceStatus()}_getRemoteConnection(){return this.remoteConnection}_getDappMetadata(){return this.dappMetadata}_getKeyInfo(){var e;return(e=this.remoteConnection)===null||e===void 0?void 0:e.getKeyInfo()}_resetKeys(){var e,n;(n=(e=this.remoteConnection)===null||e===void 0?void 0:e.getConnector())===null||n===void 0||n.resetKeys()}_getConnection(){return this.remoteConnection}emit(e,n){return super.emit(e,n)}on(e,n){return super.on(e,n)}}var _y=Object.freeze({__proto__:null,StorageManagerWeb:class{constructor({enabled:t}={enabled:!1}){this.enabled=!1,this.enabled=t}persistChannelConfig(t){return J(this,void 0,void 0,(function*(){const e=JSON.stringify(t);G(`[StorageManagerWeb: persistChannelConfig()] enabled=${this.enabled}`,t),localStorage.setItem(xs,e)}))}getPersistedChannelConfig(){return J(this,void 0,void 0,(function*(){let t;try{if(G(`[StorageManagerWeb: getPersistedChannelConfig()] enabled=${this.enabled}`),t=localStorage.getItem(xs),G("[StorageManagerWeb: getPersistedChannelConfig()]",t),!t)return;const e=JSON.parse(t);return G("[StorageManagerWeb: getPersistedChannelConfig()] channelConfig",e),e}catch(e){return void console.error("[StorageManagerWeb: getPersistedChannelConfig()] Can't find existing channel config",e)}}))}persistAccounts(t){return J(this,void 0,void 0,(function*(){G(`[StorageManagerWeb: persistAccounts()] enabled=${this.enabled}`,t);const e=JSON.stringify(t);localStorage.setItem(aa,e)}))}getCachedAccounts(){return J(this,void 0,void 0,(function*(){try{const t=localStorage.getItem(aa);return t?JSON.parse(t):[]}catch(t){throw console.error("[StorageManagerWeb: getCachedAccounts()] Error reading cached accounts",t),t}}))}persistChainId(t){return J(this,void 0,void 0,(function*(){G(`[StorageManagerWeb: persistChainId()] enabled=${this.enabled}`,t),localStorage.setItem(ca,t)}))}getCachedChainId(){return J(this,void 0,void 0,(function*(){try{const t=localStorage.getItem(ca);return t??void 0}catch(t){throw console.error("[StorageManagerWeb: getCachedChainId()] Error reading cached chainId",t),t}}))}terminate(){return J(this,void 0,void 0,(function*(){G(`[StorageManagerWeb: terminate()] enabled=${this.enabled}`),localStorage.removeItem(xs)}))}}});const Sy="hydrated",Cy=!1,ky=!0;var Ay=Object.defineProperty,Wa=new WeakMap,En=t=>Wa.get(t),Ga=(t,e)=>Wa.set(e.$lazyInstance$=t,e),hu=(t,e)=>e in t,Dn=(t,e)=>(0,console.error)(t,e),Ts=new Map,Wi=new Map,Sf="slot-fb{display:contents}slot-fb[hidden]{display:none}",Po=typeof window<"u"?window:{},Dt=Po.document||{head:{}},je={$flags$:0,$resourcesUrl$:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,n,r)=>t.addEventListener(e,n,r),rel:(t,e,n,r)=>t.removeEventListener(e,n,r),ce:(t,e)=>new CustomEvent(t,e)},Cf=(()=>{try{return new CSSStyleSheet,typeof new CSSStyleSheet().replaceSync=="function"}catch{}return!1})(),ua=!1,fu=[],kf=[],xy=(t,e)=>n=>{t.push(n),ua||(ua=!0,4&je.$flags$?Ya(da):je.raf(da))},pu=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(n){Dn(n)}t.length=0},da=()=>{pu(fu),pu(kf),(ua=fu.length>0)&&je.raf(da)},Ya=t=>(e=>Promise.resolve(e))().then(t),Ty=xy(kf),mu={},Za=t=>(t=typeof t)=="object"||t==="function";function Af(t){var e,n,r;return(r=(n=(e=t.head)==null?void 0:e.querySelector('meta[name="csp-nonce"]'))==null?void 0:n.getAttribute("content"))!=null?r:void 0}((t,e)=>{for(var n in e)Ay(t,n,{get:e[n],enumerable:!0})})({},{err:()=>xf,map:()=>My,ok:()=>ha,unwrap:()=>Ry,unwrapErr:()=>Oy});var ha=t=>({isOk:!0,isErr:!1,value:t}),xf=t=>({isOk:!1,isErr:!0,value:t});function My(t,e){if(t.isOk){const n=e(t.value);return n instanceof Promise?n.then((r=>ha(r))):ha(n)}if(t.isErr){const n=t.value;return xf(n)}throw"should never get here"}var Ja,Ry=t=>{if(t.isOk)return t.value;throw t.value},Oy=t=>{if(t.isErr)return t.value;throw t.value},Y=(t,e,...n)=>{let r=null,i=!1,o=!1;const c=[],s=l=>{for(let u=0;u<l.length;u++)r=l[u],Array.isArray(r)?s(r):r!=null&&typeof r!="boolean"&&((i=typeof t!="function"&&!Za(r))&&(r=String(r)),i&&o?c[c.length-1].$text$+=r:c.push(i?Eo(null,r):r),o=i)};if(s(n),e){const l=e.className||e.class;l&&(e.class=typeof l!="object"?l:Object.keys(l).filter((u=>l[u])).join(" "))}if(typeof t=="function")return t(e===null?{}:e,c,Iy);const a=Eo(t,null);return a.$attrs$=e,c.length>0&&(a.$children$=c),a},Eo=(t,e)=>({$flags$:0,$tag$:t,$text$:e,$elm$:null,$children$:null,$attrs$:null}),Py={},Iy={forEach:(t,e)=>t.map(gu).forEach(e),map:(t,e)=>t.map(gu).map(e).map(Ly)},gu=t=>({vattrs:t.$attrs$,vchildren:t.$children$,vkey:t.$key$,vname:t.$name$,vtag:t.$tag$,vtext:t.$text$}),Ly=t=>{if(typeof t.vtag=="function"){const n={...t.vattrs};return t.vkey&&(n.key=t.vkey),t.vname&&(n.name=t.vname),Y(t.vtag,n,...t.vchildren||[])}const e=Eo(t.vtag,t.vtext);return e.$attrs$=t.vattrs,e.$children$=t.vchildren,e.$key$=t.vkey,e.$name$=t.vname,e},Io=t=>En(t).$hostElement$,Cn=(t,e,n)=>{const r=Io(t);return{emit:i=>Tf(r,e,{bubbles:!0,composed:!0,cancelable:!0,detail:i})}},Tf=(t,e,n)=>{const r=je.ce(e,n);return t.dispatchEvent(r),r},yu=new WeakMap,Ny=t=>{const e=t.$cmpMeta$,n=t.$hostElement$,r=e.$flags$;e.$tagName$;const i=((o,c,s)=>{var a;const l=Mf(c),u=Wi.get(l);if(o=o.nodeType===11?o:Dt,u)if(typeof u=="string"){o=o.head||o;let d,h=yu.get(o);if(h||yu.set(o,h=new Set),!h.has(l)){{d=Dt.createElement("style"),d.innerHTML=u;const f=(a=je.$nonce$)!=null?a:Af(Dt);if(f!=null&&d.setAttribute("nonce",f),!(1&c.$flags$))if(o.nodeName==="HEAD"){const m=o.querySelectorAll("link[rel=preconnect]"),g=m.length>0?m[m.length-1].nextSibling:o.querySelector("style");o.insertBefore(d,g)}else if("host"in o)if(Cf){const m=new CSSStyleSheet;m.replaceSync(u),o.adoptedStyleSheets=[m,...o.adoptedStyleSheets]}else{const m=o.querySelector("style");m?m.innerHTML=u+m.innerHTML:o.prepend(d)}else o.append(d);1&c.$flags$&&o.nodeName!=="HEAD"&&o.insertBefore(d,null)}4&c.$flags$&&(d.innerHTML+=Sf),h&&h.add(l)}}else o.adoptedStyleSheets.includes(u)||(o.adoptedStyleSheets=[...o.adoptedStyleSheets,u]);return l})(n.shadowRoot?n.shadowRoot:n.getRootNode(),e);10&r&&2&r&&(n["s-sc"]=i,n.classList.add(i+"-h"))},Mf=(t,e)=>"sc-"+t.$tagName$,vu=(t,e,n,r,i,o)=>{if(n!==r){let c=hu(t,e),s=e.toLowerCase();if(e==="class"){const a=t.classList,l=bu(n),u=bu(r);a.remove(...l.filter((d=>d&&!u.includes(d)))),a.add(...u.filter((d=>d&&!l.includes(d))))}else if(e==="style"){for(const a in n)r&&r[a]!=null||(a.includes("-")?t.style.removeProperty(a):t.style[a]="");for(const a in r)n&&r[a]===n[a]||(a.includes("-")?t.style.setProperty(a,r[a]):t.style[a]=r[a])}else if(c||e[0]!=="o"||e[1]!=="n"){const a=Za(r);if((c||a&&r!==null)&&!i)try{if(t.tagName.includes("-"))t[e]=r;else{const l=r??"";e==="list"?c=!1:n!=null&&t[e]==l||(typeof t.__lookupSetter__(e)=="function"?t[e]=l:t.setAttribute(e,l))}}catch{}r==null||r===!1?r===!1&&t.getAttribute(e)!==""||t.removeAttribute(e):(!c||4&o||i)&&!a&&(r=r===!0?"":r,t.setAttribute(e,r))}else if(e=e[2]==="-"?e.slice(3):hu(Po,s)?s.slice(2):s[2]+e.slice(3),n||r){const a=e.endsWith(Rf);e=e.replace(By,""),n&&je.rel(t,e,n,a),r&&je.ael(t,e,r,a)}}},Dy=/\s/,bu=t=>t?t.split(Dy):[],Rf="Capture",By=new RegExp(Rf+"$"),Of=(t,e,n)=>{const r=e.$elm$.nodeType===11&&e.$elm$.host?e.$elm$.host:e.$elm$,i=t&&t.$attrs$||mu,o=e.$attrs$||mu;for(const c of wu(Object.keys(i)))c in o||vu(r,c,i[c],void 0,n,e.$flags$);for(const c of wu(Object.keys(o)))vu(r,c,i[c],o[c],n,e.$flags$)};function wu(t){return t.includes("ref")?[...t.filter((e=>e!=="ref")),"ref"]:t}var yt=!1,Xa=(t,e,n,r)=>{const i=e.$children$[n];let o,c,s=0;if(i.$text$!==null)o=i.$elm$=Dt.createTextNode(i.$text$);else{if(yt||(yt=i.$tag$==="svg"),o=i.$elm$=Dt.createElementNS(yt?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",i.$tag$),yt&&i.$tag$==="foreignObject"&&(yt=!1),Of(null,i,yt),o.getRootNode().querySelector("body"),i.$children$)for(s=0;s<i.$children$.length;++s)c=Xa(t,i,s),c&&o.appendChild(c);i.$tag$==="svg"?yt=!1:o.tagName==="foreignObject"&&(yt=!0)}return o["s-hn"]=Ja,o},Eu=(t,e,n,r,i,o)=>{let c,s=t;for(s.shadowRoot&&s.tagName===Ja&&(s=s.shadowRoot);i<=o;++i)r[i]&&(c=Xa(null,n,i),c&&(r[i].$elm$=c,Gi(s,c,e)))},_u=(t,e,n)=>{for(let r=e;r<=n;++r){const i=t[r];if(i){const o=i.$elm$;o&&o.remove()}}},xi=(t,e,n=!1)=>t.$tag$===e.$tag$,kr=(t,e,n=!1)=>{const r=e.$elm$=t.$elm$,i=t.$children$,o=e.$children$,c=e.$tag$,s=e.$text$;s===null?(Of(t,e,yt=c==="svg"||c!=="foreignObject"&&yt),i!==null&&o!==null?((a,l,u,d,h=!1)=>{let f,m=0,g=0,w=l.length-1,p=l[0],C=l[w],_=d.length-1,P=d[0],L=d[_];for(;m<=w&&g<=_;)p==null?p=l[++m]:C==null?C=l[--w]:P==null?P=d[++g]:L==null?L=d[--_]:xi(p,P,h)?(kr(p,P,h),p=l[++m],P=d[++g]):xi(C,L,h)?(kr(C,L,h),C=l[--w],L=d[--_]):xi(p,L,h)?(kr(p,L,h),Gi(a,p.$elm$,C.$elm$.nextSibling),p=l[++m],L=d[--_]):xi(C,P,h)?(kr(C,P,h),Gi(a,C.$elm$,p.$elm$),C=l[--w],P=d[++g]):(f=Xa(l&&l[g],u,g),P=d[++g],f&&Gi(p.$elm$.parentNode,f,p.$elm$));m>w?Eu(a,d[_+1]==null?null:d[_+1].$elm$,u,d,g,_):g>_&&_u(l,m,w)})(r,i,e,o,n):o!==null?(t.$text$!==null&&(r.textContent=""),Eu(r,null,e,o,0,o.length-1)):!n&&ky&&i!==null&&_u(i,0,i.length-1),yt&&c==="svg"&&(yt=!1)):t.$text$!==s&&(r.data=s)},Gi=(t,e,n)=>t==null?void 0:t.insertBefore(e,n),$y=(t,e,n=!1)=>{const r=t.$hostElement$,i=t.$cmpMeta$,o=t.$vnode$||Eo(null,null),c=(s=e)&&s.$tag$===Py?e:Y(null,null,e);var s;if(Ja=r.tagName,n&&c.$attrs$)for(const a of Object.keys(c.$attrs$))r.hasAttribute(a)&&!["key","ref","style","class"].includes(a)&&(c.$attrs$[a]=r[a]);c.$tag$=null,c.$flags$|=4,t.$vnode$=c,c.$elm$=o.$elm$=r.shadowRoot||r,r["s-sc"],1&i.$flags$,kr(o,c,n)},Pf=(t,e)=>{e&&!t.$onRenderResolve$&&e["s-p"]&&e["s-p"].push(new Promise((n=>t.$onRenderResolve$=n)))},Qa=(t,e)=>(t.$flags$|=16,4&t.$flags$?void(t.$flags$|=512):(Pf(t,t.$ancestorComponent$),Ty((()=>Ky(t,e))))),Ky=(t,e)=>{const n=t.$hostElement$;t.$cmpMeta$.$tagName$;const r=t.$lazyInstance$;if(!r)throw new Error(`Can't render component <${n.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);return jy(void 0,(()=>Hy(t,r,e)))},jy=(t,e)=>Uy(t)?t.then(e).catch((n=>{console.error(n),e()})):e(),Uy=t=>t instanceof Promise||t&&t.then&&typeof t.then=="function",Hy=async(t,e,n)=>{var r;const i=t.$hostElement$;t.$cmpMeta$.$tagName$;const o=i["s-rc"];n&&Ny(t),t.$cmpMeta$.$tagName$,Fy(t,e,i,n),o&&(o.map((c=>c())),i["s-rc"]=void 0);{const c=(r=i["s-p"])!=null?r:[],s=()=>qy(t);c.length===0?s():(Promise.all(c).then(s),t.$flags$|=4,c.length=0)}},Fy=(t,e,n,r)=>{try{e=e.render(),t.$flags$&=-17,t.$flags$|=2,$y(t,e,r)}catch(i){Dn(i,t.$hostElement$)}return null},qy=t=>{t.$cmpMeta$.$tagName$;const e=t.$hostElement$,n=()=>{},r=t.$lazyInstance$,i=t.$ancestorComponent$;64&t.$flags$?n():(t.$flags$|=64,Lf(e),ec(r,"componentDidLoad"),t.$onReadyResolve$(e),i||If()),t.$onRenderResolve$&&(t.$onRenderResolve$(),t.$onRenderResolve$=void 0),512&t.$flags$&&Ya((()=>Qa(t,!1))),t.$flags$&=-517},If=t=>{Lf(Dt.documentElement),Ya((()=>Tf(Po,"appload",{detail:{namespace:"sdk-install-modal-web"}})))},ec=(t,e,n)=>{if(t&&t[e])try{return t[e](n)}catch(r){Dn(r)}},Lf=t=>{var e;return t.classList.add((e=Sy)!=null?e:"hydrated")},zy=(t,e,n,r)=>{const i=En(t);if(!i)throw new Error(`Couldn't find host element for "${r.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/ionic-team/stencil/issues/5457).`);const o=i.$hostElement$,c=i.$instanceValues$.get(e),s=i.$flags$,a=i.$lazyInstance$;var l,u;l=n,u=r.$members$[e][0],n=l==null||Za(l)?l:4&u?l!=="false"&&(l===""||!!l):1&u?String(l):l;const d=Number.isNaN(c)&&Number.isNaN(n);if((!(8&s)||c===void 0)&&n!==c&&!d&&(i.$instanceValues$.set(e,n),a)){if(r.$watchers$&&128&s){const h=r.$watchers$[e];h&&h.map((f=>{try{a[f](n,c,e)}catch(m){Dn(m,o)}}))}(18&s)==2&&Qa(i,!1)}},Nf=(t,e,n)=>{var r,i;const o=t.prototype;if(e.$members$||e.$watchers$||t.watchers){t.watchers&&!e.$watchers$&&(e.$watchers$=t.watchers);const c=Object.entries((r=e.$members$)!=null?r:{});if(c.map((([s,[a]])=>{(31&a||2&n&&32&a)&&Object.defineProperty(o,s,{get(){return l=s,En(this).$instanceValues$.get(l);var l},set(l){zy(this,s,l,e)},configurable:!0,enumerable:!0})})),1&n){const s=new Map;o.attributeChangedCallback=function(a,l,u){je.jmp((()=>{var d;const h=s.get(a);if(this.hasOwnProperty(h))u=this[h],delete this[h];else{if(o.hasOwnProperty(h)&&typeof this[h]=="number"&&this[h]==u)return;if(h==null){const f=En(this),m=f==null?void 0:f.$flags$;if(m&&!(8&m)&&128&m&&u!==l){const g=f.$lazyInstance$,w=(d=e.$watchers$)==null?void 0:d[a];w==null||w.forEach((p=>{g[p]!=null&&g[p].call(g,u,l,a)}))}return}}this[h]=(u!==null||typeof this[h]!="boolean")&&u}))},t.observedAttributes=Array.from(new Set([...Object.keys((i=e.$watchers$)!=null?i:{}),...c.filter((([a,l])=>15&l[0])).map((([a,l])=>{const u=l[1]||a;return s.set(u,a),u}))]))}}return t},Vy=async(t,e,n,r)=>{let i;if((32&e.$flags$)==0){if(e.$flags$|=32,n.$lazyBundleId$){const s=((a,l,u)=>{const d=a.$tagName$.replace(/-/g,"_"),h=a.$lazyBundleId$;if(!h)return;const f=Ts.get(h);if(f)return f[d];{const m=g=>(Ts.set(h,g),g[d]);if(h==="mm-install-modal_3")return Promise.resolve().then((function(){return av})).then(m,Dn)}return Yf(()=>import(`./${h}.entry.js`),[]).then((m=>(Ts.set(h,m),m[d])),Dn)})(n);if(s&&"then"in s?i=await s:i=s,!i)throw new Error(`Constructor for "${n.$tagName$}#${e.$modeName$}" was not found`);i.isProxied||(n.$watchers$=i.watchers,Nf(i,n,2),i.isProxied=!0),n.$tagName$,e.$flags$|=8;try{new i(e)}catch(a){Dn(a)}e.$flags$&=-9,e.$flags$|=128,fa(e.$lazyInstance$)}else{i=t.constructor;const s=t.localName;customElements.whenDefined(s).then((()=>e.$flags$|=128))}if(i&&i.style){let s;typeof i.style=="string"&&(s=i.style);const a=Mf(n);Wi.has(a)||(n.$tagName$,((l,u,d)=>{let h=Wi.get(l);Cf&&d?(h=h||new CSSStyleSheet,typeof h=="string"?h=u:h.replaceSync(u)):h=u,Wi.set(l,h)})(a,s,!!(1&n.$flags$)))}}const o=e.$ancestorComponent$,c=()=>Qa(e,!0);o&&o["s-rc"]?o["s-rc"].push(c):c()},fa=t=>{ec(t,"connectedCallback")},Su=t=>{ec(t,"disconnectedCallback")},Wy=(t,e={})=>{var n;const r=[],i=e.exclude||[],o=Po.customElements,c=Dt.head,s=c.querySelector("meta[charset]"),a=Dt.createElement("style"),l=[];let u,d=!0;Object.assign(je,e),je.$resourcesUrl$=new URL(e.resourcesUrl||"./",Dt.baseURI).href;let h=!1;if(t.map((f=>{f[1].map((m=>{var g;const w={$flags$:m[0],$tagName$:m[1],$members$:m[2],$listeners$:m[3]};4&w.$flags$&&(h=!0),w.$members$=m[2],w.$watchers$=(g=m[4])!=null?g:{};const p=w.$tagName$,C=class extends HTMLElement{constructor(_){if(super(_),this.hasRegisteredEventListeners=!1,((P,L)=>{const U={$flags$:0,$hostElement$:P,$cmpMeta$:L,$instanceValues$:new Map};U.$onReadyPromise$=new Promise((q=>U.$onReadyResolve$=q)),P["s-p"]=[],P["s-rc"]=[],Wa.set(P,U)})(_=this,w),1&w.$flags$)if(_.shadowRoot){if(_.shadowRoot.mode!=="open")throw new Error(`Unable to re-use existing shadow root for ${w.$tagName$}! Mode is set to ${_.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else _.attachShadow({mode:"open"})}connectedCallback(){En(this),this.hasRegisteredEventListeners||(this.hasRegisteredEventListeners=!0),u&&(clearTimeout(u),u=null),d?l.push(this):je.jmp((()=>(_=>{if((1&je.$flags$)==0){const P=En(_),L=P.$cmpMeta$;if(L.$tagName$,1&P.$flags$)P!=null&&P.$lazyInstance$?fa(P.$lazyInstance$):P!=null&&P.$onReadyPromise$&&P.$onReadyPromise$.then((()=>fa(P.$lazyInstance$)));else{P.$flags$|=1;{let U=_;for(;U=U.parentNode||U.host;)if(U["s-p"]){Pf(P,P.$ancestorComponent$=U);break}}L.$members$&&Object.entries(L.$members$).map((([U,[q]])=>{if(31&q&&_.hasOwnProperty(U)){const F=_[U];delete _[U],_[U]=F}})),Vy(_,P,L)}}})(this)))}disconnectedCallback(){je.jmp((()=>(async _=>{if((1&je.$flags$)==0){const P=En(_);P!=null&&P.$lazyInstance$?Su(P.$lazyInstance$):P!=null&&P.$onReadyPromise$&&P.$onReadyPromise$.then((()=>Su(P.$lazyInstance$)))}})(this)))}componentOnReady(){return En(this).$onReadyPromise$}};w.$lazyBundleId$=f[0],i.includes(p)||o.get(p)||(r.push(p),o.define(p,Nf(C,w,1)))}))})),r.length>0&&(h&&(a.textContent+=Sf),a.textContent+=r.sort()+"{visibility:hidden}.hydrated{visibility:inherit}",a.innerHTML.length)){a.setAttribute("data-styles","");const f=(n=je.$nonce$)!=null?n:Af(Dt);f!=null&&a.setAttribute("nonce",f),c.insertBefore(a,s?s.nextSibling:c.firstChild)}d=!1,l.length?l.map((f=>f.connectedCallback())):je.jmp((()=>u=setTimeout(If,30)))};(function(){if(typeof window<"u"&&window.Reflect!==void 0&&window.customElements!==void 0){var t=HTMLElement;window.HTMLElement=function(){return Reflect.construct(t,[],this.constructor)},HTMLElement.prototype=t.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,t)}})();var Gy=Object.freeze({__proto__:null,defineCustomElements:async(t,e)=>{if(typeof window<"u")return await void 0,Wy([["mm-install-modal_3",[[1,"mm-install-modal",{link:[1],sdkVersion:[1,"sdk-version"],preferDesktop:[4,"prefer-desktop"],tab:[32],isDefaultTab:[32],translationsLoaded:[32]},null,{preferDesktop:["updatePreferDesktop"]}],[1,"mm-pending-modal",{displayOTP:[4,"display-o-t-p"],sdkVersion:[1,"sdk-version"],otpCode:[1,"otp-code"],translationsLoaded:[32]}],[1,"mm-select-modal",{link:[1],sdkVersion:[1,"sdk-version"],preferDesktop:[4,"prefer-desktop"],tab:[32],isDefaultTab:[32],translationsLoaded:[32]},null,{preferDesktop:["updatePreferDesktop"]}]]]],e)},setNonce:t=>je.$nonce$=t});const Yy={fontFamily:"Roboto, sans-serif"},tc=({className:t},e)=>Y("div",{style:Yy,class:t},e),Ms=({Icon:t,text:e})=>Y("div",{class:"flexContainer",style:{padding:"6",flexDirection:"row"}},Y("div",{class:"flexItem1"},Y(t,null)),Y("div",{class:"flexItem11"},Y("span",{style:{lineHeight:"2",color:"black"}},e))),Zy=()=>Y("svg",{width:"20",height:"18",viewBox:"0 0 20 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Y("path",{d:"M20.0002 7.9702V10.0302C20.0002 10.5802 19.5602 11.0302 19.0002 11.0502H17.0402C15.9602 11.0502 14.9702 10.2602 14.8802 9.1802C14.8202 8.5502 15.0602 7.9602 15.4802 7.5502C15.8502 7.1702 16.3602 6.9502 16.9202 6.9502H19.0002C19.5602 6.9702 20.0002 7.4202 20.0002 7.9702Z",fill:"#037DD6"}),Y("path",{d:"M18.47 12.55H17.04C15.14 12.55 13.54 11.12 13.38 9.3C13.29 8.26 13.67 7.22 14.43 6.48C15.07 5.82 15.96 5.45 16.92 5.45H18.47C18.76 5.45 19 5.21 18.97 4.92C18.75 2.49 17.14 0.83 14.75 0.55C14.51 0.51 14.26 0.5 14 0.5H5C4.72 0.5 4.45 0.52 4.19 0.56C1.64 0.88 0 2.78 0 5.5V12.5C0 15.26 2.24 17.5 5 17.5H14C16.8 17.5 18.73 15.75 18.97 13.08C19 12.79 18.76 12.55 18.47 12.55ZM11 6.75H5C4.59 6.75 4.25 6.41 4.25 6C4.25 5.59 4.59 5.25 5 5.25H11C11.41 5.25 11.75 5.59 11.75 6C11.75 6.41 11.41 6.75 11 6.75Z",fill:"#037DD6"})),Jy=()=>Y("svg",{width:"20",height:"18",viewBox:"0 0 20 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Y("path",{d:"M14.44 0.0999756C12.63 0.0999756 11.01 0.979976 10 2.32998C8.99 0.979976 7.37 0.0999756 5.56 0.0999756C2.49 0.0999756 0 2.59998 0 5.68998C0 6.87998 0.19 7.97998 0.52 8.99998C2.1 14 6.97 16.99 9.38 17.81C9.72 17.93 10.28 17.93 10.62 17.81C13.03 16.99 17.9 14 19.48 8.99998C19.81 7.97998 20 6.87998 20 5.68998C20 2.59998 17.51 0.0999756 14.44 0.0999756Z",fill:"#037DD6"})),Xy=()=>Y("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Y("path",{d:"M16.28 7.53V6.28C16.28 3.58 15.63 0 10 0C4.37 0 3.72 3.58 3.72 6.28V7.53C0.92 7.88 0 9.3 0 12.79V14.65C0 18.75 1.25 20 5.35 20H14.65C18.75 20 20 18.75 20 14.65V12.79C20 9.3 19.08 7.88 16.28 7.53ZM10 16.74C8.33 16.74 6.98 15.38 6.98 13.72C6.98 12.05 8.34 10.7 10 10.7C11.66 10.7 13.02 12.06 13.02 13.72C13.02 15.39 11.67 16.74 10 16.74ZM5.35 7.44C5.27 7.44 5.2 7.44 5.12 7.44V6.28C5.12 3.35 5.95 1.4 10 1.4C14.05 1.4 14.88 3.35 14.88 6.28V7.45C14.8 7.45 14.73 7.45 14.65 7.45H5.35V7.44Z",fill:"#037DD6"})),Qy=()=>Y("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Y("path",{d:"M16.4405 8.8999C20.0405 9.2099 21.5105 11.0599 21.5105 15.1099V15.2399C21.5105 19.7099 19.7205 21.4999 15.2505 21.4999H8.74047C4.27047 21.4999 2.48047 19.7099 2.48047 15.2399V15.1099C2.48047 11.0899 3.93047 9.2399 7.47047 8.9099",stroke:"white","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),Y("path",{d:"M12 2V14.88",stroke:"white","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),Y("path",{d:"M15.3504 12.6499L12.0004 15.9999L8.65039 12.6499",stroke:"white","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}));function nc({version:t}){return Y("div",{style:{textAlign:"center",color:"#BBC0C5",fontSize:"12"}},"SDK Version ",t?`v${t}`:"unknown")}const rc=()=>Y("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Y("rect",{width:"16",height:"16",fill:"white"}),Y("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2.40554 2.40554C2.94627 1.86482 3.82296 1.86482 4.36369 2.40554L8 6.04186L11.6363 2.40554C12.177 1.86482 13.0537 1.86482 13.5945 2.40554C14.1352 2.94627 14.1352 3.82296 13.5945 4.36369L9.95814 8L13.5945 11.6363C14.1352 12.177 14.1352 13.0537 13.5945 13.5945C13.0537 14.1352 12.177 14.1352 11.6363 13.5945L8 9.95814L4.36369 13.5945C3.82296 14.1352 2.94627 14.1352 2.40554 13.5945C1.86482 13.0537 1.86482 12.177 2.40554 11.6363L6.04186 8L2.40554 4.36369C1.86482 3.82296 1.86482 2.94627 2.40554 2.40554Z",fill:"#BBC0C5"})),ic=()=>Y("svg",{width:"120",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 127 63"},Y("path",{fill:"currentColor",d:"M71.554 48.607v13.81h-7.072v-9.568l-8.059.945c-1.77.205-2.548.79-2.548 1.864 0 1.575 1.478 2.239 4.648 2.239 1.932 0 4.073-.29 5.963-.79l-3.66 5.225c-1.479.332-2.92.496-4.44.496-6.414 0-10.074-2.57-10.074-7.132 0-4.023 2.877-6.136 9.416-6.884l8.638-1.012c-.467-2.532-2.362-3.633-6.13-3.633-3.537 0-7.443.912-10.937 2.613l1.111-6.18c3.248-1.369 6.95-2.074 10.69-2.074 8.226 0 12.461 3.444 12.461 10.075l-.008.005ZM7.938 31.315.208 62.416h7.73l3.836-15.628 6.65 8.039h8.06l6.65-8.039 3.836 15.628h7.73l-7.73-31.105-14.518 17.388L7.934 31.311l.004.004ZM36.97.21 22.452 17.598 7.938.21.208 31.315h7.73l3.836-15.628 6.65 8.039h8.06l6.65-8.039 3.836 15.628h7.73L36.97.21Zm53.17 48.107-6.25-.912c-1.562-.247-2.178-.747-2.178-1.617 0-1.41 1.52-2.032 4.647-2.032 3.62 0 6.868.747 10.283 2.364l-.862-6.094c-2.757-.995-5.922-1.491-9.212-1.491-7.688 0-11.886 2.696-11.886 7.547 0 3.776 2.303 5.889 7.196 6.636l6.335.954c1.603.248 2.261.87 2.261 1.865 0 1.41-1.478 2.074-4.481 2.074-3.948 0-8.225-.953-11.72-2.654l.7 6.094c3.003 1.122 6.91 1.785 10.57 1.785 7.896 0 12.007-2.78 12.007-7.715 0-3.94-2.303-6.057-7.4-6.8l-.01-.004ZM100.3 34.09v28.325h7.071V34.091H100.3Zm15.334 15.595 9.833-10.744h-8.8l-9.296 11.114 9.912 12.356h8.925l-10.574-12.73v.004Zm-16.321-25.09c0 4.56 3.66 7.13 10.074 7.13 1.52 0 2.961-.167 4.44-.495l3.66-5.225c-1.89.496-4.031.79-5.963.79-3.166 0-4.648-.664-4.648-2.239 0-1.079.783-1.659 2.549-1.864l8.058-.945v9.567h7.072v-13.81c0-6.635-4.236-10.075-12.461-10.075-3.744 0-7.442.705-10.691 2.075l-1.112 6.178c3.495-1.701 7.401-2.613 10.937-2.613 3.769 0 5.664 1.1 6.13 3.633l-8.637 1.013c-6.539.747-9.417 2.86-9.417 6.883l.009-.004Zm-19.779-1.492c0 5.725 3.29 8.627 9.787 8.627 2.59 0 4.732-.416 6.785-1.37l.903-6.261c-1.974 1.2-3.99 1.822-6.005 1.822-3.044 0-4.402-1.243-4.402-4.023v-8.295h10.732V7.84H86.601V2.948l-13.448 7.174v3.482h6.372V23.1l.008.004Zm-6.95-2.612v1.411H53.47c.862 2.873 3.423 4.187 7.97 4.187 3.62 0 6.993-.747 9.992-2.196l-.862 6.056c-2.757 1.16-6.251 1.785-9.829 1.785-9.5 0-14.68-4.23-14.68-12.066 0-7.838 5.264-12.235 13.406-12.235s13.119 4.771 13.119 13.062l-.005-.004ZM53.378 17.09h12.086c-.637-2.751-2.732-4.188-6.08-4.188-3.349 0-5.335 1.399-6.006 4.188Z"}));function Mn(t,e){return t.toString(2).padStart(e,"0")}function Cu(t,e){const n=t%e;return n>=0?n:e+n}function lt(t,e){return new Array(t).fill(e)}function ku(...t){let e=0;for(const r of t)e=Math.max(e,r.length);const n=[];for(let r=0;r<e;r++)for(const i of t)r>=i.length||n.push(i[r]);return new Uint8Array(n)}function Au(t,e,n){if(n<0||n+e.length>t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[n+r])return!1;return!0}function xu(t){return{has:e=>t.includes(e),decode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="string")throw new Error("alphabet.decode input should be array of strings");return e.map((n=>{if(typeof n!="string")throw new Error(`alphabet.decode: not string element=${n}`);const r=t.indexOf(n);if(r===-1)throw new Error(`Unknown letter: "${n}". Allowed: ${t}`);return r}))},encode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return e.map((n=>{if((function(r){if(!Number.isSafeInteger(r))throw new Error(`Wrong integer: ${r}`)})(n),n<0||n>=t.length)throw new Error(`Digit index outside alphabet: ${n} (alphabet: ${t.length})`);return t[n]}))}}}class at{static size(e,n){if(typeof e=="number"&&(e={height:e,width:e}),!Number.isSafeInteger(e.height)&&e.height!==1/0)throw new Error(`Bitmap: wrong height=${e.height} (${typeof e.height})`);if(!Number.isSafeInteger(e.width)&&e.width!==1/0)throw new Error(`Bitmap: wrong width=${e.width} (${typeof e.width})`);return n!==void 0&&(e={width:Math.min(e.width,n.width),height:Math.min(e.height,n.height)}),e}static fromString(e){const n=(e=e.replace(/^\n+/g,"").replace(/\n+$/g,"")).split(`
|
|
35
|
+
`),r=n.length,i=new Array(r);let o;for(const c of n){const s=c.split("").map((a=>{if(a==="X")return!0;if(a===" ")return!1;if(a!=="?")throw new Error(`Bitmap.fromString: unknown symbol=${a}`)}));if(o&&s.length!==o)throw new Error(`Bitmap.fromString different row sizes: width=${o} cur=${s.length}`);o=s.length,i.push(s)}return o||(o=0),new at({height:r,width:o},i)}constructor(e,n){const{height:r,width:i}=at.size(e);this.data=n||Array.from({length:r},(()=>lt(i,void 0))),this.height=r,this.width=i}point(e){return this.data[e.y][e.x]}isInside(e){return 0<=e.x&&e.x<this.width&&0<=e.y&&e.y<this.height}size(e){if(!e)return{height:this.height,width:this.width};const{x:n,y:r}=this.xy(e);return{height:this.height-r,width:this.width-n}}xy(e){if(typeof e=="number"&&(e={x:e,y:e}),!Number.isSafeInteger(e.x))throw new Error(`Bitmap: wrong x=${e.x}`);if(!Number.isSafeInteger(e.y))throw new Error(`Bitmap: wrong y=${e.y}`);return e.x=Cu(e.x,this.width),e.y=Cu(e.y,this.height),e}rect(e,n,r){const{x:i,y:o}=this.xy(e),{height:c,width:s}=at.size(n,this.size({x:i,y:o}));for(let a=0;a<c;a++)for(let l=0;l<s;l++)this.data[o+a][i+l]=typeof r=="function"?r({x:l,y:a},this.data[o+a][i+l]):r;return this}rectRead(e,n,r){return this.rect(e,n,((i,o)=>(r(i,o),o)))}hLine(e,n,r){return this.rect(e,{width:n,height:1},r)}vLine(e,n,r){return this.rect(e,{width:1,height:n},r)}border(e=2,n){const r=this.height+2*e,i=this.width+2*e,o=lt(e,n),c=Array.from({length:e},(()=>lt(i,n)));return new at({height:r,width:i},[...c,...this.data.map((s=>[...o,...s,...o])),...c])}embed(e,n){return this.rect(e,n.size(),(({x:r,y:i})=>n.data[i][r]))}rectSlice(e,n=this.size()){const r=new at(at.size(n,this.size(this.xy(e))));return this.rect(e,n,(({x:i,y:o},c)=>r.data[o][i]=c)),r}inverse(){const{height:e,width:n}=this;return new at({height:n,width:e}).rect({x:0,y:0},1/0,(({x:r,y:i})=>this.data[r][i]))}scale(e){if(!Number.isSafeInteger(e)||e>1024)throw new Error(`Wrong scale factor: ${e}`);const{height:n,width:r}=this;return new at({height:e*n,width:e*r}).rect({x:0,y:0},1/0,(({x:i,y:o})=>this.data[Math.floor(o/e)][Math.floor(i/e)]))}clone(){return new at(this.size()).rect({x:0,y:0},this.size(),(({x:e,y:n})=>this.data[n][e]))}assertDrawn(){this.rectRead(0,1/0,((e,n)=>{if(typeof n!="boolean")throw new Error("Invalid color type="+typeof n)}))}toString(){return this.data.map((e=>e.map((n=>n===void 0?"?":n?"X":" ")).join(""))).join(`
|
|
36
|
+
`)}toASCII(){const{height:e,width:n,data:r}=this;let i="";for(let o=0;o<e;o+=2){for(let c=0;c<n;c++){const s=r[o][c],a=o+1>=e||r[o+1][c];s||a?!s&&a?i+="▀":s&&!a?i+="▄":s&&a&&(i+=" "):i+="█"}i+=`
|
|
37
|
+
`}return i}toTerm(){const e="\x1B[0m",n=`\x1B[1;47m ${e}`,r=`\x1B[40m ${e}`;return this.data.map((i=>i.map((o=>o?r:n)).join(""))).join(`
|
|
38
|
+
`)}toSVG(){let e=`<svg xmlns:svg="http://www.w3.org/2000/svg" viewBox="0 0 ${this.width} ${this.height}" version="1.1" xmlns="http://www.w3.org/2000/svg">`;return this.rectRead(0,1/0,(({x:n,y:r},i)=>{i&&(e+=`<rect x="${n}" y="${r}" width="1" height="1" />`)})),e+="</svg>",e}toGIF(){const e=s=>[255&s,s>>>8&255],n=[...e(this.width),...e(this.height)],r=[];this.rectRead(0,1/0,((s,a)=>r.push(+(a===!0))));const i=126,o=[71,73,70,56,55,97,...n,246,0,0,255,255,255,...lt(381,0),44,0,0,0,0,...n,0,7],c=Math.floor(r.length/i);for(let s=0;s<c;s++)o.push(127,128,...r.slice(i*s,i*(s+1)).map((a=>+a)));return o.push(r.length%i+1,128,...r.slice(c*i).map((s=>+s))),o.push(1,129,0,59),new Uint8Array(o)}toImage(e=!1){const{height:n,width:r}=this.size(),i=new Uint8Array(n*r*(e?3:4));let o=0;for(let c=0;c<n;c++)for(let s=0;s<r;s++){const a=this.data[c][s]?0:255;i[o++]=a,i[o++]=a,i[o++]=a,e||(i[o++]=255)}return{height:n,width:r,data:i}}}const Tu=["low","medium","quartile","high"],Mu=["numeric","alphanumeric","byte","kanji","eci"],ev=[26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706],tv={low:[7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],medium:[10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],quartile:[13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],high:[17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]},nv={low:[1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],medium:[1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],quartile:[1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],high:[1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]},We={size:{encode:t=>21+4*(t-1),decode:t=>(t-17)/4},sizeType:t=>Math.floor((t+7)/17),alignmentPatterns(t){if(t===1)return[];const e=We.size.encode(t)-6-1,n=e-6,r=Math.ceil(n/28);let i=Math.floor(n/r);i%2?i+=1:n%r*2>=r&&(i+=2);const o=[6];for(let c=1;c<r;c++)o.push(e-(r-c)*i);return o.push(e),o},ECCode:{low:1,medium:0,quartile:3,high:2},formatMask:21522,formatBits(t,e){const n=We.ECCode[t]<<3|e;let r=n;for(let i=0;i<10;i++)r=r<<1^1335*(r>>9);return(n<<10|r)^We.formatMask},versionBits(t){let e=t;for(let n=0;n<12;n++)e=e<<1^7973*(e>>11);return t<<12|e},alphabet:{numeric:xu("0123456789"),alphanumerc:xu("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:")},lengthBits:(t,e)=>({numeric:[10,12,14],alphanumeric:[9,11,13],byte:[8,16,16],kanji:[8,10,12],eci:[0,0,0]})[e][We.sizeType(t)],modeBits:{numeric:"0001",alphanumeric:"0010",byte:"0100",kanji:"1000",eci:"0111"},capacity(t,e){const n=ev[t-1],r=tv[e][t-1],i=nv[e][t-1],o=Math.floor(n/i)-r,c=i-n%i;return{words:r,numBlocks:i,shortBlocks:c,blockLen:o,capacity:8*(n-r*i),total:(r+o)*i+i-c}}},pa=[(t,e)=>(t+e)%2==0,(t,e)=>e%2==0,(t,e)=>t%3==0,(t,e)=>(t+e)%3==0,(t,e)=>(Math.floor(e/2)+Math.floor(t/3))%2==0,(t,e)=>t*e%2+t*e%3==0,(t,e)=>(t*e%2+t*e%3)%2==0,(t,e)=>((t+e)%2+t*e%3)%2==0],ae={tables:(t=>{const e=lt(256,0),n=lt(256,0);for(let r=0,i=1;r<256;r++)e[r]=i,n[i]=r,i<<=1,256&i&&(i^=285);return{exp:e,log:n}})(),exp:t=>ae.tables.exp[t],log(t){if(t===0)throw new Error(`GF.log: wrong arg=${t}`);return ae.tables.log[t]%255},mul:(t,e)=>t===0||e===0?0:ae.tables.exp[(ae.tables.log[t]+ae.tables.log[e])%255],add:(t,e)=>t^e,pow:(t,e)=>ae.tables.exp[ae.tables.log[t]*e%255],inv(t){if(t===0)throw new Error(`GF.inverse: wrong arg=${t}`);return ae.tables.exp[255-ae.tables.log[t]]},polynomial(t){if(t.length==0)throw new Error("GF.polymomial: wrong length");if(t[0]!==0)return t;let e=0;for(;e<t.length-1&&t[e]==0;e++);return t.slice(e)},monomial(t,e){if(t<0)throw new Error(`GF.monomial: wrong degree=${t}`);if(e==0)return[0];let n=lt(t+1,0);return n[0]=e,ae.polynomial(n)},degree:t=>t.length-1,coefficient:(t,e)=>t[ae.degree(t)-e],mulPoly(t,e){if(t[0]===0||e[0]===0)return[0];const n=lt(t.length+e.length-1,0);for(let r=0;r<t.length;r++)for(let i=0;i<e.length;i++)n[r+i]=ae.add(n[r+i],ae.mul(t[r],e[i]));return ae.polynomial(n)},mulPolyScalar(t,e){if(e==0)return[0];if(e==1)return t;const n=lt(t.length,0);for(let r=0;r<t.length;r++)n[r]=ae.mul(t[r],e);return ae.polynomial(n)},mulPolyMonomial(t,e,n){if(e<0)throw new Error("GF.mulPolyMonomial: wrong degree");if(n==0)return[0];const r=lt(t.length+e,0);for(let i=0;i<t.length;i++)r[i]=ae.mul(t[i],n);return ae.polynomial(r)},addPoly(t,e){if(t[0]===0)return e;if(e[0]===0)return t;let n=t,r=e;n.length>r.length&&([n,r]=[r,n]);let i=lt(r.length,0),o=r.length-n.length,c=r.slice(0,o);for(let s=0;s<c.length;s++)i[s]=c[s];for(let s=o;s<r.length;s++)i[s]=ae.add(n[s-o],r[s]);return ae.polynomial(i)},remainderPoly(t,e){const n=Array.from(t);for(let r=0;r<t.length-e.length+1;r++){const i=n[r];if(i!==0)for(let o=1;o<e.length;o++)e[o]!==0&&(n[r+o]=ae.add(n[r+o],ae.mul(e[o],i)))}return n.slice(t.length-e.length+1,n.length)},divisorPoly(t){let e=[1];for(let n=0;n<t;n++)e=ae.mulPoly(e,[1,ae.pow(2,n)]);return e},evalPoly(t,e){if(e==0)return ae.coefficient(t,0);let n=t[0];for(let r=1;r<t.length;r++)n=ae.add(ae.mul(e,n),t[r]);return n},euclidian(t,e,n){ae.degree(t)<ae.degree(e)&&([t,e]=[e,t]);let r=t,i=e,o=[0],c=[1];for(;2*ae.degree(i)>=n;){let l=r,u=o;if(r=i,o=c,r[0]===0)throw new Error("rLast[0] === 0");i=l;let d=[0];const h=ae.inv(r[0]);for(;ae.degree(i)>=ae.degree(r)&&i[0]!==0;){const f=ae.degree(i)-ae.degree(r),m=ae.mul(i[0],h);d=ae.addPoly(d,ae.monomial(f,m)),i=ae.addPoly(i,ae.mulPolyMonomial(r,f,m))}if(d=ae.mulPoly(d,o),c=ae.addPoly(d,u),ae.degree(i)>=ae.degree(r))throw new Error(`Division failed r: ${i}, rLast: ${r}`)}const s=ae.coefficient(c,0);if(s==0)throw new Error("sigmaTilde(0) was zero");const a=ae.inv(s);return[ae.mulPolyScalar(c,a),ae.mulPolyScalar(i,a)]}};function rv(t,e){const{words:n,shortBlocks:r,numBlocks:i,blockLen:o,total:c}=We.capacity(t,e),s=(a=n,{encode(l){const u=ae.divisorPoly(a),d=Array.from(l);return d.push(...u.slice(0,-1).fill(0)),Uint8Array.from(ae.remainderPoly(d,u))},decode(l){const u=l.slice(),d=ae.polynomial(Array.from(l));let h=lt(a,0),f=!1;for(let _=0;_<a;_++){const P=ae.evalPoly(d,ae.exp(_));h[h.length-1-_]=P,P!==0&&(f=!0)}if(!f)return u;h=ae.polynomial(h);const m=ae.monomial(a,1),[g,w]=ae.euclidian(m,h,a),p=lt(ae.degree(g),0);let C=0;for(let _=1;_<256&&C<p.length;_++)ae.evalPoly(g,_)===0&&(p[C++]=ae.inv(_));if(C!==p.length)throw new Error("RS.decode: wrong errors number");for(let _=0;_<p.length;_++){const P=u.length-1-ae.log(p[_]);if(P<0)throw new Error("RS.decode: wrong error location");const L=ae.inv(p[_]);let U=1;for(let q=0;q<p.length;q++)_!==q&&(U=ae.mul(U,ae.add(1,ae.mul(p[q],L))));u[P]=ae.add(u[P],ae.mul(ae.evalPoly(w,L),ae.inv(U)))}return u}});var a;return{encode(l){const u=[],d=[];for(let g=0;g<i;g++){const w=o+(g<r?0:1);u.push(l.subarray(0,w)),d.push(s.encode(l.subarray(0,w))),l=l.subarray(w)}const h=ku(...u),f=ku(...d),m=new Uint8Array(h.length+f.length);return m.set(h),m.set(f,h.length),m},decode(l){if(l.length!==c)throw new Error(`interleave.decode: len(data)=${l.length}, total=${c}`);const u=[];for(let f=0;f<i;f++){const m=f<r;u.push(new Uint8Array(n+o+(m?0:1)))}let d=0;for(let f=0;f<o;f++)for(let m=0;m<i;m++)u[m][f]=l[d++];for(let f=r;f<i;f++)u[f][o]=l[d++];for(let f=o;f<o+n;f++)for(let m=0;m<i;m++){const g=m<r;u[m][f+(g?0:1)]=l[d++]}const h=[];for(const f of u)h.push(...Array.from(s.decode(f)).slice(0,-n));return Uint8Array.from(h)}}}function Ru(t,e,n,r){let i="",o=n.length;if(r==="numeric"){const d=We.alphabet.numeric.decode(n.split("")),h=d.length;for(let f=0;f<h-2;f+=3)i+=Mn(100*d[f]+10*d[f+1]+d[f+2],10);h%3==1?i+=Mn(d[h-1],4):h%3==2&&(i+=Mn(10*d[h-2]+d[h-1],7))}else if(r==="alphanumeric"){const d=We.alphabet.alphanumerc.decode(n.split("")),h=d.length;for(let f=0;f<h-1;f+=2)i+=Mn(45*d[f]+d[f+1],11);h%2==1&&(i+=Mn(d[h-1],6))}else{if(r!=="byte")throw new Error("encode: unsupported type");{const d=(function(h){if(typeof h!="string")throw new Error("utf8ToBytes expected string, got "+typeof h);return new Uint8Array(new TextEncoder().encode(h))})(n);o=d.length,i=Array.from(d).map((h=>Mn(h,8))).join("")}}const{capacity:c}=We.capacity(t,e),s=Mn(o,We.lengthBits(t,r));let a=We.modeBits[r]+s+i;if(a.length>c)throw new Error("Capacity overflow");a+="0".repeat(Math.min(4,Math.max(0,c-a.length))),a.length%8&&(a+="0".repeat(8-a.length%8));const l="1110110000010001";for(let d=0;a.length!==c;d++)a+=l[d%16];const u=Uint8Array.from(a.match(/(.{8})/g).map((d=>+`0b${d}`)));return rv(t,e).encode(u)}function Ou(t,e,n,r,i=!1){const o=(function(a,l,u,d=!1){const h=We.size.encode(a);let f=new at(h+2);const m=new at(3).rect(0,3,!0).border(1,!1).border(1,!0).border(1,!1);f=f.embed(0,m).embed({x:-m.width,y:0},m).embed({x:0,y:-m.height},m),f=f.rectSlice(1,h);const g=new at(1).rect(0,1,!0).border(1,!1).border(1,!0),w=We.alignmentPatterns(a);for(const p of w)for(const C of w)f.data[p][C]===void 0&&f.embed({x:C-2,y:p-2},g);f=f.hLine({x:0,y:6},1/0,(({x:p},C)=>C===void 0?p%2==0:C)).vLine({x:6,y:0},1/0,(({y:p},C)=>C===void 0?p%2==0:C));{const p=We.formatBits(l,u),C=_=>!d&&(p>>_&1)==1;for(let _=0;_<6;_++)f.data[_][8]=C(_);for(let _=6;_<8;_++)f.data[_+1][8]=C(_);for(let _=8;_<15;_++)f.data[h-15+_][8]=C(_);for(let _=0;_<8;_++)f.data[8][h-_-1]=C(_);for(let _=8;_<9;_++)f.data[8][15-_-1+1]=C(_);for(let _=9;_<15;_++)f.data[8][15-_-1]=C(_);f.data[h-8][8]=!d}if(a>=7){const p=We.versionBits(a);for(let C=0;C<18;C+=1){const _=!d&&(p>>C&1)==1,P=Math.floor(C/3),L=C%3+h-8-3;f.data[P][L]=_,f.data[L][P]=_}}return f})(t,e,r,i);let c=0;const s=8*n.length;if((function(a,l,u){const d=a.height,h=pa[l];let f=-1,m=d-1;for(let g=d-1;g>0;g-=2){for(g==6&&(g=5);;m+=f){for(let w=0;w<2;w+=1){const p=g-w;a.data[m][p]===void 0&&u(p,m,h(p,m))}if(m+f<0||m+f>=d)break}f=-f}})(o,r,((a,l,u)=>{let d=!1;c<s&&(d=(n[c>>>3]>>(7-c&7)&1)!=0,c++),o.data[l][a]=d!==u})),c!==s)throw new Error("QR: bytes left after draw");return o}function iv(t){const e=t.inverse(),n=f=>{let m=0;for(let g,w=0,p=1;w<f.length;w++)g===f[w]&&(p++,w!==f.length-1)||(p>=5&&(m+=p-5+3),g=f[w],p=1);return m};let r=0;t.data.forEach((f=>r+=n(f))),e.data.forEach((f=>r+=n(f)));let i=0,o=t.data;const c=t.width-1,s=t.height-1;for(let f=0;f<c;f++)for(let m=0;m<s;m++){const g=f+1,w=m+1;o[f][m]===o[g][m]&&o[g][m]===o[f][w]&&o[g][m]===o[g][w]&&(i+=3)}const a=f=>{const m=[!0,!1,!0,!0,!0,!1,!0],g=[!1,!1,!1,!1],w=[...m,...g],p=[...g,...m];let C=0;for(let _=0;_<f.length;_++)Au(f,w,_)&&(C+=40),Au(f,p,_)&&(C+=40);return C};let l=0;for(const f of t.data)l+=a(f);for(const f of e.data)l+=a(f);let u=0;t.rectRead(0,1/0,((f,m)=>u+=m?1:0));const d=u/(t.height*t.width)*100,h=10*Math.floor(Math.abs(d-50)/5);return r+i+l+h}function Df(t,e="raw",n={}){const r=n.ecc!==void 0?n.ecc:"medium";(function(u){if(!Tu.includes(u))throw new Error(`Invalid error correction mode=${u}. Expected: ${Tu}`)})(r);const i=n.encoding!==void 0?n.encoding:(function(u){let d="numeric";for(let h of u)if(!We.alphabet.numeric.has(h)&&(d="alphanumeric",!We.alphabet.alphanumerc.has(h)))return"byte";return d})(t);(function(u){if(!Mu.includes(u))throw new Error(`Encoding: invalid mode=${u}. Expected: ${Mu}`);if(u==="kanji"||u==="eci")throw new Error(`Encoding: ${u} is not supported (yet?).`)})(i),n.mask!==void 0&&(function(u){if(![0,1,2,3,4,5,6,7].includes(u)||!pa[u])throw new Error(`Invalid mask=${u}. Expected number [0..7]`)})(n.mask);let o,c=n.version,s=new Error("Unknown error");if(c!==void 0)(function(u){if(!Number.isSafeInteger(u)||u<1||u>40)throw new Error(`Invalid version=${u}. Expected number [1..40]`)})(c),o=Ru(c,r,t,i);else for(let u=1;u<=40;u++)try{o=Ru(u,r,t,i),c=u;break}catch(d){s=d}if(!c||!o)throw s;let a=(function(u,d,h,f){if(f===void 0){const m=(function(){let g,w=1/0;return{add(p,C){p>=w||(g=C,w=p)},get:()=>g,score:()=>w}})();for(let g=0;g<pa.length;g++)m.add(iv(Ou(u,d,h,g,!0)),g);f=m.get()}if(f===void 0)throw new Error("Cannot find mask");return Ou(u,d,h,f)})(c,r,o,n.mask);a.assertDrawn();const l=n.border===void 0?2:n.border;if(!Number.isSafeInteger(l))throw new Error("Wrong border type="+typeof l);if(a=a.border(l,!1),n.scale!==void 0&&(a=a.scale(n.scale)),e==="raw")return a.data;if(e==="ascii")return a.toASCII();if(e==="svg")return a.toSVG();if(e==="gif")return a.toGIF();if(e==="term")return a.toTerm();throw new Error(`Unknown output: ${e}`)}const Rs={DESKTOP:"Desktop",MOBILE:"Mobile",META_MASK_MOBILE_APP:"MetaMask mobile app",SCAN_TO_CONNECT:"Scan to connect and sign with",CONNECT_WITH_EXTENSION:"Connect With MetaMask Extension",INSTALL_MODAL:{TRUSTED_BY_USERS:"Trusted by over 30 million users to buy, store, send and swap crypto securely",LEADING_CRYPTO_WALLET:"The leading crypto wallet & gateway to blockchain apps built on Ethereum Mainnet, Polygon, Optimism, and many other networks",CONTROL_DIGITAL_INTERACTIONS:"Puts you in control of your digital interactions by making power of cryptography more accessible",INSTALL_META_MASK_EXTENSION:"Install MetaMask Extension"},PENDING_MODAL:{OPEN_META_MASK_SELECT_CODE:"Please open the MetaMask wallet app and select the code on the screen OR disconnect",OPEN_META_MASK_CONTINUE:"Open the MetaMask app to continue with your session.",NUMBER_AFTER_OPEN_NOTICE:"If a number doesn't appear after opening MetaMask, please click disconnect and re-scan the QRCode.",DISCONNECT:"Disconnect"},SELECT_MODAL:{CRYPTO_TAKE_CONTROL_TEXT:"Take control of your crypto and explore the blockchain with the wallet trusted by over 30 million people worldwide"},META_MASK_MODAL:{ADDRESS_COPIED:"Address copied to clipboard!",DISCONNECT:"Disconnect",ACTIVE_NETWORK:"Active Network"}};class oc{constructor(e){var n;this.translations=Rs,this.supportedLocales=["es","fr","he","it","pt","tr"],this.baseUrl=(n=e==null?void 0:e.baseUrl)!==null&&n!==void 0?n:"https://raw.githubusercontent.com/MetaMask/metamask-sdk/refs/heads/gh-pages/locales"}getBrowserLanguage(){if((navigator.languages||[navigator.language]).some((n=>n.toLowerCase().startsWith("en"))))return"en";const e=navigator.language.toLowerCase().split("-")[0];return this.supportedLocales.includes(e)?e:"en"}async init(e){const n=this.getBrowserLanguage()||e.fallbackLng;await this.loadTranslations(n)}async loadTranslations(e){const n=e.split("-")[0];if(n!=="en"&&this.supportedLocales.includes(n))try{const r=`${this.baseUrl}/${n}.json`,i=await fetch(r);if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);this.translations=await i.json()}catch(r){console.warn(`❌ Failed to load ${n} translations, falling back to English:`,r),this.translations=Rs}else this.translations=Rs}t(e){return this.getNestedTranslation(e,this.translations)||e}getNestedTranslation(e,n){const r=e.split(".");let i=n;for(const o of r){if(typeof i!="object")return"";i=i[o]}return typeof i=="string"?i:""}}var Ir;(function(t){t.SDK_MODAL_VIEWED="sdk_modal_viewed",t.SDK_MODAL_BUTTON_CLICKED="sdk_modal_button_clicked",t.SDK_MODAL_TOGGLE_CHANGED="sdk_modal_toggle_changed"})(Ir||(Ir={}));const Bf=class{constructor(t){Ga(this,t),this.close=Cn(this,"close"),this.startDesktopOnboarding=Cn(this,"startDesktopOnboarding"),this.trackAnalytics=Cn(this,"trackAnalytics"),this.link=void 0,this.sdkVersion=void 0,this.preferDesktop=void 0,this.tab=1,this.isDefaultTab=!0,this.translationsLoaded=!1,this.onClose=this.onClose.bind(this),this.onStartDesktopOnboardingHandler=this.onStartDesktopOnboardingHandler.bind(this),this.setTab=this.setTab.bind(this),this.render=this.render.bind(this),this.setTab(this.preferDesktop?1:2),this.i18nInstance=new oc}componentDidLoad(){this.trackAnalytics.emit({event:Ir.SDK_MODAL_VIEWED,params:{extensionInstalled:!1,tab:this.tab===1?"desktop":"mobile"}})}async connectedCallback(){await this.i18nInstance.init({fallbackLng:"en"}),this.translationsLoaded=!0}updatePreferDesktop(t){t?this.setTab(1):this.setTab(2)}onClose(t=!1){this.close.emit({shouldTerminate:t})}onStartDesktopOnboardingHandler(){this.trackAnalytics.emit({event:Ir.SDK_MODAL_BUTTON_CLICKED,params:{button_type:"install_extension",tab:"desktop"}}),this.startDesktopOnboarding.emit()}setTab(t,e=!1){e&&this.trackAnalytics.emit({event:Ir.SDK_MODAL_TOGGLE_CHANGED,params:{toggle:this.tab===1?"desktop_to_mobile":"mobile_to_desktop"}}),this.tab=t,this.isDefaultTab=!1}render(){if(!this.translationsLoaded)return null;const t=r=>this.i18nInstance.t(r),e=this.isDefaultTab?this.preferDesktop?1:2:this.tab,n=Df(this.link,"svg",{ecc:"medium",scale:2});return Y(tc,{className:"install-model"},Y("div",{class:"backdrop",onClick:()=>this.onClose(!0)}),Y("div",{class:"modal"},Y("div",{class:"closeButtonContainer"},Y("div",{class:"right"},Y("span",{class:"closeButton",onClick:()=>this.onClose(!0)},Y(rc,null)))),Y("div",{class:"logoContainer"},Y(ic,null)),Y("div",null,Y("div",{class:"tabcontainer"},Y("div",{class:"flexContainer"},Y("div",{onClick:()=>this.setTab(1,!0),class:"tab flexItem "+(e===1?"tabactive":"")},t("DESKTOP")),Y("div",{onClick:()=>this.setTab(2,!0),class:"tab flexItem "+(e===2?"tabactive":"")},t("MOBILE")))),Y("div",{style:{display:e===1?"none":"block"}},Y("div",{class:"flexContainer"},Y("div",{class:"flexItem",style:{textAlign:"center",marginTop:"4"}},n&&Y("div",{id:"sdk-mm-qrcode",class:"center",innerHTML:n}),Y("div",{class:"connectMobileText"},t("SCAN_TO_CONNECT")," ",Y("br",null),Y("span",{class:"blue"},Y("b",null,t("META_MASK_MOBILE_APP"))))))),Y("div",{style:{display:e===2?"none":"block"}},Y("div",{class:"item"},Y(Ms,{Icon:Jy,text:t("INSTALL_MODAL.TRUSTED_BY_USERS")})),Y("div",{class:"item"},Y(Ms,{Icon:Zy,text:t("INSTALL_MODAL.LEADING_CRYPTO_WALLET")})),Y("div",{class:"item"},Y(Ms,{Icon:Xy,text:t("INSTALL_MODAL.CONTROL_DIGITAL_INTERACTIONS")})),Y("button",{class:"button",onClick:()=>this.onStartDesktopOnboardingHandler()},Y(Qy,null),Y("span",{class:"installExtensionText"},t("INSTALL_MODAL.INSTALL_META_MASK_EXTENSION"))))),Y(nc,{version:this.sdkVersion})))}get el(){return Io(this)}static get watchers(){return{preferDesktop:["updatePreferDesktop"]}}};Bf.style=`.flexContainer {
|
|
39
|
+
display: flex;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
align-items: center;
|
|
42
|
+
flex-direction: row;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.flexItem {
|
|
46
|
+
flex: 1;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
align-items: center;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.flexItem11 {
|
|
52
|
+
flex: 11;
|
|
53
|
+
justify-content: center;
|
|
54
|
+
align-items: center;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.flexItem1 {
|
|
58
|
+
flex: 1;
|
|
59
|
+
justify-content: center;
|
|
60
|
+
align-items: center;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.tab {
|
|
64
|
+
padding: 8px;
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
background-color: #F2F4F6;
|
|
67
|
+
font-size: 12px;
|
|
68
|
+
text-align: center;
|
|
69
|
+
color: #24292E;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.tabcontainer {
|
|
73
|
+
padding: 4px;
|
|
74
|
+
background-color: #F2F4F6;
|
|
75
|
+
border-radius: 8px;
|
|
76
|
+
margin-bottom: 30px;
|
|
77
|
+
margin-top: 30px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.tabactive {
|
|
81
|
+
background-color: white;
|
|
82
|
+
-webkit-transition: background-color 300ms linear;
|
|
83
|
+
-ms-transition: background-color 300ms linear;
|
|
84
|
+
transition: background-color 300ms linear;
|
|
85
|
+
border-radius: 8px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.item {
|
|
89
|
+
font-size: 12px;
|
|
90
|
+
margin-bottom: 16px;
|
|
91
|
+
border-radius: 8px;
|
|
92
|
+
padding: 10px;
|
|
93
|
+
border: 2px #F2F4F6 solid;
|
|
94
|
+
color: #24292E;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.extensionLabel {
|
|
98
|
+
font-style: normal;
|
|
99
|
+
font-weight: bold;
|
|
100
|
+
font-size: 14px;
|
|
101
|
+
text-align: cetner;
|
|
102
|
+
color: #24272A;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.notice {
|
|
106
|
+
font-size: 12px;
|
|
107
|
+
margin-left: 10px;
|
|
108
|
+
margin-right: 10px;
|
|
109
|
+
color: grey;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.button {
|
|
113
|
+
margin-top: 41.5px;
|
|
114
|
+
margin-bottom: 20px;
|
|
115
|
+
width: 100%;
|
|
116
|
+
display: flex;
|
|
117
|
+
flex-direction: row;
|
|
118
|
+
justify-content: center;
|
|
119
|
+
align-items: center;
|
|
120
|
+
padding: 12px 20px;
|
|
121
|
+
background: #037DD6;
|
|
122
|
+
border-radius: 32px;
|
|
123
|
+
color: white;
|
|
124
|
+
border: 0;
|
|
125
|
+
font-size: 14px;
|
|
126
|
+
cursor: pointer;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.backdrop {
|
|
130
|
+
visibility: visible;
|
|
131
|
+
position: fixed;
|
|
132
|
+
top: 0;
|
|
133
|
+
left: 0;
|
|
134
|
+
right: 0;
|
|
135
|
+
bottom: 0;
|
|
136
|
+
width: 100%;
|
|
137
|
+
z-index: 99998;
|
|
138
|
+
background: rgba(0, 0, 0, 0.87);
|
|
139
|
+
opacity: 0.3;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.modal {
|
|
143
|
+
visibility: visible;
|
|
144
|
+
position: fixed;
|
|
145
|
+
left: 50%;
|
|
146
|
+
transform: translate(-50%, -50%);
|
|
147
|
+
z-index: 99999;
|
|
148
|
+
background: white;
|
|
149
|
+
padding: 20px;
|
|
150
|
+
border-radius: 8px;
|
|
151
|
+
top: 50%;
|
|
152
|
+
max-width: 100%;
|
|
153
|
+
width: 460px;
|
|
154
|
+
min-width: 300px;
|
|
155
|
+
box-shadow: rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px;
|
|
156
|
+
-webkit-font-smoothing: antialiased;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.closeButton {
|
|
160
|
+
color: #BBC0C5;
|
|
161
|
+
cursor: pointer;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.logoContainer {
|
|
165
|
+
margin-left: 24px;
|
|
166
|
+
margin-right: 24px;
|
|
167
|
+
margin-top: 24px;
|
|
168
|
+
display: flex;
|
|
169
|
+
align-items: center;
|
|
170
|
+
justify-content: center;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.connectMobileText {
|
|
174
|
+
font-size: 14px;
|
|
175
|
+
color: black;
|
|
176
|
+
margin-top: 28px;
|
|
177
|
+
margin-bottom: 28px;
|
|
178
|
+
line-height: 2;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.blue {
|
|
182
|
+
color: #037DD6;
|
|
183
|
+
font-weight: 700;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.installExtensionText {
|
|
187
|
+
margin-left: 10px;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.center {
|
|
191
|
+
display: flex;
|
|
192
|
+
justify-content: center;
|
|
193
|
+
align-items: center;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.right {
|
|
197
|
+
display: flex;
|
|
198
|
+
align-items: center;
|
|
199
|
+
justify-content: right;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
#sdk-mm-qrcode {
|
|
203
|
+
svg {
|
|
204
|
+
width: 50%;
|
|
205
|
+
}
|
|
206
|
+
}`;const $f=class{constructor(t){Ga(this,t),this.close=Cn(this,"close"),this.disconnect=Cn(this,"disconnect"),this.updateOTPValue=Cn(this,"updateOTPValue"),this.displayOTP=void 0,this.sdkVersion=void 0,this.otpCode=void 0,this.translationsLoaded=!1,this.i18nInstance=new oc}async connectedCallback(){await this.i18nInstance.init({fallbackLng:"en"}),this.translationsLoaded=!0}onClose(){this.close.emit()}onDisconnect(){this.disconnect.emit()}onUpdateOTPValueHandler(t){this.updateOTPValue.emit({otpValue:t})}disconnectedCallback(){this.onClose()}render(){var t;if(!this.translationsLoaded)return null;const e=(t=this.displayOTP)===null||t===void 0||t,n=this.sdkVersion,r=i=>this.i18nInstance.t(i);return Y(tc,{className:"pending-modal"},Y("div",{class:"backdrop",onClick:()=>this.onClose()}),Y("div",{class:"modal"},Y("div",{class:"closeButtonContainer"},Y("div",{class:"right"},Y("span",{class:"closeButton",onClick:()=>this.onClose()},Y(rc,null)))),Y("div",{class:"logoContainer"},Y(ic,null)),Y("div",null,Y("div",{class:"flexContainer",style:{flexDirection:"column",color:"black"}},Y("div",{class:"flexItem",style:{textAlign:"center",marginTop:"30px",marginBottom:"30px",fontSize:"16px"}},r(e?"PENDING_MODAL.OPEN_META_MASK_SELECT_CODE":"PENDING_MODAL.OPEN_META_MASK_CONTINUE")),Y("div",{id:"sdk-mm-otp-value",style:{padding:"10px",fontSize:"32px",display:this.otpCode?"block":"none"}},this.otpCode),e&&Y("div",{class:"notice"},"* ",r("PENDING_MODAL.NUMBER_AFTER_OPEN_NOTICE"))),Y("div",{style:{marginTop:"20px"}},Y("button",{class:"button blue",style:{marginTop:"5px",color:"#0376C9",borderColor:"#0376C9",borderWidth:"1px",borderStyle:"solid",backgroundColor:"white"},onClick:()=>this.onDisconnect()},r("PENDING_MODAL.DISCONNECT")))),Y(nc,{version:n})))}get el(){return Io(this)}};$f.style=`.flexContainer {
|
|
207
|
+
display: flex;
|
|
208
|
+
justify-content: center;
|
|
209
|
+
align-items: center;
|
|
210
|
+
flex-direction: row;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.flexItem {
|
|
214
|
+
flex: 1;
|
|
215
|
+
justify-content: center;
|
|
216
|
+
align-items: center;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.flexItem11 {
|
|
220
|
+
flex: 11;
|
|
221
|
+
justify-content: center;
|
|
222
|
+
align-items: center;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.flexItem1 {
|
|
226
|
+
flex: 1;
|
|
227
|
+
justify-content: center;
|
|
228
|
+
align-items: center;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.tab {
|
|
232
|
+
padding: 8px;
|
|
233
|
+
cursor: pointer;
|
|
234
|
+
background-color: #F2F4F6;
|
|
235
|
+
font-size: 12px;
|
|
236
|
+
text-align: center;
|
|
237
|
+
color: #24292E;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.tabcontainer {
|
|
241
|
+
padding: 4px;
|
|
242
|
+
background-color: #F2F4F6;
|
|
243
|
+
border-radius: 8px;
|
|
244
|
+
margin-bottom: 30px;
|
|
245
|
+
margin-top: 30px;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.tabactive {
|
|
249
|
+
background-color: white;
|
|
250
|
+
-webkit-transition: background-color 300ms linear;
|
|
251
|
+
-ms-transition: background-color 300ms linear;
|
|
252
|
+
transition: background-color 300ms linear;
|
|
253
|
+
border-radius: 8px;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.item {
|
|
257
|
+
font-size: 12px;
|
|
258
|
+
margin-bottom: 16px;
|
|
259
|
+
border-radius: 8px;
|
|
260
|
+
padding: 10px;
|
|
261
|
+
border: 2px #F2F4F6 solid;
|
|
262
|
+
color: #24292E;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.extensionLabel {
|
|
266
|
+
font-style: normal;
|
|
267
|
+
font-weight: bold;
|
|
268
|
+
font-size: 14px;
|
|
269
|
+
text-align: cetner;
|
|
270
|
+
color: #24272A;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.notice {
|
|
274
|
+
font-size: 12px;
|
|
275
|
+
margin-left: 10px;
|
|
276
|
+
margin-right: 10px;
|
|
277
|
+
color: grey;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.button {
|
|
281
|
+
margin-top: 41.5px;
|
|
282
|
+
margin-bottom: 20px;
|
|
283
|
+
width: 100%;
|
|
284
|
+
display: flex;
|
|
285
|
+
flex-direction: row;
|
|
286
|
+
justify-content: center;
|
|
287
|
+
align-items: center;
|
|
288
|
+
padding: 12px 20px;
|
|
289
|
+
background: #037DD6;
|
|
290
|
+
border-radius: 32px;
|
|
291
|
+
color: white;
|
|
292
|
+
border: 0;
|
|
293
|
+
font-size: 14px;
|
|
294
|
+
cursor: pointer;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.backdrop {
|
|
298
|
+
visibility: visible;
|
|
299
|
+
position: fixed;
|
|
300
|
+
top: 0;
|
|
301
|
+
left: 0;
|
|
302
|
+
right: 0;
|
|
303
|
+
bottom: 0;
|
|
304
|
+
width: 100%;
|
|
305
|
+
z-index: 99998;
|
|
306
|
+
background: rgba(0, 0, 0, 0.87);
|
|
307
|
+
opacity: 0.3;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.modal {
|
|
311
|
+
visibility: visible;
|
|
312
|
+
position: fixed;
|
|
313
|
+
left: 50%;
|
|
314
|
+
transform: translate(-50%, -50%);
|
|
315
|
+
z-index: 99999;
|
|
316
|
+
background: white;
|
|
317
|
+
padding: 20px;
|
|
318
|
+
border-radius: 8px;
|
|
319
|
+
top: 50%;
|
|
320
|
+
max-width: 100%;
|
|
321
|
+
width: 460px;
|
|
322
|
+
min-width: 300px;
|
|
323
|
+
box-shadow: rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px;
|
|
324
|
+
-webkit-font-smoothing: antialiased;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.closeButton {
|
|
328
|
+
color: #BBC0C5;
|
|
329
|
+
cursor: pointer;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.logoContainer {
|
|
333
|
+
margin-left: 24px;
|
|
334
|
+
margin-right: 24px;
|
|
335
|
+
margin-top: 24px;
|
|
336
|
+
display: flex;
|
|
337
|
+
align-items: center;
|
|
338
|
+
justify-content: center;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
.connectMobileText {
|
|
342
|
+
font-size: 14px;
|
|
343
|
+
color: black;
|
|
344
|
+
margin-top: 28px;
|
|
345
|
+
margin-bottom: 28px;
|
|
346
|
+
line-height: 2;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.blue {
|
|
350
|
+
color: #037DD6;
|
|
351
|
+
font-weight: 700;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.installExtensionText {
|
|
355
|
+
margin-left: 10px;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.center {
|
|
359
|
+
display: flex;
|
|
360
|
+
justify-content: center;
|
|
361
|
+
align-items: center;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.right {
|
|
365
|
+
display: flex;
|
|
366
|
+
align-items: center;
|
|
367
|
+
justify-content: right;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
#sdk-mm-qrcode {
|
|
371
|
+
svg {
|
|
372
|
+
width: 50%;
|
|
373
|
+
}
|
|
374
|
+
}`;const ov=()=>Y("svg",{width:"21",height:"15",viewBox:"0 0 21 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Y("path",{d:"M14.1364 14.9851C13.5909 14.9851 13.2273 14.5851 13.2273 13.9851C13.2273 13.3851 13.5909 12.9851 14.1364 12.9851C16.6818 12.9851 18.6818 10.7851 18.6818 7.98508C18.6818 5.18508 16.6818 2.98508 14.1364 2.98508C11.5909 2.98508 9.59091 5.18508 9.59091 7.98508C9.59091 8.58508 9.22727 8.98508 8.68182 8.98508C8.13636 8.98508 7.77273 8.58508 7.77273 7.98508C7.77273 4.08508 10.5909 0.985077 14.1364 0.985077C17.6818 0.985077 20.5 4.08508 20.5 7.98508C20.5 11.8851 17.6818 14.9851 14.1364 14.9851ZM6.68182 14.7851C3.22727 14.7851 0.5 11.6851 0.5 7.98508C0.5 4.28508 3.22727 1.18508 6.68182 1.18508C7.22727 1.18508 7.59091 1.58508 7.59091 2.18508C7.59091 2.78508 7.22727 3.18508 6.68182 3.18508C4.22727 3.18508 2.31818 5.38508 2.31818 7.98508C2.31818 10.5851 4.22727 12.7851 6.68182 12.7851C9.13636 12.7851 11.0455 10.6851 11.0455 7.98508C11.0455 7.38508 11.4091 6.98508 11.9545 6.98508C12.5 6.98508 12.8636 7.38508 12.8636 7.98508C12.7727 11.6851 10.0455 14.7851 6.68182 14.7851Z",fill:"white"})),sv=()=>Y("svg",{width:"400",height:"300",viewBox:"0 0 400 300",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Y("rect",{width:"400",height:"300",fill:"white"}),Y("path",{d:"M300.116 242.46L250.485 227.681L213.057 250.055L186.944 250.045L149.493 227.681L99.8843 242.46L84.7939 191.518L99.8843 134.979L84.7939 87.1777L99.8843 27.9336L177.402 74.2466H222.598L300.116 27.9336L315.206 87.1777L300.116 134.979L315.206 191.518L300.116 242.46Z",fill:"#FF5C16"}),Y("path",{d:"M99.8955 27.9336L177.414 74.2792L174.331 106.085L99.8955 27.9336Z",fill:"#FF5C16"}),Y("path",{d:"M149.505 191.539L183.612 217.521L149.505 227.681V191.539Z",fill:"#FF5C16"}),Y("path",{d:"M180.886 148.585L174.33 106.107L132.369 134.991L132.348 134.98V135.001L132.477 164.732L149.493 148.585H149.504H180.886Z",fill:"#FF5C16"}),Y("path",{d:"M300.116 27.9336L222.598 74.2792L225.67 106.085L300.116 27.9336Z",fill:"#FF5C16"}),Y("path",{d:"M250.508 191.539L216.4 217.521L250.508 227.681V191.539Z",fill:"#FF5C16"}),Y("path",{d:"M267.652 135.001H267.663H267.652V134.98L267.641 134.991L225.68 106.107L219.125 148.585H250.507L267.533 164.732L267.652 135.001Z",fill:"#FF5C16"}),Y("path",{d:"M149.493 227.681L99.8843 242.46L84.7939 191.54H149.493V227.681Z",fill:"#E34807"}),Y("path",{d:"M180.875 148.574L190.351 209.98L177.219 175.838L132.456 164.732L149.483 148.574H180.864H180.875Z",fill:"#E34807"}),Y("path",{d:"M250.507 227.681L300.116 242.46L315.206 191.54H250.507V227.681Z",fill:"#E34807"}),Y("path",{d:"M219.126 148.574L209.649 209.98L222.782 175.838L267.545 164.732L250.507 148.574H219.126Z",fill:"#E34807"}),Y("path",{d:"M84.7939 191.517L99.8843 134.979H132.337L132.456 164.721L177.219 175.826L190.351 209.969L183.601 217.488L149.493 191.506H84.7939V191.517Z",fill:"#FF8D5D"}),Y("path",{d:"M315.206 191.517L300.116 134.979H267.664L267.545 164.721L222.782 175.826L209.649 209.969L216.4 217.488L250.507 191.506H315.206V191.517Z",fill:"#FF8D5D"}),Y("path",{d:"M222.598 74.2466H200H177.402L174.33 106.053L190.351 209.936H209.649L225.681 106.053L222.598 74.2466Z",fill:"#FF8D5D"}),Y("path",{d:"M99.8843 27.9336L84.7939 87.1777L99.8843 134.979H132.337L174.319 106.085L99.8843 27.9336Z",fill:"#661800"}),Y("path",{d:"M171.496 160.906H156.795L148.79 168.752L177.229 175.804L171.496 160.896V160.906Z",fill:"#661800"}),Y("path",{d:"M300.116 27.9336L315.206 87.1777L300.116 134.979H267.663L225.681 106.085L300.116 27.9336Z",fill:"#661800"}),Y("path",{d:"M228.525 160.906H243.248L251.253 168.763L222.781 175.826L228.525 160.896V160.906Z",fill:"#661800"}),Y("path",{d:"M213.046 229.789L216.399 217.51L209.649 209.991H190.34L183.59 217.51L186.943 229.789",fill:"#661800"}),Y("path",{d:"M213.047 229.789V250.066H186.944V229.789H213.047Z",fill:"#C0C4CD"}),Y("path",{d:"M149.504 227.66L186.965 250.056V229.779L183.611 217.5L149.504 227.66Z",fill:"#E7EBF6"}),Y("path",{d:"M250.506 227.66L213.045 250.056V229.779L216.398 217.5L250.506 227.66Z",fill:"#E7EBF6"})),Kf=class{constructor(t){Ga(this,t),this.close=Cn(this,"close"),this.connectWithExtension=Cn(this,"connectWithExtension"),this.link=void 0,this.sdkVersion=void 0,this.preferDesktop=void 0,this.tab=1,this.isDefaultTab=!0,this.translationsLoaded=!1,this.i18nInstance=new oc,this.setTab(this.preferDesktop?1:2)}async connectedCallback(){await this.i18nInstance.init({fallbackLng:"en"}),this.translationsLoaded=!0}onClose(t=!1){this.close.emit({shouldTerminate:t})}connectWithExtensionHandler(){this.connectWithExtension.emit()}setTab(t){this.tab=t,this.isDefaultTab=!1}disconnectedCallback(){this.onClose()}updatePreferDesktop(t){t?this.setTab(1):this.setTab(2)}render(){if(!this.translationsLoaded)return null;const t=i=>this.i18nInstance.t(i),e=this.sdkVersion,n=this.isDefaultTab?this.preferDesktop?1:2:this.tab,r=Df(this.link,"svg",{ecc:"medium",scale:2});return Y(tc,{className:"select-modal"},Y("div",{class:"backdrop",onClick:()=>this.onClose(!0)}),Y("div",{class:"modal"},Y("div",{class:"closeButtonContainer"},Y("div",{class:"right"},Y("span",{class:"closeButton",onClick:()=>this.onClose(!0)},Y(rc,null)))),Y("div",{class:"logoContainer"},Y(ic,null)),Y("div",null,Y("div",{class:"tabcontainer"},Y("div",{class:"flexContainer"},Y("div",{onClick:()=>this.setTab(1),class:"tab flexItem "+(n===1?"tabactive":"")},t("DESKTOP")),Y("div",{onClick:()=>this.setTab(2),class:"tab flexItem "+(n===2?"tabactive":"")},t("MOBILE")))),Y("div",{style:{display:n===1?"none":"block"}},Y("div",{class:"flexContainer"},Y("div",{class:"flexItem",style:{textAlign:"center",marginTop:"4"}},Y("div",{class:"center",id:"sdk-mm-qrcode",innerHTML:r}),Y("div",{class:"connectMobileText"},t("SCAN_TO_CONNECT"),Y("br",null),Y("span",{class:"blue"},Y("b",null,t("META_MASK_MOBILE_APP"))))))),Y("div",{style:{display:n===2?"none":"block"}},Y("div",{style:{display:"flex",justifyContent:"center",height:"300",marginTop:"-20"}},Y(sv,null)),Y("div",{class:"extensionLabel"},t("SELECT_MODAL.CRYPTO_TAKE_CONTROL_TEXT")),Y("button",{class:"button",onClick:()=>this.connectWithExtensionHandler()},Y(ov,null),Y("span",{class:"installExtensionText"},t("CONNECT_WITH_EXTENSION"))))),Y(nc,{version:e})))}get el(){return Io(this)}static get watchers(){return{preferDesktop:["updatePreferDesktop"]}}};Kf.style=`.flexContainer {
|
|
375
|
+
display: flex;
|
|
376
|
+
justify-content: center;
|
|
377
|
+
align-items: center;
|
|
378
|
+
flex-direction: row;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
.flexItem {
|
|
382
|
+
flex: 1;
|
|
383
|
+
justify-content: center;
|
|
384
|
+
align-items: center;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.flexItem11 {
|
|
388
|
+
flex: 11;
|
|
389
|
+
justify-content: center;
|
|
390
|
+
align-items: center;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
.flexItem1 {
|
|
394
|
+
flex: 1;
|
|
395
|
+
justify-content: center;
|
|
396
|
+
align-items: center;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
.tab {
|
|
400
|
+
padding: 8px;
|
|
401
|
+
cursor: pointer;
|
|
402
|
+
background-color: #F2F4F6;
|
|
403
|
+
font-size: 12px;
|
|
404
|
+
text-align: center;
|
|
405
|
+
color: #24292E;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
.tabcontainer {
|
|
409
|
+
padding: 4px;
|
|
410
|
+
background-color: #F2F4F6;
|
|
411
|
+
border-radius: 8px;
|
|
412
|
+
margin-bottom: 30px;
|
|
413
|
+
margin-top: 30px;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
.tabactive {
|
|
417
|
+
background-color: white;
|
|
418
|
+
-webkit-transition: background-color 300ms linear;
|
|
419
|
+
-ms-transition: background-color 300ms linear;
|
|
420
|
+
transition: background-color 300ms linear;
|
|
421
|
+
border-radius: 8px;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
.item {
|
|
425
|
+
font-size: 12px;
|
|
426
|
+
margin-bottom: 16px;
|
|
427
|
+
border-radius: 8px;
|
|
428
|
+
padding: 10px;
|
|
429
|
+
border: 2px #F2F4F6 solid;
|
|
430
|
+
color: #24292E;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
.extensionLabel {
|
|
434
|
+
font-style: normal;
|
|
435
|
+
font-weight: bold;
|
|
436
|
+
font-size: 14px;
|
|
437
|
+
text-align: cetner;
|
|
438
|
+
color: #24272A;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
.notice {
|
|
442
|
+
font-size: 12px;
|
|
443
|
+
margin-left: 10px;
|
|
444
|
+
margin-right: 10px;
|
|
445
|
+
color: grey;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
.button {
|
|
449
|
+
margin-top: 41.5px;
|
|
450
|
+
margin-bottom: 20px;
|
|
451
|
+
width: 100%;
|
|
452
|
+
display: flex;
|
|
453
|
+
flex-direction: row;
|
|
454
|
+
justify-content: center;
|
|
455
|
+
align-items: center;
|
|
456
|
+
padding: 12px 20px;
|
|
457
|
+
background: #037DD6;
|
|
458
|
+
border-radius: 32px;
|
|
459
|
+
color: white;
|
|
460
|
+
border: 0;
|
|
461
|
+
font-size: 14px;
|
|
462
|
+
cursor: pointer;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
.backdrop {
|
|
466
|
+
visibility: visible;
|
|
467
|
+
position: fixed;
|
|
468
|
+
top: 0;
|
|
469
|
+
left: 0;
|
|
470
|
+
right: 0;
|
|
471
|
+
bottom: 0;
|
|
472
|
+
width: 100%;
|
|
473
|
+
z-index: 99998;
|
|
474
|
+
background: rgba(0, 0, 0, 0.87);
|
|
475
|
+
opacity: 0.3;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
.modal {
|
|
479
|
+
visibility: visible;
|
|
480
|
+
position: fixed;
|
|
481
|
+
left: 50%;
|
|
482
|
+
transform: translate(-50%, -50%);
|
|
483
|
+
z-index: 99999;
|
|
484
|
+
background: white;
|
|
485
|
+
padding: 20px;
|
|
486
|
+
border-radius: 8px;
|
|
487
|
+
top: 50%;
|
|
488
|
+
max-width: 100%;
|
|
489
|
+
width: 460px;
|
|
490
|
+
min-width: 300px;
|
|
491
|
+
box-shadow: rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px;
|
|
492
|
+
-webkit-font-smoothing: antialiased;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
.closeButton {
|
|
496
|
+
color: #BBC0C5;
|
|
497
|
+
cursor: pointer;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
.logoContainer {
|
|
501
|
+
margin-left: 24px;
|
|
502
|
+
margin-right: 24px;
|
|
503
|
+
margin-top: 24px;
|
|
504
|
+
display: flex;
|
|
505
|
+
align-items: center;
|
|
506
|
+
justify-content: center;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
.connectMobileText {
|
|
510
|
+
font-size: 14px;
|
|
511
|
+
color: black;
|
|
512
|
+
margin-top: 28px;
|
|
513
|
+
margin-bottom: 28px;
|
|
514
|
+
line-height: 2;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
.blue {
|
|
518
|
+
color: #037DD6;
|
|
519
|
+
font-weight: 700;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
.installExtensionText {
|
|
523
|
+
margin-left: 10px;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
.center {
|
|
527
|
+
display: flex;
|
|
528
|
+
justify-content: center;
|
|
529
|
+
align-items: center;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
.right {
|
|
533
|
+
display: flex;
|
|
534
|
+
align-items: center;
|
|
535
|
+
justify-content: right;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
#sdk-mm-qrcode {
|
|
539
|
+
svg {
|
|
540
|
+
width: 50%;
|
|
541
|
+
}
|
|
542
|
+
}`;var av=Object.freeze({__proto__:null,mm_install_modal:Bf,mm_pending_modal:$f,mm_select_modal:Kf});export{Bn as CommunicationLayerPreference,Ue as ConnectionStatus,ar as DEFAULT_SERVER_URL,te as EventType,xe as MessageType,dv as MetaMaskSDK,nt as MetaMaskSDKEvent,Kt as PROVIDER_UPDATE_TYPE,Ve as PlatformType,Gg as SDKProvider,dv as default};
|