vendor: 9,988 bytes, lines 1-2
1var o0=Object.defineProperty;var s0=(t,e,n)=>e in t?o0(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Ut=(t,e,n)=>s0(t,typeof e!="symbol"?e+"":e,n);import{m as ei,g as ya,v as gn,n as hc,_ as a0}from"./index-CRly4T18.js";var Ts={exports:{}};(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(a){var s=typeof o<"u"&&o||typeof self<"u"&&self||typeof ei<"u"&&ei||{},c={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(C){return C&&DataView.prototype.isPrototypeOf(C)}if(c.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(C){return C&&u.indexOf(Object.prototype.toString.call(C))>-1};function h(C){if(typeof C!="string"&&(C=String(C)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(C)||C==="")throw new TypeError('Invalid character in header field name: "'+C+'"');return C.toLowerCase()}function f(C){return typeof C!="string"&&(C=String(C)),C}function g(C){var P={next:function(){var D=C.shift();return{done:D===void 0,value:D}}};return c.iterable&&(P[Symbol.iterator]=function(){return P}),P}function m(C){this.map={},C instanceof m?C.forEach(function(P,D){this.append(D,P)},this):Array.isArray(C)?C.forEach(function(P){if(P.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+P.length);this.append(P[0],P[1])},this):C&&Object.getOwnPropertyNames(C).forEach(function(P){this.append(P,C[P])},this)}m.prototype.append=function(C,P){C=h(C),P=f(P);var D=this.map[C];this.map[C]=D?D+", "+P:P},m.prototype.delete=function(C){delete this.map[h(C)]},m.prototype.get=function(C){return C=h(C),this.has(C)?this.map[C]:null},m.prototype.has=function(C){return this.map.hasOwnProperty(h(C))},m.prototype.set=function(C,P){this.map[h(C)]=f(P)},m.prototype.forEach=function(C,P){for(var D in this.map)this.map.hasOwnProperty(D)&&C.call(P,this.map[D],D,this)},m.prototype.keys=function(){var C=[];return this.forEach(function(P,D){C.push(D)}),g(C)},m.prototype.values=function(){var C=[];return this.forEach(function(P){C.push(P)}),g(C)},m.prototype.entries=function(){var C=[];return this.forEach(function(P,D){C.push([D,P])}),g(C)},c.iterable&&(m.prototype[Symbol.iterator]=m.prototype.entries);function w(C){if(!C._noBody){if(C.bodyUsed)return Promise.reject(new TypeError("Already read"));C.bodyUsed=!0}}function p(C){return new Promise(function(P,D){C.onload=function(){P(C.result)},C.onerror=function(){D(C.error)}})}function S(C){var P=new FileReader,D=p(P);return P.readAsArrayBuffer(C),D}function _(C){var P=new FileReader,D=p(P),y=/charset=([A-Za-z0-9_-]+)/.exec(C.type),E=y?y[1]:"utf-8";return P.readAsText(C,E),D}function O(C){for(var P=new Uint8Array(C),D=new Array(P.length),y=0;y<P.length;y++)D[y]=String.fromCharCode(P[y]);return D.join("")}function I(C){if(C.slice)return C.slice(0);var P=new Uint8Array(C.byteLength);return P.set(new Uint8Array(C)),P.buffer}function j(){return this.bodyUsed=!1,this._initBody=function(C){this.bodyUsed=this.bodyUsed,this._bodyInit=C,C?typeof C=="string"?this._bodyText=C:c.blob&&Blob.prototype.isPrototypeOf(C)?this._bodyBlob=C:c.formData&&FormData.prototype.isPrototypeOf(C)?this._bodyFormData=C:c.searchParams&&URLSearchParams.prototype.isPrototypeOf(C)?this._bodyText=C.toString():c.arrayBuffer&&c.blob&&l(C)?(this._bodyArrayBuffer=I(C.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(C)||d(C))?this._bodyArrayBuffer=I(C):this._bodyText=C=Object.prototype.toString.call(C):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof C=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):c.searchParams&&URLSearchParams.prototype.isPrototypeOf(C)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},c.blob&&(this.blob=function(){var C=w(this);if(C)return C;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 C=w(this);return C||(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(c.blob)return this.blob().then(S);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var C=w(this);if(C)return C;if(this._bodyBlob)return _(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(O(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},c.formData&&(this.formData=function(){return this.text().then(K)}),this.json=function(){return this.text().then(JSON.parse)},this}var q=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function F(C){var P=C.toUpperCase();return q.indexOf(P)>-1?P:C}function U(C,P){if(!(this instanceof U))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');P=P||{};var D=P.body;if(C instanceof U){if(C.bodyUsed)throw new TypeError("Already read");this.url=C.url,this.credentials=C.credentials,P.headers||(this.headers=new m(C.headers)),this.method=C.method,this.mode=C.mode,this.signal=C.signal,!D&&C._bodyInit!=null&&(D=C._bodyInit,C.bodyUsed=!0)}else this.url=String(C);if(this.credentials=P.credentials||this.credentials||"same-origin",(P.headers||!this.headers)&&(this.headers=new m(P.headers)),this.method=F(P.method||this.method||"GET"),this.mode=P.mode||this.mode||null,this.signal=P.signal||this.signal||function(){if("AbortController"in s){var A=new AbortController;return A.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&D)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(D),(this.method==="GET"||this.method==="HEAD")&&(P.cache==="no-store"||P.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()}}}U.prototype.clone=function(){return new U(this,{body:this._bodyInit})};function K(C){var P=new FormData;return C.trim().split("&").forEach(function(D){if(D){var y=D.split("="),E=y.shift().replace(/\+/g," "),A=y.join("=").replace(/\+/g," ");P.append(decodeURIComponent(E),decodeURIComponent(A))}}),P}function G(C){var P=new m,D=C.replace(/\r?\n[\t ]+/g," ");return D.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{P.append(A,T)}catch(b){console.warn("Response "+b.message)}}}),P}j.call(U.prototype);function $(C,P){if(!(this instanceof $))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(P||(P={}),this.type="default",this.status=P.status===void 0?200:P.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=P.statusText===void 0?"":""+P.statusText,this.headers=new m(P.headers),this.url=P.url||"",this._initBody(C)}j.call($.prototype),$.prototype.clone=function(){return new $(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new m(this.headers),url:this.url})},$.error=function(){var C=new $(null,{status:200,statusText:""});return C.ok=!1,C.status=0,C.type="error",C};var L=[301,302,303,307,308];$.redirect=function(C,P){if(L.indexOf(P)===-1)throw new RangeError("Invalid status code");return new $(null,{status:P,headers:{location:C}})},a.DOMException=s.DOMException;try{new a.DOMException}catch{a.DOMException=function(P,D){this.message=P,this.name=D;var y=Error(P);this.stack=y.stack},a.DOMException.prototype=Object.create(Error.prototype),a.DOMException.prototype.constructor=a.DOMException}function R(C,P){return new Promise(function(D,y){var E=new U(C,P);if(E.signal&&E.signal.aborted)return y(new a.DOMException("Aborted","AbortError"));var A=new XMLHttpRequest;function T(){A.abort()}A.onload=function(){var k={statusText:A.statusText,headers:G(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(){D(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 a.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&&(c.blob?A.responseType="blob":c.arrayBuffer&&(A.responseType="arraybuffer")),P&&typeof P.headers=="object"&&!(P.headers instanceof m||s.Headers&&P.headers instanceof s.Headers)){var v=[];
2Object.getOwnPropertyNames(P.headers).forEach(function(k){v.push(h(k)),A.setRequestHeader(k,f(P.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 R.polyfill=!0,s.fetch||(s.fetch=R,s.Headers=m,s.Request=U,s.Response=$),a.Headers=m,a.Request=U,a.Response=$,a.fetch=R,a})({})})(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})(Ts,Ts.exports);var c0=Ts.exports;const Pu=ya(c0);var Ms={exports:{}},$o,fc;function l0(){if(fc)return $o;fc=1;var t=1e3,e=t*60,n=e*60,r=n*24,i=r*7,o=r*365.25;$o=function(u,d){d=d||{};var h=typeof u;if(h==="string"&&u.length>0)return a(u);if(h==="number"&&isFinite(u))return d.long?c(u):s(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function a(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 c(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 g=d>=h*1.5;return Math.round(u/h)+" "+f+(g?"s":"")}return $o}function u0(t){n.debug=n,n.default=n,n.coerce=c,n.disable=o,n.enable=i,n.enabled=a,n.humanize=l0(),n.destroy=l,Object.keys(t).forEach(u=>{n[u]=t[u]}),n.names=[],n.skips=[],n.formatters={};function e(u){let d=0;for(let h=0;h<u.length;h++)d=(d<<5)-d+u.charCodeAt(h),d|=0;return n.colors[Math.abs(d)%n.colors.length]}n.selectColor=e;function n(u){let d,h=null,f,g;function m(...w){if(!m.enabled)return;const p=m,S=Number(new Date),_=S-(d||S);p.diff=_,p.prev=d,p.curr=S,d=S,w[0]=n.coerce(w[0]),typeof w[0]!="string"&&w.unshift("%O");let O=0;w[0]=w[0].replace(/%([a-zA-Z%])/g,(j,q)=>{if(j==="%%")return"%";O++;const F=n.formatters[q];if(typeof F=="function"){const U=w[O];j=F.call(p,U),w.splice(O,1),O--}return j}),n.formatArgs.call(p,w),(p.log||n.log).apply(p,w)}return m.namespace=u,m.useColors=n.useColors(),m.color=n.selectColor(u),m.extend=r,m.destroy=n.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(f!==n.namespaces&&(f=n.namespaces,g=n.enabled(u)),g),set:w=>{h=w}}),typeof n.init=="function"&&n.init(m),m}function r(u,d){const h=n(this.namespace+(typeof d>"u"?":":d)+u);return h.log=this.log,h}function i(u){n.save(u),n.namespaces=u,n.names=[],n.skips=[];let d;const h=(typeof u=="string"?u:"").split(/[\s,]+/),f=h.length;for(d=0;d<f;d++)h[d]&&(u=h[d].replace(/\*/g,".*?"),u[0]==="-"?n.skips.push(new RegExp("^"+u.slice(1)+"$")):n.names.push(new RegExp("^"+u+"$")))}function o(){const u=[...n.names.map(s),...n.skips.map(s).map(d=>"-"+d)].join(",");return n.enable(""),u}function a(u){if(u[u.length-1]==="*")return!0;let d,h;for(d=0,h=n.skips.length;d<h;d++)if(n.skips[d].test(u))return!1;for(d=0,h=n.names.length;d<h;d++)if(n.names[d].test(u))return!0;return!1}function s(u){return u.toString().substring(2,u.toString().length-2).replace(/\.\*\?$/,"*")}function c(u){return u instanceof Error?u.stack||u.message:u}function l(){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 n.enable(n.load()),n}var d0=u0;(function(t,e){var n={};e.formatArgs=i,e.save=o,e.load=a,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","#33
2CCCC","#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 a(){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=d0(e);const{formatters:c}=t.exports;c.j=function(l){try{return JSON.stringify(l)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}})(Ms,Ms.exports);var h0=Ms.exports;const Ye=ya(h0);var va=Object.defineProperty,f0=Object.getOwnPropertyDescriptor,p0=Object.getOwnPropertyNames,m0=Object.prototype.hasOwnProperty,g0=(t,e)=>{for(var n in e)va(t,n,{get:e[n],enumerable:!0})},y0=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of p0(e))!m0.call(t,i)&&i!==n&&va(t,i,{get:()=>e[i],enumerable:!(r=f0(e,i))||r.enumerable});return t},v0=t=>y0(va({},"__esModule",{value:!0}),t),Iu={};g0(Iu,{createFinalURL:()=>ju,createPathBasedClient:()=>C0,createQuerySerializer:()=>Rs,default:()=>Lu,defaultBodySerializer:()=>$u,defaultPathSerializer:()=>Bu,mergeHeaders:()=>Os,randomID:()=>Nu,removeTrailingSlash:()=>Ps,serializeArrayParam:()=>wa,serializeObjectParam:()=>ba,serializePrimitiveParam:()=>Gr,wrapAsPathBasedClient:()=>Du});var b0=v0(Iu),w0=/\{[^{}]+\}/g,E0=()=>{var t,e;return typeof process=="object"&&Number.parseInt((e=(t=process==null?void 0:process.versions)==null?void 0:t.node)==null?void 0:e.substring(0,2))>=18&&process.versions.undici};function Nu(){return Math.random().toString(36).slice(2,11)}function Lu(t){let{baseUrl:e="",Request:n=globalThis.Request,fetch:r=globalThis.fetch,querySerializer:i,bodySerializer:o,headers:a,requestInitExt:s=void 0,...c}={...t};s=E0()?s:void 0,e=Ps(e);const l=[];async function u(d,h){const{baseUrl:f,fetch:g=r,Request:m=n,headers:w,params:p={},parseAs:S="json",querySerializer:_,bodySerializer:O=o??$u,body:I,...j}=h||{};let q=e;f&&(q=Ps(f)??e);let F=typeof i=="function"?i:Rs(i);_&&(F=typeof _=="function"?_:Rs({...typeof i=="object"?i:{},..._}));const U=I===void 0?void 0:O(I,Os(a,w,p.header)),K=Os(U===void 0||U instanceof FormData?{}:{"Content-Type":"application/json"},a,w,p.header),G={redirect:"follow",...c,...j,body:U,headers:K};let $,L,R=new n(ju(d,{baseUrl:q,params:p,querySerializer:F}),G),C;for(const D in j)D in R||(R[D]=j[D]);if(l.length){$=Nu(),L=Object.freeze({baseUrl:q,fetch:g,parseAs:S,querySerializer:F,bodySerializer:O});for(const D of l)if(D&&typeof D=="object"&&typeof D.onRequest=="function"){const y=await D.onRequest({request:R,schemaPath:d,params:p,options:L,id:$});if(y)if(y instanceof n)R=y;else if(y instanceof Response){C=y;break}
2else throw new Error("onRequest: must return new Request() or Response() when modifying the request")}}if(!C){try{C=await g(R,s)}catch(D){let y=D;if(l.length)for(let E=l.length-1;E>=0;E--){const A=l[E];if(A&&typeof A=="object"&&typeof A.onError=="function"){const T=await A.onError({request:R,error:y,schemaPath:d,params:p,options:L,id:$});if(T){if(T instanceof Response){y=void 0,C=T;break}if(T instanceof Error){y=T;continue}throw new Error("onError: must return new Response() or instance of Error")}}}if(y)throw y}if(l.length)for(let D=l.length-1;D>=0;D--){const y=l[D];if(y&&typeof y=="object"&&typeof y.onResponse=="function"){const E=await y.onResponse({request:R,response:C,schemaPath:d,params:p,options:L,id:$});if(E){if(!(E instanceof Response))throw new Error("onResponse: must return new Response() when modifying the response");C=E}}}}if(C.status===204||R.method==="HEAD"||C.headers.get("Content-Length")==="0")return C.ok?{data:void 0,response:C}:{error:void 0,response:C};if(C.ok)return S==="stream"?{data:C.body,response:C}:{data:await C[S](),response:C};let P=await C.text();try{P=JSON.parse(P)}catch{}return{error:P,response:C}}return{request(d,h,f){return u(h,{...f,method:d.toUpperCase()})},GET(d,h){return u(d,{...h,method:"GET"})},PUT(d,h){return u(d,{...h,method:"PUT"})},POST(d,h){return u(d,{...h,method:"POST"})},DELETE(d,h){return u(d,{...h,method:"DELETE"})},OPTIONS(d,h){return u(d,{...h,method:"OPTIONS"})},HEAD(d,h){return u(d,{...h,method:"HEAD"})},PATCH(d,h){return u(d,{...h,method:"PATCH"})},TRACE(d,h){return u(d,{...h,method:"TRACE"})},use(...d){for(const h of d)if(h){if(typeof h!="object"||!("onRequest"in h||"onResponse"in h||"onError"in h))throw new Error("Middleware must be an object with one of `onRequest()`, `onResponse() or `onError()`");l.push(h)}},eject(...d){for(const h of d){const f=l.indexOf(h);f!==-1&&l.splice(f,1)}}}}var _0=class{constructor(t,e){Ut(this,"GET",t=>this.client.GET(this.url,t));Ut(this,"PUT",t=>this.client.PUT(this.url,t));Ut(this,"POST",t=>this.client.POST(this.url,t));Ut(this,"DELETE",t=>this.client.DELETE(this.url,t));Ut(this,"OPTIONS",t=>this.client.OPTIONS(this.url,t));Ut(this,"HEAD",t=>this.client.HEAD(this.url,t));Ut(this,"PATCH",t=>this.client.PATCH(this.url,t));Ut(this,"TRACE",t=>this.client.TRACE(this.url,t));this.client=t,this.url=e}},S0=class{constructor(){this.client=null}get(t,e){const n=new _0(t,e);return this.client[e]=n,n}};function Du(t){const e=new S0,n=new Proxy(t,e);function r(){}r.prototype=n;const i=new r;return e.client=i,i}function C0(t){return Du(Lu(t))}function Gr(t,e,n){if(e==null)return"";if(typeof e=="object")throw new Error("Deeply-nested arrays/objects arenât supported. Provide your own `querySerializer()` to handle these.");return`${t}=${(n==null?void 0:n.allowReserved)===!0?e:encodeURIComponent(e)}`}function ba(t,e,n){if(!e||typeof e!="object")return"";const r=[],i={simple:",",label:".",matrix:";"}[n.style]||"&";if(n.style!=="deepObject"&&n.explode===!1){for(const s in e)r.push(s,n.allowReserved===!0?e[s]:encodeURIComponent(e[s]));const a=r.join(",");switch(n.style){case"form":return`${t}=${a}`;case"label":return`.${a}`;case"matrix":return`;${t}=${a}`;default:return a}}for(const a in e){const s=n.style==="deepObject"?`${t}[${a}]`:a;r.push(Gr(s,e[a],n))}const o=r.join(i);return n.style==="label"||n.style==="matrix"?`${i}${o}`:o}function wa(t,e,n){if(!Array.isArray(e))return"";if(n.explode===!1){const o={form:",",spaceDelimited:"%20",pipeDelimited:"|"}[n.style]||",",a=(n.allowReserved===!0?e:e.map(s=>encodeURIComponent(s))).join(o);switch(n.style){case"simple":return a;case"label":return`.${a}`;case"matrix":return`;${t}=${a}`;default:return`${t}=${a}`}}const r={simple:",",label:".",matrix:";"}[n.style]||"&",i=[];for(const o of e)n.style==="simple"||n.style==="label"?i.push(n.allowReserved===!0?o:encodeURIComponent(o)):i.push(Gr(t,o,n));return n.style==="label"||n.style==="matrix"?`${r}${i.join(r)}`:i.join(r)}function Rs(t){return function(n){const r=[];if(n&&typeof n=="object")for(const i in n){const o=n[i];if(o!=null){if(Array.isArray(o)){if(o.length===0)continue;r.push(wa(i,o,{style:"form",explode:!0,...t==null?void 0:t.array,allowReserved:(t==null?void 0:t.allowReserved)||!1}));continue}
2if(typeof o=="object"){r.push(ba(i,o,{style:"deepObject",explode:!0,...t==null?void 0:t.object,allowReserved:(t==null?void 0:t.allowReserved)||!1}));continue}r.push(Gr(i,o,t))}}return r.join("&")}}function Bu(t,e){let n=t;for(const r of t.match(w0)??[]){let i=r.substring(1,r.length-1),o=!1,a="simple";if(i.endsWith("*")&&(o=!0,i=i.substring(0,i.length-1)),i.startsWith(".")?(a="label",i=i.substring(1)):i.startsWith(";")&&(a="matrix",i=i.substring(1)),!e||e[i]===void 0||e[i]===null)continue;const s=e[i];if(Array.isArray(s)){n=n.replace(r,wa(i,s,{style:a,explode:o}));continue}if(typeof s=="object"){n=n.replace(r,ba(i,s,{style:a,explode:o}));continue}if(a==="matrix"){n=n.replace(r,`;${Gr(i,s)}`);continue}n=n.replace(r,a==="label"?`.${encodeURIComponent(s)}`:encodeURIComponent(s))}return n}function $u(t,e){return t instanceof FormData?t:e&&(e.get instanceof Function?e.get("Content-Type")??e.get("content-type"):e["Content-Type"]??e["content-type"])==="application/x-www-form-urlencoded"?new URLSearchParams(t).toString():JSON.stringify(t)}function ju(t,e){var i;let n=`${e.baseUrl}${t}`;(i=e.params)!=null&&i.path&&(n=Bu(n,e.params.path));let r=e.querySerializer(e.params.query??{});return r.startsWith("?")&&(r=r.substring(1)),r&&(n+=`?${r}`),n}function Os(...t){const e=new Headers;for(const n of t){if(!n||typeof n!="object")continue;const r=n instanceof Headers?n.entries():Object.entries(n);for(const[i,o]of r)if(o===null)e.delete(i);else if(Array.isArray(o))for(const a of o)e.append(i,a);else o!==void 0&&e.set(i,o)}return e}function Ps(t){return t.endsWith("/")?t.substring(0,t.length-1):t}var jo={},k0=Object.create,_o=Object.defineProperty,A0=Object.getOwnPropertyDescriptor,x0=Object.getOwnPropertyNames,T0=Object.getPrototypeOf,M0=Object.prototype.hasOwnProperty,R0=(t,e)=>{for(var n in e)_o(t,n,{get:e[n],enumerable:!0})},Ku=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of x0(e))!M0.call(t,i)&&i!==n&&_o(t,i,{get:()=>e[i],enumerable:!(r=A0(e,i))||r.enumerable});return t},O0=(t,e,n)=>(n=t!=null?k0(T0(t)):{},Ku(!t||!t.__esModule?_o(n,"default",{value:t,enumerable:!0}):n,t)),P0=t=>Ku(_o({},"__esModule",{value:!0}),t),Uu={};R0(Uu,{analytics:()=>K0});var Me=P0(Uu),I0=O0(b0),N0=class{constructor(t){this.batch=[],this.maxTimeoutMs=3e4,this.timeoutId=null,this.isSending=!1,this.batchSize=t.batchSize,this.baseTimeoutMs=t.baseTimeoutMs,this.currentTimeoutMs=t.baseTimeoutMs,this.sendFn=t.sendFn}enqueue(t){this.batch.push(t),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 t=[...this.batch.slice(0,this.batchSize)];this.batch=this.batch.slice(this.batchSize);try{await this.sendFn(t),this.currentTimeoutMs=this.baseTimeoutMs}catch(e){console.error("Sender: Failed to send batch",e),this.batch=[...t,...this.batch],this.currentTimeoutMs=Math.min(this.currentTimeoutMs*2,this.maxTimeoutMs)}finally{this.isSending=!1,this.schedule()}}},L0=N0,D0=class{constructor(t){this.enabled=!1,this.properties={};const e=(0,I0.default)({baseUrl:t}),n=async r=>{const i=await e.POST("/v1/events",{body:r});if(i.response.status!==200)throw new Error(i.error)};this.sender=new L0({batchSize:100,baseTimeoutMs:200,sendFn:n})}enable(){this.enabled=!0}setGlobalProperty(t,e){this.properties[t]=e}track(t,e){if(!this.enabled)return;const n={name:t,...this.properties,...e};this.sender.enqueue(n)}},B0=D0,Is,pc;typeof process<"u"&&jo&&(Is=(pc=jo.METAMASK_ANALYTICS_ENDPOINT)!=null?pc:jo.NEXT_PUBLIC_METAMASK_ANALYTICS_ENDPOINT);var $0=Is??"https://mm-sdk-analytics.api.cx.metamask.io/",j0=new B0($0),K0=j0,Hu={exports:{}};/*! 3 * EventEmitter2 4 * https://github.com/hij1nx/EventEmitter2 5 * 6 * Copyright (c) 2013 hij1nx 7 * Licensed under the MIT license. 8 */(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,a=typeof process=="object"&&typeof process.nextTick=="function",s=typeof Symbol=="function",c=typeof Reflect=="object",l=typeof setImmediate=="function",u=l?setImmediate:setTimeout,d=s?c&&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 g(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 m=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 M=m.apply(null,arguments),N={data:M,name:E,original:y};if(A){var B=A.call(b,N);B!==!1&&v.emit.apply(v,[N.name].concat(M));return}v.emit.apply(v,[E].concat(M))};if(k[y])throw Error("Event '"+y+"' is already listening");this._listenersCount++,v._newListener&&v._removeListener&&!T._onNewListener?(this._onNewListener=function(M){M===E&&k[y]===null&&(k[y]=x,T._on.call(b,y,x))},v.on("newListener",this._onNewListener),this._onRemoveListener=function(M){M===E&&!v.hasListeners(M)&&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,M;
8if(y&&typeof y!="string")throw TypeError("event must be a string");function N(){E._onNewListener&&(T.off("newListener",E._onNewListener),T.off("removeListener",E._onRemoveListener),E._onNewListener=null,E._onRemoveListener=null);var B=F.call(T,E);T._observers.splice(B,1)}if(y){if(b=A[y],!b)return;k.call(x,y,b),delete A[y],--this._listenersCount||N()}else{for(v=d(A),M=v.length;M-- >0;)y=v[M],k.call(x,y,A[y]);this._listeners={},this._listenersCount=0,N()}}});function S(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,M,N;function B(z){throw Error('Invalid "'+x+'" option value'+(z?". Reason: "+z:""))}for(var H=0;H<k;H++){if(x=v[H],!r.call(E,x))throw Error('Unknown "'+x+'" option');M=y[x],M!==n&&(N=A[x],b[x]=N?N(M,B):M)}return b}function _(y,E){return(typeof y!="function"||!y.hasOwnProperty("prototype"))&&E("value must be a constructor"),y}function O(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,M=A;M-- >0;)if(x===y[M])return v;k(E)}}var I=O(["function"]),j=O(["object","function"]);function q(y,E,A){var T,b,v=0,k,x=new y(function(M,N,B){A=S(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 B=="function";function H(){b&&(b=null),v&&(clearTimeout(v),v=0)}var z=function(Q){H(),M(Q)},J=function(Q){H(),N(Q)};T?E(z,J,B):(b=[function(Q){J(Q||Error("canceled"))}],E(z,J,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");
8Q.code="ETIMEDOUT",v=0,x.cancel(Q),N(Q)},A.timeout))});return T||(x.cancel=function(M){if(b){for(var N=b.length,B=1;B<N;B++)b[B](M);b[0](M),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 U(y,E,A,T,b){if(!A)return null;if(T===0){var v=typeof E;if(v==="string"){var k,x,M=0,N=0,B=this.delimiter,H=B.length;if((x=E.indexOf(B))!==-1){k=new Array(5);do k[M++]=E.slice(N,x),N=x+H;while((x=E.indexOf(B,N))!==-1);k[M++]=E.slice(N),E=k,b=M}else E=[E],b=1}else v==="object"?b=E.length:(E=[E],b=1)}var z=null,J,Q,ne,se,le,re=E[T],ie=E[T+1],ce,ae;if(T===b)A._listeners&&(typeof A._listeners=="function"?(y&&y.push(A._listeners),z=[A]):(y&&y.push.apply(y,A._listeners),z=[A]));else if(re==="*"){for(ce=d(A),x=ce.length;x-- >0;)J=ce[x],J!=="_listeners"&&(ae=U(y,E,A[J],T+1,b),ae&&(z?z.push.apply(z,ae):z=ae));return z}else if(re==="**"){for(le=T+1===b||T+2===b&&ie==="*",le&&A._listeners&&(z=U(y,E,A,b,b)),ce=d(A),x=ce.length;x-- >0;)J=ce[x],J!=="_listeners"&&(J==="*"||J==="**"?(A[J]._listeners&&!le&&(ae=U(y,E,A[J],b,b),ae&&(z?z.push.apply(z,ae):z=ae)),ae=U(y,E,A[J],T,b)):J===ie?ae=U(y,E,A[J],T+2,b):ae=U(y,E,A[J],T,b),ae&&(z?z.push.apply(z,ae):z=ae));return z}else A[re]&&(z=U(y,E,A[re],T+1,b));if(Q=A["*"],Q&&U(y,E,Q,T+1,b),ne=A["**"],ne)if(T<b)for(ne._listeners&&U(y,E,ne,b,b),ce=d(ne),x=ce.length;x-- >0;)J=ce[x],J!=="_listeners"&&(J===ie?U(y,E,ne[J],T+2,b):J===re?U(y,E,ne[J],T+1,b):(se={},se[J]=ne[J],U(y,E,{"**":se},T+1,b)));else ne._listeners?U(y,E,ne,b,b):ne["*"]&&ne["*"]._listeners&&U(y,E,ne["*"],b,b);return z}function K(y,E,A){var T=0,b=0,v,k=this.delimiter,x=k.length,M;if(typeof y=="string")if((v=y.indexOf(k))!==-1){M=new Array(5);do M[T++]=y.slice(b,v),b=v+x;while((v=y.indexOf(k,b))!==-1);M[T++]=y.slice(b)}else M=[y],T=1;else M=y,T=y.length;if(T>1){for(v=0;v+1<T;v++)if(M[v]==="**"&&M[v+1]==="**")return}var N=this.listenerTree,B;for(v=0;v<T;v++)if(B=M[v],N=N[B]||(N[B]={}),v===T-1)return N._listeners?(typeof N._listeners=="function"&&(N._listeners=[N._listeners]),A?N._listeners.unshift(E):N._listeners.push(E),!N._listeners.warned&&this._maxListeners>0&&N._listeners.length>this._maxListeners&&(N._listeners.warned=!0,g.call(this,N._listeners.length,B))):N._listeners=E,!0;return!0}function G(y,E,A,T){for(var b=d(y),v=b.length,k,x,M,N=y._listeners,B;v-- >0;)x=b[v],k=y[x],x==="_listeners"?M=A:M=A?A.concat(x):[x],B=T||typeof x=="symbol",N&&E.push(B?M:M.join(this.delimiter)),typeof k=="object"&&G.call(this,k,E,M,B);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 L(y,E,A){this.emitter=y,this.event=E,this.listener=A}L.prototype.off=function(){return this.emitter.off(this.event,this.listener),this};function R(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,M=E._origin||E;if(v&&!a)throw Error("process.nextTick is not supported");b===n&&(b=E.constructor.name==="AsyncFunction"),E=function(){var N=arguments,B=this,H=this.event;return b?v?Promise.resolve():new Promise(function(z){u(z)}).then(function(){return B.event=H,x.apply(B,N)}):(v?process.nextTick:u)(function(){B.event=H,x.apply(B,N)})},E._async=!0,E._origin=M}return[E,k?new L(this,y,E):this]}function C(y){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,f.call(this,y)}C.EventEmitter2=C,C.prototype.listenTo=function(y,E,A){if(typeof y!="object")throw TypeError("target musts be an object");var T=this;A=S(A,{on:n,off:n,reducers:n},{on:I,off:I,reducers:j});function b(v){if(typeof v!="object")throw TypeError("events must be an object");var k=A.reducers,x=F.call(T,y),M;x===-1?M=new p(T,y,A):M=T._observers[x];for(var N=d(v),B=N.length,H,z=typeof k=="function",J=0;J<B;J++)H=N[J],M.subscribe(H,v[H]||H,z?k:k&&k[H])}return i(E)?b(w(E)):b(typeof E=="string"?w(E.split(/\s+/)):E),this},C.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;
8)b=A[T],(!y||b._target===y)&&(b.unsubscribe(E),v=!0);return v},C.prototype.delimiter=".",C.prototype.setMaxListeners=function(y){y!==n&&(this._maxListeners=y,this._conf||(this._conf={}),this._conf.maxListeners=y)},C.prototype.getMaxListeners=function(){return this._maxListeners},C.prototype.event="",C.prototype.once=function(y,E,A){return this._once(y,E,!1,A)},C.prototype.prependOnceListener=function(y,E,A){return this._once(y,E,!0,A)},C.prototype._once=function(y,E,A,T){return this._many(y,1,E,A,T)},C.prototype.many=function(y,E,A,T){return this._many(y,E,A,!1,T)},C.prototype.prependMany=function(y,E,A,T){return this._many(y,E,A,!0,T)},C.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)},C.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 M=arguments.length,N;if(this._all&&this._all.length)for(N=this._all.slice(),v=0,b=N.length;v<b;v++)switch(this.event=y,M){case 1:N[v].call(this,y);break;case 2:N[v].call(this,y,arguments[1]);break;case 3:N[v].call(this,y,arguments[1],arguments[2]);break;default:N[v].apply(this,arguments)}if(A)N=[],U.call(this,N,E,this.listenerTree,0,b);else if(N=this._events[y],typeof N=="function"){switch(this.event=y,M){case 1:N.call(this);break;case 2:N.call(this,arguments[1]);break;case 3:N.call(this,arguments[1],arguments[2]);break;default:for(T=new Array(M-1),k=1;k<M;k++)T[k-1]=arguments[k];N.apply(this,T)}return!0}else N&&(N=N.slice());if(N&&N.length){if(M>3)for(T=new Array(M-1),k=1;k<M;k++)T[k-1]=arguments[k];for(v=0,b=N.length;v<b;v++)switch(this.event=y,M){case 1:N[v].call(this);break;case 2:N[v].call(this,arguments[1]);break;case 3:N[v].call(this,arguments[1],arguments[2]);break;default:N[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},C.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 M=[],N=arguments.length,B;if(this._all)for(k=0,v=this._all.length;k<v;k++)switch(this.event=y,N){case 1:M.push(this._all[k].call(this,y));break;case 2:M.push(this._all[k].call(this,y,arguments[1]));break;case 3:M.push(this._all[k].call(this,y,arguments[1],arguments[2]));break;default:M.push(this._all[k].apply(this,arguments))}if(E?(B=[],U.call(this,B,A,this.listenerTree,0)):B=this._events[y],typeof B=="function")switch(this.event=y,N){case 1:M.push(B.call(this));break;case 2:M.push(B.call(this,arguments[1]));break;case 3:M.push(B.call(this,arguments[1],arguments[2]));break;default:for(b=new Array(N-1),x=1;x<N;x++)b[x-1]=arguments[x];M.push(B.apply(this,b))}else if(B&&B.length){if(B=B.slice(),N>3)for(b=new Array(N-1),x=1;x<N;x++)b[x-1]=arguments[x];for(k=0,v=B.length;k<v;k++)switch(this.event=y,N){case 1:M.push(B[k].call(this));break;case 2:M.push(B[k].call(this,arguments[1]));break;case 3:M.push(B[k].call(this,arguments[1],arguments[2]));break;default:M.push(B[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(M)},C.prototype.on=function(y,E,A){return this._on(y,E,!1,A)},C.prototype.prependListener=function(y,E,A){return this._on(y,E,!0,A)},C.prototype.onAny=function(y){return this._onAny(y,!1)},C.prototype.prependAny=function(y){return this._onAny(y,!0)},C.prototype.addListener=C.prototype.on,C.prototype._onAny=function(y,E){if
8(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},C.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=R.call(this,y,E,T),E=v[0],b=v[1]),this._newListener&&this.emit("newListener",y,E),this.wildcard?(K.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,g.call(this,this._events[y].length,y))):this._events[y]=E,b)},C.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=U.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,M=0,N=A.length;M<N;M++)if(A[M]===E||A[M].listener&&A[M].listener===E||A[M]._origin&&A[M]._origin===E){x=M;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},C.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},C.prototype.removeListener=C.prototype.off,C.prototype.removeAllListeners=function(y){if(y===n)return!this._events||h.call(this),this;if(this.wildcard){var E=U.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},C.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=[],M=typeof y=="string"?y.split(this.delimiter):y.slice();return U.call(this,x,M,k,0),x}return E?(T=E[y],T?typeof T=="function"?[T]:T:[]):[]}},C.prototype.eventNames=function(y){var E=this._events;return this.wildcard?G.call(this,this.listenerTree,[],null,y):E?d(E):[]},C.prototype.listenerCount=function(y){return this.listeners(y).length},C.prototype.hasListeners=function(y){if(this.wildcard){var E=[],A=typeof y=="string"?y.split(this.delimiter):y.slice();return U.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]))},C.prototype.listenersAny=function(){return this._all?this._all:[]},C.prototype.waitFor=function(y,E){var A=this,T=typeof E;return T==="number"?E={timeout:E}:T==="function"&&(E={filter:E}),E=S(E,{timeout:0,filter:n,handleError:!1,Promise,overload:!1},{filter:I,Promise:_}),q(E.Promise,function(b,v,k){function x(){var M=E.filter;if(!(M&&!M.apply(A,arguments)))if(A.off(y,x),E.handleError){var N=arguments[0];N?v(N):b(m.apply(null,arguments).slice(1))}else b(m.apply(null,arguments))}k(function(){A.off(y,x)}),A._on(y,x,!1)},{timeout:E.timeout,overload:E.overload})};function P(y,E,A){A=S(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(m.apply(null,arguments))},k(function(){y.removeEventListener(E,x)}),y.addEventListener(E,x,{once:!0});return}var M=function(){N&&y.removeListener("error",N),b(m.apply(null,arguments))},N;E!=="error"&&(N=function(B){y.removeListener(E,M),v(B)},y.once("error",N)),k(function(){N&&y.removeListener("error",N),y.removeListener(E,M)}),y.once(E,M)},{timeout:A.timeout,overload:A.overload})}var D=C.prototype;Object.defineProperties(C,{defaultMaxListeners:{get:function(){return D._maxListeners},set:function(y){if(typeof y!="number"||y<0||Number.isNaN(y))throw TypeError("n must be a non-negative number");D._maxListeners=y},enumerable:!0},once:{value:P,writable:!0,configurable:!0}}),Object.defineProperties(D,{_maxListeners:{value:o,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),t.exports=C})()})(Hu);
vendor: 23,274 bytes, line 8
8var So=Hu.exports;const U0=ya(So),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 ki=Object.create(null);Object.keys(jt).forEach(t=>{ki[jt[t]]=t});const Ns={type:"error",data:"parser error"},Fu=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",zu=typeof ArrayBuffer=="function",qu=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,Ea=({type:t,data:e},n,r)=>Fu&&e instanceof Blob?n?r(e):mc(e,r):zu&&(e instanceof ArrayBuffer||qu(e))?n?r(e):mc(new Blob([e]),r):r(jt[t]+(e||"")),mc=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)};function gc(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let Ko;function H0(t,e){if(Fu&&t.data instanceof Blob)return t.data.arrayBuffer().then(gc).then(e);if(zu&&(t.data instanceof ArrayBuffer||qu(t.data)))return e(gc(t.data));Ea(t,!1,n=>{Ko||(Ko=new TextEncoder),e(Ko.encode(n))})}const yc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",wr=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<yc.length;t++)wr[yc.charCodeAt(t)]=t;const F0=t=>{let e=t.length*.75,n=t.length,r,i=0,o,a,s,c;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=wr[t.charCodeAt(r)],a=wr[t.charCodeAt(r+1)],s=wr[t.charCodeAt(r+2)],c=wr[t.charCodeAt(r+3)],u[i++]=o<<2|a>>4,u[i++]=(a&15)<<4|s>>2,u[i++]=(s&3)<<6|c&63;return l},z0=typeof ArrayBuffer=="function",_a=(t,e)=>{if(typeof t!="string")return{type:"message",data:Vu(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:q0(t.substring(1),e)}:ki[n]?t.length>1?{type:ki[n],data:t.substring(1)}:{type:ki[n]}:Ns},q0=(t,e)=>{if(z0){const n=F0(t);return Vu(n,e)}else return{base64:!0,data:t}},Vu=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},Wu="�",V0=(t,e)=>{const n=t.length,r=new Array(n);let i=0;t.forEach((o,a)=>{Ea(o,!1,s=>{r[a]=s,++i===n&&e(r.join(Wu))})})},W0=(t,e)=>{const n=t.split(Wu),r=[];for(let i=0;i<n.length;i++){const o=_a(n[i],e);if(r.push(o),o.type==="error")break}return r};function G0(){return new TransformStream({transform(t,e){H0(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 Uo;function ti(t){return t.reduce((e,n)=>e+n.length,0)}function ni(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 Y0(t,e){Uo||(Uo=new TextDecoder);const n=[];let r=0,i=-1,o=!1;return new TransformStream({transform(a,s){for(n.push(a);;){if(r===0){if(ti(n)<1)break;const c=ni(n,1);o=(c[0]&128)===128,i=c[0]&127,i<126?r=3:i===126?r=1:r=2}else if(r===1){if(ti(n)<2)break;const c=ni(n,2);i=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),r=3}else if(r===2){if(ti(n)<8)break;const c=ni(n,8),l=new DataView(c.buffer,c.byteOffset,c.length),u=l.getUint32(0);if(u>Math.pow(2,21)-1){s.enqueue(Ns);break}i=u*Math.pow(2,32)+l.getUint32(4),r=3}else{if(ti(n)<i)break;const c=ni(n,i);s.enqueue(_a(o?c:Uo.decode(c),e)),r=0}if(i===0||i>t){s.enqueue(Ns);break}}}})}const Gu=4;function Oe(t){if(t)return Z0(t)}function Z0(t){for(var e in Oe.prototype)t[e]=Oe.prototype[e];return t}Oe.prototype.on=Oe.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};Oe.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this};Oe.prototype.off=Oe.prototype.removeListener=Oe.prototype.removeAllListeners=Oe.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};Oe.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};Oe.prototype.emitReserved=Oe.prototype.emit;Oe.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};Oe.prototype.hasListeners=function(t){return!!this.listeners(t).length};const Co=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0),yt=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),J0="arraybuffer";function Yu(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const X0=yt.setTimeout,Q0=yt.clearTimeout;function ko(t,e){e.useNativeTimers?(t.setTimeoutFn=X0.bind(yt),t.clearTimeoutFn=Q0.bind(yt)):(t.setTimeoutFn=yt.setTimeout.bind(yt),t.clearTimeoutFn=yt.clearTimeout.bind(yt))}const ep=1.33;function tp(t){return typeof t=="string"?np(t):Math.ceil((t.byteLength||t.size)*ep)}function np(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 Zu(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function rp(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function ip(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 op extends Error{constructor(e,n,r){super(e),this.description=n,this.context=r,this.type="TransportError"}}class Sa extends Oe{constructor(e){super(),this.writable=!1,ko(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 op(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=_a(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=rp(e);return n.length?"?"+n:""}}class sp extends Sa{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)};W0(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,V0(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]=Zu()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}}let Ju=!1;try{Ju=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const ap=Ju;function cp(){}class lp extends sp{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 Dt extends Oe{constructor(e,n,r){super(),this.createRequest=e,ko(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=Yu(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=Dt.requestsCount++,Dt.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=cp,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Dt.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()}}Dt.requestsCount=0;Dt.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",vc);else if(typeof addEventListener=="function"){const t="onpagehide"in yt?"pagehide":"unload";addEventListener(t,vc,!1)}}function vc(){for(let t in Dt.requests)Dt.requests.hasOwnProperty(t)&&Dt.requests[t].abort()}const up=function(){const t=Xu({xdomain:!1});return t&&t.responseType!==null}();class dp extends lp{constructor(e){super(e);const n=e&&e.forceBase64;this.supportsBinary=up&&!n}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Dt(Xu,this.uri(),e)}}function Xu(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||ap))return new XMLHttpRequest}catch{}if(!e)try{return new yt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Qu=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class hp extends Sa{get name(){return"websocket"}doOpen(){const e=this.uri(),n=this.opts.protocols,r=Qu?{}:Yu(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;Ea(r,this.supportsBinary,o=>{try{this.doWrite(r,o)}catch{}i&&Co(()=>{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]=Zu()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}}const Ho=yt.WebSocket||yt.MozWebSocket;class fp extends hp{createSocket(e,n,r){return Qu?new Ho(e,n,r):n?new Ho(e,n):new Ho(e)}doWrite(e,n){this.ws.send(n)}}class pp extends Sa{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=Y0(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(n).getReader(),i=G0();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();const o=()=>{r.read().then(({done:s,value:c})=>{s||(this.onPacket(c),o())}).catch(s=>{})};o();const a={type:"open"};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this._writer.write(a).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&&Co(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const mp={websocket:fp,webtransport:pp,polling:dp},gp=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,yp=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Ls(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=gp.exec(t||""),o={},a=14;for(;a--;)o[yp[a]]=i[a]||"";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=vp(o,o.path),o.queryKey=bp(o,o.query),o}function vp(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 bp(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}const Ds=typeof addEventListener=="function"&&typeof removeEventListener=="function",Ai=[];Ds&&addEventListener("offline",()=>{Ai.forEach(t=>t())},!1);class En extends Oe{constructor(e,n){if(super(),this.binaryType=J0,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=Ls(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=Ls(n.host).host);ko(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=ip(this.opts.query)),Ds&&(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"})},Ai.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=Gu,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&&En.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",En.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+=tp(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,Co(()=>{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(En.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(),Ds&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=Ai.indexOf(this._offlineEventListener);r!==-1&&Ai.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this._prevBufferLen=0}}}En.protocol=Gu;class wp extends En{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;En.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;En.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 a=d=>{const h=new Error("probe error: "+d);h.transport=n.name,o(),this.emitReserved("upgradeError",h)};function s(){a("transport closed")}function c(){a("socket closed")}function l(d){n&&d.name!==n.name&&o()}const u=()=>{n.removeListener("open",i),n.removeListener("error",a),n.removeListener("close",s
vendor: 10,498 bytes, line 8
8),this.off("close",c),this.off("upgrading",l)};n.once("open",i),n.once("error",a),n.once("close",s),this.once("close",c),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 Ep=class extends wp{constructor(e,n={}){const r=typeof e=="object",i=r?{...e}:{...n};(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(o=>mp[o]).filter(o=>!!o)),super(r?i:e,i)}};function _p(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=Ls(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 Sp=typeof ArrayBuffer=="function",Cp=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,ed=Object.prototype.toString,kp=typeof Blob=="function"||typeof Blob<"u"&&ed.call(Blob)==="[object BlobConstructor]",Ap=typeof File=="function"||typeof File<"u"&&ed.call(File)==="[object FileConstructor]";function Ca(t){return Sp&&(t instanceof ArrayBuffer||Cp(t))||kp&&t instanceof Blob||Ap&&t instanceof File}function xi(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n<r;n++)if(xi(t[n]))return!0;return!1}if(Ca(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return xi(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&xi(t[n]))return!0;return!1}function xp(t){const e=[],n=t.data,r=t;return r.data=Ti(n,e),r.attachments=e.length,{packet:r,buffers:e}}function Ti(t,e,n){if(!t)return t;if(Ca(t)){const r={_placeholder:!0,num:e.length};return e.push(t),r}else if(Array.isArray(t)){const r=new Array(t.length);for(let i=0;i<t.length;i++)r[i]=Ti(t[i],e);return r}else if(typeof t=="object"&&!(t instanceof Date)){if(t.toJSON&&typeof t.toJSON=="function"&&!n)return Ti(t.toJSON(),e,!0);const r={};for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=Ti(t[i],e));return r}return t}function Tp(t,e){return t.data=Bs(t.data,e),delete t.attachments,t}function Bs(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]=Bs(t[n],e);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=Bs(t[n],e));return t}const td=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Mp=5;var pe;(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"})(pe||(pe={}));class Rp{constructor(e){this.replacer=e}encode(e){return(e.type===pe.EVENT||e.type===pe.ACK)&&xi(e)?this.encodeAsBinary({type:e.type===pe.EVENT?pe.BINARY_EVENT:pe.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let n=""+e.type;return(e.type===pe.BINARY_EVENT||e.type===pe.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=xp(e),r=this.encodeAsString(n.packet),i=n.buffers;return i.unshift(r),i}}class ka extends Oe{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===pe.BINARY_EVENT;r||n.type===pe.BINARY_ACK?(n.type=r?pe.EVENT:pe.ACK,this.reconstructor=new Op(n)):super.emitReserved("decoded",n)}else if(Ca(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(pe[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===pe.BINARY_EVENT||r.type===pe.BINARY_ACK){const o=n+1;for(;e.charAt(++n)!=="-"&&n!=e.length;);const a=e.substring(o,n);if(a!=Number(a)||e.charAt(n)!=="-")throw new Error("Illegal attachments");const s=Number(a);if(!nd(s)||s<1)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 a=e.charAt(n);if(a==null||Number(a)!=a){--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(ka.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 pe.CONNECT:return Gi(n);case pe.DISCONNECT:return n===void 0;case pe.CONNECT_ERROR:return typeof n=="string"||Gi(n);case pe.EVENT:case pe.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&td.indexOf(n[0])===-1);case pe.ACK:case pe.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Op{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=Tp(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function Pp(t){return typeof t=="string"}const nd=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};function Ip(t){return t===void 0||nd(t)}function Gi(t){return Object.prototype.toString.call(t)==="[object Object]"}function Np(t,e){switch(t){case pe.CONNECT:return e===void 0||Gi(e);case pe.DISCONNECT:return e===void 0;case pe.EVENT:return Array.isArray(e)&&(typeof e[0]=="number"||typeof e[0]=="string"&&td.indexOf(e[0])===-1);case pe.ACK:return Array.isArray(e);case pe.CONNECT_ERROR:return typeof e=="string"||Gi(e);default:return!1}}function Lp(t){return Pp(t.nsp)&&Ip(t.id)&&Np(t.type,t.data)}const Dp=Object.freeze(Object.defineProperty({__proto__:null,Decoder:ka,Encoder:Rp,get PacketType(){return pe},isPacketValid:Lp,protocol:Mp},Symbol.toStringTag,{value:"Module"}));function Et(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const Bp=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class rd extends Oe{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=[Et(e,"open",this.onopen.bind(this)),Et(e,"packet",this.onpacket.bind(this)),Et(e,"error",this.onerror.bind(this)),Et(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(Bp.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 a={type:pe.EVENT,data:n};if(a.options={},a.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const u=this.ids++,d=n.pop();this._registerAckCallback(u,d),a.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,c=this.connected&&!(!((o=this.io.engine)===null||o===void 0)&&o._hasPingExpired());return this.flags.volatile&&!s||(c?(this.notifyOutgoingListeners(a),this.packet(a)):this.sendBuffer.push(a)),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),a=(...s)=>{this.io.clearTimeoutFn(o),n.apply(this,s)};a.withError=!0,this.acks[e]=a}emitWithAck(e,...n){return new Promise((r,i)=>{const o=(a,s)=>a?i(a):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:pe.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()}
vendor: 7,082 bytes, line 8
8_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 pe.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 pe.EVENT:case pe.BINARY_EVENT:this.onevent(e);break;case pe.ACK:case pe.BINARY_ACK:this.onack(e);break;case pe.DISCONNECT:this.ondisconnect();break;case pe.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:pe.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:pe.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 ur(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}ur.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?t+n:t-n}return Math.min(t,this.max)|0};ur.prototype.reset=function(){this.attempts=0};ur.prototype.setMin=function(t){this.ms=t};ur.prototype.setMax=function(t){this.max=t};ur.prototype.setJitter=function(t){this.jitter=t};class $s extends Oe{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,ko(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 ur({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||Dp;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 Ep(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=Et(n,"open",function(){r.onopen(),e&&e()}),o=s=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",s),e?e(s):this.maybeReconnectOnOpen()},a=Et(n,"error",o);if(this._timeout!==!1){const s=this._timeout,c=this.setTimeoutFn(()=>{i(),o(new Error("timeout")),n.close()},s);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(i),this.subs.push(a),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Et(e,"ping",this.onping.bind(this)),Et(e,"data",this.ondata.bind(this)),Et(e,"error",this.onerror.bind(this)),Et(e,"close",this.onclose.bind(this)),Et(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){Co(()=>{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 rd(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)}
8cleanup(){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 pr={};function Mi(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=_p(t,e.path||"/socket.io"),r=n.source,i=n.id,o=n.path,a=pr[i]&&o in pr[i].nsps,s=e.forceNew||e["force new connection"]||e.multiplex===!1||a;let c;return s?c=new $s(r,e):(pr[i]||(pr[i]=new $s(r,e)),c=pr[i]),n.query&&!e.query&&(e.query=n.queryKey),c.socket(n.path,e)}Object.assign(Mi,{Manager:$s,Socket:rd,io:Mi,connect:Mi});function Z(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(l){try{c(r.next(l))}catch(u){o(u)}}function s(l){try{c(r.throw(l))}catch(u){o(u)}}function c(l){var u;l.done?i(l.value):(u=l.value,u instanceof n?u:new n(function(d){d(u)})).then(a,s)}c((r=r.apply(t,e||[])).next())})}var Ze=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},Mt=[],pt=[],$p=typeof Uint8Array<"u"?Uint8Array:Array,Aa=!1;function id(){Aa=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0;e<64;++e)Mt[e]=t[e],pt[t.charCodeAt(e)]=e;pt[45]=62,pt[95]=63}function jp(t,e,n){for(var r,i,o=[],a=e;a<n;a+=3)r=(t[a]<<16)+(t[a+1]<<8)+t[a+2],o.push(Mt[(i=r)>>18&63]+Mt[i>>12&63]+Mt[i>>6&63]+Mt[63&i]);return o.join("")}function bc(t){var e;Aa||id();for(var n=t.length,r=n%3,i="",o=[],a=16383,s=0,c=n-r;s<c;s+=a)o.push(jp(t,s,s+a>c?c:s+a));return r===1?(e=t[n-1],i+=Mt[e>>2],i+=Mt[e<<4&63],i+="=="):r===2&&(e=(t[n-2]<<8)+t[n-1],i+=Mt[e>>10],i+=Mt[e>>4&63],i+=Mt[e<<2&63],i+="="),o.push(i),o.join("")}function ri(t,e,n,r,i){var o,a,s=8*i-r-1,c=(1<<s)-1,l=c>>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(a=o&(1<<-u)-1,o>>=-u,u+=r;u>0;a=256*a+t[e+d],d+=h,u-=8);if(o===0)o=1-l;else{if(o===c)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),o-=l}return(f?-1:1)*a*Math.pow(2,o-r)}function od(t,e,n,r,i,o){var a,s,c,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,g=r?1:-1,m=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=u):(a=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-a))<1&&(a--,c*=2),(e+=a+d>=1?h/c:h*Math.pow(2,1-d))*c>=2&&(a++,c/=2),a+d>=u?(s=0,a=u):a+d>=1?(s=(e*c-1)*Math.pow(2,i),a+=d):(s=e*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;t[n+f]=255&s,f+=g,s/=256,i-=8);for(a=a<<i|s,l+=i;l>0;t[n+f]=255&a,f+=g,a/=256,l-=8);t[n+f-g]|=128*m}var Kp={}.toString,sd=Array.isArray||function(t){return Kp.call(t)=="[object Array]"};X.TYPED_ARRAY_SUPPORT=Ze.TYPED_ARRAY_SUPPORT===void 0||Ze.TYPED_ARRAY_SUPPORT;var Up=Yi();function Yi(){return X.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Gt(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 js(this,t)}return ad(this,t,e,n)}function ad(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,a,s){if
vendor: 10,024 bytes, line 8
8(o.byteLength,a<0||o.byteLength<a)throw new RangeError("'offset' is out of bounds");if(o.byteLength<a+(s||0))throw new RangeError("'length' is out of bounds");return o=a===void 0&&s===void 0?new Uint8Array(o):s===void 0?new Uint8Array(o,a):new Uint8Array(o,a,s),X.TYPED_ARRAY_SUPPORT?(i=o).__proto__=X.prototype:i=Fo(i,o),i}(t,e,n,r):typeof e=="string"?function(i,o,a){if(typeof a=="string"&&a!==""||(a="utf8"),!X.isEncoding(a))throw new TypeError('"encoding" must be a valid string encoding');var s=0|ld(o,a);i=Gt(i,s);var c=i.write(o,a);return c!==s&&(i=i.slice(0,c)),i}(t,e,n):function(i,o){if(Rt(o)){var a=0|xa(o.length);return(i=Gt(i,a)).length===0||o.copy(i,0,0,a),i}if(o){if(typeof ArrayBuffer<"u"&&o.buffer instanceof ArrayBuffer||"length"in o)return typeof o.length!="number"||(s=o.length)!=s?Gt(i,0):Fo(i,o);if(o.type==="Buffer"&&sd(o.data))return Fo(i,o.data)}var s;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function cd(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 js(t,e){if(cd(e),t=Gt(t,e<0?0:0|xa(e)),!X.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function Fo(t,e){var n=e.length<0?0:0|xa(e.length);t=Gt(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function xa(t){if(t>=Yi())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Yi().toString(16)+" bytes");return 0|t}function Rt(t){return!(t==null||!t._isBuffer)}function ld(t,e){if(Rt(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 fd(t).length;default:if(r)return Zi(t).length;e=(""+e).toLowerCase(),r=!0}}function Hp(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 Jp(this,e,n);case"utf8":case"utf-8":return dd(this,e,n);case"ascii":return Yp(this,e,n);case"latin1":case"binary":return Zp(this,e,n);case"base64":return Gp(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Xp(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function xn(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)),Rt(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,a=1,s=t.length,c=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;a=2,s/=2,c/=2,n/=2}function l(f,g){return a===1?f[g]:f.readUInt16BE(g*a)}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===c)return u*a}else u!==-1&&(o-=o-u),u=-1}else for(n+c>s&&(n=s-c),o=n;o>=0;o--){for(var d=!0,h=0;h<c;h++)if(l(t,o+h)!==l(e,h)){d=!1;break}if(d)return o}return-1}function Fp(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 a=0;a<r;++a){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))return a;t[n+a]=s}return a}function zp(t,e,n,r){return Ao(Zi(e,t.length-n),t,n,r)}function ud(t,e,n,r){return Ao(function(i){for(var o=[],a=0;a<i.length;++a)o.push(255&i.charCodeAt(a));return o}(e),t,n,r)}function qp(t,e,n,r){return ud(t,e,n,r)}function Vp(t,e,n,r){return Ao(fd(e),t,n,r)}function Wp(t,e,n,r){return Ao(function(i,o){for(var a,s,c,l=[],u=0;u<i.length&&!((o-=2)<0);++u)s=(a=i.charCodeAt(u))>>8,c=a%256,l.push(c),l.push(s);return l}(e,t.length-n),t,n,r)}function Gp(t,e,n){return e===0&&n===t.length?bc(t):bc(t.slice(e,n))}function dd(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var o,a,s,c,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&&(c=(31&l)<<6|63&o)>127&&(u=c);break;case 3:o=t[i+1],a=t[i+2],(192&o)==128&&(192&a)==128&&(c=(15&l)<<12|(63&o)<<6|63&a)>2047&&(c<55296||c>57343)&&(u=c);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],(192&o)==128&&(192&a)==128&&(192&s)==128&&(c=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&c<1114112&&(u=c)}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 g="",m=0;m<f;)g+=String.fromCharCode.apply(String,h.slice(m,m+=_c));return g}(r)}X.poolSize=8192,X._augment=function(t){return t.__proto__=X.prototype,t},X.from=function(t,e,n){return ad(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,a){return cd(i),i<=0?Gt(r,i):o!==void 0?typeof a=="string"?Gt(r,i).fill(o,a):Gt(r,i).fill(o):Gt(r,i)}(null,t,e,n)},X.allocUnsafe=function(t){return js(null,t)},X.allocUnsafeSlow=function(t){return js(null,t)},X.isBuffer=pd,X.compare=function(t,e){if(!Rt(t)||!Rt(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(!sd(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(!Rt(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},X.byteLength=ld,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)xn(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)xn(this,e,e+3),xn(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)xn(this,e,e+7),xn(this,e+1,e+6),xn(this,e+2,e+5),xn(this,e+3,e+4);return this},X.prototype.toString=function(){var t=0|this.length;return t===0?"":arguments.length===0?dd(this,0,t):Hp.apply(this,arguments)},X.prototype.equals=function(t){if(!Rt(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(!Rt(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),a=(n>>>=0)-(e>>>=0),s=Math.min(o,a),c=this.slice(r,i),l=t.slice(e,n),u=0;u<s;++u)if(c[u]!==l[u]){o=c[u],a=l[u];break}return o<a?-1:a<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 Fp(this,t,e,n);case"utf8":case"utf-8":return zp(this,t,e,n);case"ascii":return ud(this,t,e,n);case"latin1":case"binary":return qp(this,t,e,n);case"base64":return Vp(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Wp(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 Yp(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 Zp(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 Jp(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+=em(t[o]);return i}function Xp(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 Ie(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")}
vendor: 4,278 bytes, line 8
8function Je(t,e,n,r,i,o){if(!Rt(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 ii(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 oi(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 hd(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||hd(t,0,n,4),od(t,e,n,r,23,4),n+4}function Cc(t,e,n,r,i){return i||hd(t,0,n,8),od(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||Ie(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||Ie(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||Ie(t,1,this.length),this[t]},X.prototype.readUInt16LE=function(t,e){return e||Ie(t,2,this.length),this[t]|this[t+1]<<8},X.prototype.readUInt16BE=function(t,e){return e||Ie(t,2,this.length),this[t]<<8|this[t+1]},X.prototype.readUInt32LE=function(t,e){return e||Ie(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||Ie(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||Ie(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||Ie(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||Ie(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},X.prototype.readInt16LE=function(t,e){e||Ie(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||Ie(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||Ie(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||Ie(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||Ie(t,4,this.length),ri(this,t,!0,23,4)},X.prototype.readFloatBE=function(t,e){return e||Ie(t,4,this.length),ri(this,t,!1,23,4)},X.prototype.readDoubleLE=function(t,e){return e||Ie(t,8,this.length),ri(this,t,!0,52,8)},X.prototype.readDoubleBE=function(t,e){return e||Ie(t,8,this.length),ri(this,t,!1,52,8)},X.prototype.writeUIntLE=function(t,e,n,r){t=+t,e|=0,n|=0,r||Je(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||Je(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||Je(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||Je(this,t,e,2,65535,0),X.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):ii(this,t,e,!0),e+2},X.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||Je(this,t,e,2,65535,0),X.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):ii(this,t,e,!1),e+2},X.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||Je(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):oi(this,t,e,!0),e+4},X.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||Je(this,t,e,4,4294967295,0),X.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>
88,this[e+3]=255&t):oi(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);Je(this,t,e,n,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o<n&&(a*=256);)t<0&&s===0&&this[e+o-1]!==0&&(s=1),this[e+o]=(t/a>>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);Je(this,t,e,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&s===0&&this[e+o+1]!==0&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+n},X.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||Je(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||Je(this,t,e,2,32767,-32768),X.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):ii(this,t,e,!0),e+2},X.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||Je(this,t,e,2,32767,-32768),X.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):ii(this,t,e,!1),e+2},X.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||Je(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):oi(this,t,e,!0),e+4},X.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||Je(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):oi(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 a=Rt(t)?t:Zi(new X(t,r).toString()),s=a.length;for(o=0;o<n-e;++o)this[o+e]=a[o%s]}return this};var Qp=/[^+\/0-9A-Za-z-_]/g;function em(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=[],a=0;a<r;++a){if((n=t.charCodeAt(a))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+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 fd(t){return function(e){var n,r,i,o,a,s;Aa||id();var c=e.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a=e[c-2]==="="?2:e[c-1]==="="?1:0,s=new $p(3*c/4-a),i=a>0?c-4:c;var l=0;for(n=0,r=0;n<i;n+=4,r+=3)o=pt[e.charCodeAt(n)]<<18|pt[e.charCodeAt(n+1)]<<12|pt[e.charCodeAt(n+2)]<<6|pt[e.charCodeAt(n+3)],s[l++]=o>>16&255,s[l++]=o>>8&255,s[l++]=255&o;return a===2?(o=pt[e.charCodeAt(n)]<<2|pt[e.charCodeAt(n+1)]>>4,s[l++]=255&o):a===1&&(o=pt[e.charCodeAt(n)]<<10|pt[e.charCodeAt(n+1)]<<4|pt[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(Qp,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(t))}function Ao(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 pd(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 tm=Object.freeze({__proto__:null,Buffer:X,INSPECT_MAX_BYTES:50,SlowBuffer:function(t){return+t!=t&&(t=0),X.alloc(+t)},isBuffer:pd,kMaxLength:Up}),vt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xo(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}
8function 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 Vn={},ct={},Fe={};function Ji(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`positive integer expected, not ${t}`)}function md(t){if(typeof t!="boolean")throw new Error(`boolean expected, not ${t}`)}function gd(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function Ta(t,...e){if(!gd(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 yd(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 vd(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 bd(t,e){Ta(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}Object.defineProperty(Fe,"__esModule",{value:!0}),Fe.isBytes=gd,Fe.number=Ji,Fe.bool=md,Fe.bytes=Ta,Fe.hash=yd,Fe.exists=vd,Fe.output=bd;const nm={number:Ji,bool:md,bytes:Ta,hash:yd,exists:vd,output:bd};Fe.default=nm,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=a,t.hexToNumber=s,t.bytesToNumberBE=function(d){return s(r(d))},t.numberToBytesBE=function(d,h){return a(d.toString(16).padStart(2*h,"0"))},t.asyncLoop=async function(d,h,f){let g=Date.now();for(let m=0;m<d;m++){f(m);const w=Date.now()-g;w>=0&&w<h||(await(0,t.nextTick)(),g+=w)}},t.utf8ToBytes=c,t.bytesToUtf8=function(d){return new TextDecoder().decode(d)},t.toBytes=function(d){if(typeof d=="string")d=c(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 g=0;g<d.length;g++){const m=d[g];(0,e.bytes)(m),h+=m.length}const f=new Uint8Array(h);for(let g=0,m=0;g<d.length;g++){const w=d[g];f.set(w,m),m+=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 g=0;g<d.length;g++)f|=d[g]^h[g];return f===0},t.setBigUint64=l,t.u64Lengths=function(d,h){const f=new Uint8Array(16),g=(0,t.createView)(f);return l(g,0,BigInt(h?h.length:0),!0),l(g,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=Fe;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 a(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 g=new Uint8Array(f);for(let m=0,w=0;m<f;m++,w+=2){const p=o(d.charCodeAt(w)),S=o(d.charCodeAt(w+1));if(p===void 0||S===void 0){const _=d[w]+d[w+1];throw new Error('hex string expected, got non-hex character "'+_+'" at index '+w)}g[m]=16*p+S}return g}function s(d){if(typeof d!="string")throw new Error("hex string expected, got "+typeof d);return BigInt(d===""?"0":`0x${d}`)}function c(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,g){if(typeof d.setBigUint64=="function")return d.setBigUint64(h,f,g);
8const m=BigInt(32),w=BigInt(4294967295),p=Number(f>>m&w),S=Number(f&w),_=g?4:0,O=g?0:4;d.setUint32(h+_,p,g),d.setUint32(h+O,S,g)}function u(d){return Uint8Array.from(d)}t.wrapCipher=(d,h)=>(Object.assign(h,d),h)}(ct);var Ir={},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")}}(Ir);var zo={},Xi={},To={},wd={},Ma={},si={};Object.defineProperty(si,"__esModule",{value:!0}),si.crypto=void 0,si.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(c){return(0,n.number)(c.nonceLength),(l,...u)=>({encrypt(d,...h){const{nonceLength:f}=c,g=i(f),m=c(l,g,...u).encrypt(d,...h),w=(0,r.concatBytes)(g,m);return m.fill(0),w},decrypt(d,...h){const{nonceLength:f}=c,g=d.subarray(0,f),m=d.subarray(f);return c(l,g,...u).decrypt(m,...h)}})};const e=si,n=Fe,r=ct;function i(c=32){if(e.crypto&&typeof e.crypto.getRandomValues=="function")return e.crypto.getRandomValues(new Uint8Array(c));if(e.crypto&&typeof e.crypto.randomBytes=="function")return e.crypto.randomBytes(c);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(c,l,u,d){const h=o(),f=await h.importKey("raw",c,l,!0,["encrypt"]),g=await h.encrypt(u,f,d);return new Uint8Array(g)},async decrypt(c,l,u,d){const h=o(),f=await h.importKey("raw",c,l,!0,["decrypt"]),g=await h.decrypt(u,f,d);return new Uint8Array(g)}};const a={CBC:"AES-CBC",CTR:"AES-CTR",GCM:"AES-GCM"};function s(c){return(l,u,d)=>{(0,n.bytes)(l),(0,n.bytes)(u);const h={name:c,length:8*l.length},f=function(g,m,w){if(g===a.CBC)return{name:a.CBC,iv:m};if(g===a.CTR)return{name:a.CTR,counter:m,length:64};if(g===a.GCM)return w?{name:a.GCM,iv:m,additionalData:w}:{name:a.GCM,iv:m};throw new Error("unknown aes block mode")}(c,u,d);return{encrypt:g=>((0,n.bytes)(g),t.utils.encrypt(l,h,f,g)),decrypt:g=>((0,n.bytes)(g),t.utils.decrypt(l,h,f,g))}}}t.cbc=s(a.CBC),t.ctr=s(a.CTR),t.gcm=s(a.GCM)}(Ma);var Ed={},Le={},Yt={},st={};function Qi(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`positive integer expected, not ${t}`)}function _d(t){if(typeof t!="boolean")throw new Error(`boolean expected, not ${t}`)}function Sd(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function Ra(t,...e){if(!Sd(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 Cd(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 kd(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){Ra(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}
8Object.defineProperty(st,"__esModule",{value:!0}),st.isBytes=Sd,st.number=Qi,st.bool=_d,st.bytes=Ra,st.hash=Cd,st.exists=kd,st.output=Ad;const rm={number:Qi,bool:_d,bytes:Ra,hash:Cd,exists:kd,output:Ad};st.default=rm;var en={},ai={};Object.defineProperty(ai,"__esModule",{value:!0}),ai.crypto=void 0,ai.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,g=0;f<d;f++,g+=2){const m=o(l.charCodeAt(g)),w=o(l.charCodeAt(g+1));if(m===void 0||w===void 0){const p=l[g]+l[g+1];throw new Error('hex string expected, got non-hex character "'+p+'" at index '+g)}h[f]=16*m+w}return h},t.asyncLoop=async function(l,u,d){let h=Date.now();for(let f=0;f<l;f++){d(f);const g=Date.now()-h;g>=0&&g<u||(await(0,t.nextTick)(),h+=g)}},t.utf8ToBytes=a,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 g=l[h];d.set(g,f),f+=g.length}return d},t.checkOpts=function(l,u){if(u!==void 0&&c.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=ai,n=st;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 a(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=a(l)),(0,n.bytes)(l),l}t.nextTick=async()=>{},t.Hash=class{clone(){return this._cloneInto()}};const c={}.toString}(en),Object.defineProperty(Yt,"__esModule",{value:!0}),Yt.HashMD=Yt.Maj=Yt.Chi=void 0;const qo=st,mr=en;Yt.Chi=(t,e,n)=>t&e^~t&n;Yt.Maj=(t,e,n)=>t&e^t&n^e&n;Yt.HashMD=class extends mr.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,mr.createView)(this.buffer)}update(t){(0,qo.exists)(this);const{view:e,buffer:n,blockLen:r}=this,i=(t=(0,mr.toBytes)(t)).length;for(let o=0;o<i;){const a=Math.min(r-this.pos,i-o);if(a!==r)n.set(t.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===r&&(this.process(e,0),this.pos=0);else{const s=(0,mr.createView)(t);for(;r<=i-o;o+=r)this.process(s,o)}}return this.length+=t.length,this.roundClean(),this}digestInto(t){(0,qo.exists)(this),(0,qo.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 g=BigInt(32),m=BigInt(4294967295),w=Number(h>>g&m),p=Number(h&m),S=f?4:0,_=f?0:4;u.setUint32(d+S,w,f),u.setUint32(d+_,p,f)})(n,r-8,BigInt(8*this.length),i),this.process(n,0);const a=(0,mr.createView)(t),s=this.outputLen;if(s%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=s/4,l=this.get();if(c>l.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<c;u++)a.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:a}=this;return t.length=r,t.pos=a,t.finished=i,t.destroyed=o,r%e&&t.buffer.set(n),t}};var he={};
8Object.defineProperty(he,"__esModule",{value:!0}),he.add5L=he.add5H=he.add4H=he.add4L=he.add3H=he.add3L=he.rotlBL=he.rotlBH=he.rotlSL=he.rotlSH=he.rotr32L=he.rotr32H=he.rotrBL=he.rotrBH=he.rotrSL=he.rotrSH=he.shrSL=he.shrSH=he.toBig=void 0,he.fromBig=Oa,he.split=xd,he.add=Ud;const ci=BigInt(2**32-1),Ks=BigInt(32);function Oa(t,e=!1){return e?{h:Number(t&ci),l:Number(t>>Ks&ci)}:{h:0|Number(t>>Ks&ci),l:0|Number(t&ci)}}function xd(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:a}=Oa(t[i],e);[n[i],r[i]]=[o,a]}return[n,r]}const Td=(t,e)=>BigInt(t>>>0)<<Ks|BigInt(e>>>0);he.toBig=Td;const Md=(t,e,n)=>t>>>n;he.shrSH=Md;const Rd=(t,e,n)=>t<<32-n|e>>>n;he.shrSL=Rd;const Od=(t,e,n)=>t>>>n|e<<32-n;he.rotrSH=Od;const Pd=(t,e,n)=>t<<32-n|e>>>n;he.rotrSL=Pd;const Id=(t,e,n)=>t<<64-n|e>>>n-32;he.rotrBH=Id;const Nd=(t,e,n)=>t>>>n-32|e<<64-n;he.rotrBL=Nd;const Ld=(t,e)=>e;he.rotr32H=Ld;const Dd=(t,e)=>t;he.rotr32L=Dd;const Bd=(t,e,n)=>t<<n|e>>>32-n;he.rotlSH=Bd;const $d=(t,e,n)=>e<<n|t>>>32-n;he.rotlSL=$d;const jd=(t,e,n)=>e<<n-32|t>>>64-n;he.rotlBH=jd;const Kd=(t,e,n)=>t<<n-32|e>>>64-n;function Ud(t,e,n,r){const i=(e>>>0)+(r>>>0);return{h:t+n+(i/2**32|0)|0,l:0|i}}he.rotlBL=Kd;const Hd=(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0);he.add3L=Hd;const Fd=(t,e,n,r)=>e+n+r+(t/2**32|0)|0;he.add3H=Fd;const zd=(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0);he.add4L=zd;const qd=(t,e,n,r,i)=>e+n+r+i+(t/2**32|0)|0;he.add4H=qd;const Vd=(t,e,n,r,i)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(i>>>0);he.add5L=Vd;const Wd=(t,e,n,r,i,o)=>e+n+r+i+o+(t/2**32|0)|0;he.add5H=Wd;const im={fromBig:Oa,split:xd,toBig:Td,shrSH:Md,shrSL:Rd,rotrSH:Od,rotrSL:Pd,rotrBH:Id,rotrBL:Nd,rotr32H:Ld,rotr32L:Dd,rotlSH:Bd,rotlSL:$d,rotlBH:jd,rotlBL:Kd,add:Ud,add3L:Hd,add3H:Fd,add4L:zd,add4H:qd,add5H:Wd,add5L:Vd};he.default=im,Object.defineProperty(Le,"__esModule",{value:!0}),Le.sha384=Le.sha512_256=Le.sha512_224=Le.sha512=Le.SHA384=Le.SHA512_256=Le.SHA512_224=Le.SHA512=void 0;const om=Yt,fe=he,li=en,[sm,am]=fe.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","0xf40e3585
85771202a","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))),tn=new Uint32Array(80),nn=new Uint32Array(80);class Zr extends om.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:a,Dh:s,Dl:c,Eh:l,El:u,Fh:d,Fl:h,Gh:f,Gl:g,Hh:m,Hl:w}=this;return[e,n,r,i,o,a,s,c,l,u,d,h,f,g,m,w]}set(e,n,r,i,o,a,s,c,l,u,d,h,f,g,m,w){this.Ah=0|e,this.Al=0|n,this.Bh=0|r,this.Bl=0|i,this.Ch=0|o,this.Cl=0|a,this.Dh=0|s,this.Dl=0|c,this.Eh=0|l,this.El=0|u,this.Fh=0|d,this.Fl=0|h,this.Gh=0|f,this.Gl=0|g,this.Hh=0|m,this.Hl=0|w}process(e,n){for(let _=0;_<16;_++,n+=4)tn[_]=e.getUint32(n),nn[_]=e.getUint32(n+=4);for(let _=16;_<80;_++){const O=0|tn[_-15],I=0|nn[_-15],j=fe.default.rotrSH(O,I,1)^fe.default.rotrSH(O,I,8)^fe.default.shrSH(O,I,7),q=fe.default.rotrSL(O,I,1)^fe.default.rotrSL(O,I,8)^fe.default.shrSL(O,I,7),F=0|tn[_-2],U=0|nn[_-2],K=fe.default.rotrSH(F,U,19)^fe.default.rotrBH(F,U,61)^fe.default.shrSH(F,U,6),G=fe.default.rotrSL(F,U,19)^fe.default.rotrBL(F,U,61)^fe.default.shrSL(F,U,6),$=fe.default.add4L(q,G,nn[_-7],nn[_-16]),L=fe.default.add4H($,j,K,tn[_-7],tn[_-16]);tn[_]=0|L,nn[_]=0|$}let{Ah:r,Al:i,Bh:o,Bl:a,Ch:s,Cl:c,Dh:l,Dl:u,Eh:d,El:h,Fh:f,Fl:g,Gh:m,Gl:w,Hh:p,Hl:S}=this;for(let _=0;_<80;_++){const O=fe.default.rotrSH(d,h,14)^fe.default.rotrSH(d,h,18)^fe.default.rotrBH(d,h,41),I=fe.default.rotrSL(d,h,14)^fe.default.rotrSL(d,h,18)^fe.default.rotrBL(d,h,41),j=d&f^~d&m,q=h&g^~h&w,F=fe.default.add5L(S,I,q,am[_],nn[_]),U=fe.default.add5H(F,p,O,j,sm[_],tn[_]),K=0|F,G=fe.default.rotrSH(r,i,28)^fe.default.rotrBH(r,i,34)^fe.default.rotrBH(r,i,39),$=fe.default.rotrSL(r,i,28)^fe.default.rotrBL(r,i,34)^fe.default.rotrBL(r,i,39),L=r&o^r&s^o&s,R=i&a^i&c^a&c;p=0|m,S=0|w,m=0|f,w=0|g,f=0|d,g=0|h,{h:d,l:h}=fe.default.add(0|l,0|u,0|U,0|K),l=0|s,u=0|c,s=0|o,c=0|a,o=0|r,a=0|i;const C=fe.default.add3L(K,$,R);r=fe.default.add3H(C,U,G,L),i=0|C}({h:r,l:i}=fe.default.add(0|this.Ah,0|this.Al,0|r,0|i)),{h:o,l:a}=fe.default.add(0|this.Bh,0|this.Bl,0|o,0|a),{h:s,l:c}=fe.default.add(0|this.Ch,0|this.Cl,0|s,0|c),{h:l,l:u}=fe.default.add(0|this.Dh,0|this.Dl,0|l,0|u),{h:d,l:h}=fe.default.add(0|this.Eh,0|this.El,0|d,0|h),{h:f,l:g}=fe.default.add(0|this.Fh,0|this.Fl,0|f,0|g),{h:m,l:w}=fe.default.add(0|this.Gh,0|this.Gl,0|m,0|w),{h:p,l:S}=fe.default.add(0|this.Hh,0|this.Hl,0|p,0|S),this.set(r,i,o,a,s,c,l,u,d,h,f,g,m,w,p,S)}roundClean(){tn.fill(0),nn.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)}}Le.SHA512=Zr;class Gd 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}}Le.SHA512_224=Gd;class Yd 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}}Le.SHA512_256=Yd;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}}Le.SHA384=Ac,Le.sha512=(0,li.wrapConstructor)(()=>new Zr),Le.sha512_224=(0,li.wrapConstructor)(()=>new Gd),Le.sha512_256=(0,li.wrapConstructor)(()=>new Yd),Le.sha384=(0,li.wrapConstructor)(()=>new Ac);var Us={},Gn={},Ce={},me={};
8Object.defineProperty(me,"__esModule",{value:!0}),me.notImplemented=me.bitMask=void 0,me.isBytes=eo,me.abytes=to,me.abool=function(t,e){if(typeof e!="boolean")throw new Error(`${t} must be valid boolean, got "${e}".`)},me.bytesToHex=Vo,me.numberToHexUnpadded=xc,me.hexToNumber=Wo,me.hexToBytes=Oi,me.bytesToNumberBE=function(t){return Wo(Vo(t))},me.bytesToNumberLE=function(t){return to(t),Wo(Vo(Uint8Array.from(t).reverse()))},me.numberToBytesBE=Mc,me.numberToBytesLE=function(t,e){return Mc(t,e).reverse()},me.numberToVarBytesBE=function(t){return Oi(xc(t))},me.ensureBytes=function(t,e,n){let r;if(typeof e=="string")try{r=Oi(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},me.concatBytes=Rc,me.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},me.utf8ToBytes=function(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))},me.inRange=Oc,me.aInRange=function(t,e,n,r){if(!Oc(e,n,r))throw new Error(`expected valid ${t}: ${n} <= n < ${r}, got ${typeof e} ${e}`)},me.bitLen=function(t){let e;for(e=0;t>Hs;t>>=Ri,e+=1);return e},me.bitGet=function(t,e){return t>>BigInt(e)&Ri},me.bitSet=function(t,e,n){return t|(n?Ri:Hs)<<BigInt(e)},me.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=Yo(t),i=Yo(t),o=0;const a=()=>{r.fill(1),i.fill(0),o=0},s=(...u)=>n(i,r,...u),c=(u=Yo())=>{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(a(),c(u);!(h=d(l()));)c();return a(),h}},me.validateObject=function(t,e,n={}){const r=(i,o,a)=>{const s=um[o];if(typeof s!="function")throw new Error(`Invalid validator "${o}", expected function`);const c=t[i];if(!(a&&c===void 0||s(c,t)))throw new Error(`Invalid param ${String(i)}=${c} (${typeof c}), 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},me.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 Hs=BigInt(0),Ri=BigInt(1),cm=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 lm=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Vo(t){to(t);let e="";for(let n=0;n<t.length;n++)e+=lm[t[n]];return e}function xc(t){const e=t.toString(16);return 1&e.length?`0${e}`:e}function Wo(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}const Ht={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function Tc(t){return t>=Ht._0&&t<=Ht._9?t-Ht._0:t>=Ht._A&&t<=Ht._F?t-(Ht._A-10):t>=Ht._a&&t<=Ht._f?t-(Ht._a-10):void 0}function Oi(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 a=Tc(t.charCodeAt(o)),s=Tc(t.charCodeAt(o+1));if(a===void 0||s===void 0){const c=t[o]+t[o+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+o)}r[i]=16*a+s}return r}function Mc(t,e){return Oi(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 Go=t=>typeof t=="bigint"&&Hs<=t;function Oc(t,e,n){return Go(t)&&Go(e)&&Go(n)&&e<=t&&t<n}me.bitMask=t=>(cm<<BigInt(t-1))-Ri;const Yo=t=>new Uint8Array(t),Pc=t=>Uint8Array.from(t),um={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)};me.notImplemented=()=>{throw new Error("not implemented")}
8,Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.isNegativeLE=void 0,Ce.mod=it,Ce.pow=Zd,Ce.pow2=function(t,e,n){let r=t;for(;e-- >De;)r*=r,r%=n;return r},Ce.invert=ui,Ce.tonelliShanks=Jd,Ce.FpSqrt=Lc,Ce.validateField=function(t){const e=hm.reduce((n,r)=>(n[r]="function",n),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"});return(0,nt.validateObject)(t,e)},Ce.FpPow=Dc,Ce.FpInvertBatch=Bc,Ce.FpDiv=function(t,e,n){return t.mul(e,typeof n=="bigint"?ui(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=Zo,Ce.Field=function(t,e,n=!1,r={}){if(t<=De)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:o}=Zo(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const a=Lc(t),s=Object.freeze({ORDER:t,BITS:i,BYTES:o,MASK:(0,nt.bitMask)(i),ZERO:De,ONE:ke,create:c=>it(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error("Invalid field element: expected bigint, got "+typeof c);return De<=c&&c<t},is0:c=>c===De,isOdd:c=>(c&ke)===ke,neg:c=>it(-c,t),eql:(c,l)=>c===l,sqr:c=>it(c*c,t),add:(c,l)=>it(c+l,t),sub:(c,l)=>it(c-l,t),mul:(c,l)=>it(c*l,t),pow:(c,l)=>Dc(s,c,l),div:(c,l)=>it(c*ui(l,t),t),sqrN:c=>c*c,addN:(c,l)=>c+l,subN:(c,l)=>c-l,mulN:(c,l)=>c*l,inv:c=>ui(c,t),sqrt:r.sqrt||(c=>a(s,c)),invertBatch:c=>Bc(s,c),cmov:(c,l,u)=>u?l:c,toBytes:c=>n?(0,nt.numberToBytesLE)(c,o):(0,nt.numberToBytesBE)(c,o),fromBytes:c=>{if(c.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${c.length}`);return n?(0,nt.bytesToNumberLE)(c):(0,nt.bytesToNumberBE)(c)}});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,nt.ensureBytes)("privateHash",t);const r=t.length,i=Zo(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,nt.bytesToNumberLE)(t):(0,nt.bytesToNumberBE)(t);return it(o,e-ke)+ke},Ce.getFieldBytesLength=zs,Ce.getMinHashLength=jc,Ce.mapHashToField=function(t,e,n=!1){const r=t.length,i=zs(e),o=jc(e);if(r<16||r<o||r>1024)throw new Error(`expected ${o}-1024 bytes of input, got ${r}`);const a=it(n?(0,nt.bytesToNumberBE)(t):(0,nt.bytesToNumberLE)(t),e-ke)+ke;return n?(0,nt.numberToBytesLE)(a,i):(0,nt.numberToBytesBE)(a,i)};const nt=me,De=BigInt(0),ke=BigInt(1),yn=BigInt(2),dm=BigInt(3),Fs=BigInt(4),Ic=BigInt(5),Nc=BigInt(8);function it(t,e){const n=t%e;return n>=De?n:e+n}function Zd(t,e,n){if(n<=De||e<De)throw new Error("Expected power/modulo > 0");if(n===ke)return De;let r=ke;for(;e>De;)e&ke&&(r=r*t%n),t=t*t%n,e>>=ke;return r}function ui(t,e){if(t===De||e<=De)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=it(t,e),r=e,i=De,o=ke;for(;n!==De;){const a=r%n,s=i-o*(r/n);r=n,n=a,i=o,o=s}if(r!==ke)throw new Error("invert: does not exist");return it(i,e)}function Jd(t){const e=(t-ke)/yn;let n,r,i;for(n=t-ke,r=0;n%yn===De;n/=yn,r++);for(i=yn;i<t&&Zd(i,e,t)!==t-ke;i++);if(r===1){const a=(t+ke)/Fs;return function(s,c){const l=s.pow(c,a);if(!s.eql(s.sqr(l),c))throw new Error("Cannot find square root");return l}}const o=(n+ke)/yn;return function(a,s){if(a.pow(s,e)===a.neg(a.ONE))throw new Error("Cannot find square root");let c=r,l=a.pow(a.mul(a.ONE,i),n),u=a.pow(s,o),d=a.pow(s,n);for(;!a.eql(d,a.ONE);){if(a.eql(d,a.ZERO))return a.ZERO;let h=1;for(let g=a.sqr(d);h<c&&!a.eql(g,a.ONE);h++)g=a.sqr(g);const f=a.pow(l,ke<<BigInt(c-h-1));l=a.sqr(f),u=a.mul(u,f),d=a.mul(d,l),c=h}return u}}function Lc(t){if(t%Fs===dm){const e=(t+ke)/Fs;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%Nc===Ic){const e=(t-Ic)/Nc;return function(n,r){const i=n.mul(r,yn),o=n.pow(i,e),a=n.mul(r,o),s=n.mul(n.mul(a,yn),o),c=n.mul(a,n.sub(s,n.ONE));if(!n.eql(n.sqr(c),r))throw new Error("Cannot find square root");return c}}return Jd(t)}BigInt(9),BigInt(16);Ce.isNegativeLE=(t,e)=>(it(t,e)&ke)===ke;const hm=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Dc(t,e,n){if(n<De)throw new Error("Expected power > 0");if(n===De)return t.ONE;if(n===ke)return e;let r=t.ONE,i=e;for(;n>De;)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,a,s)=>t.is0(a)?o:(n[s]=o,t.mul(o,a)),t.ONE),i=t.inv(r);return e.reduceRight((o,a,s)=>t.is0(a)?o:(n[s]=t.mul(o,n[s]),t.mul(o,a)),i),n}function $c(t){const e=(t-ke)/yn;return(n,r)=>n.pow(r,e)}function Zo(t,e){const n=e!==void 0?e:t.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function zs(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 jc(t){const e=zs(t);return e+Math.ceil(e/2)}Object.defineProperty(Gn,"__esModule",{value:!0}),Gn.wNAF=function(t,e){const n=(o,a)=>{const s=a.negate();return o?s:a},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,a){let s=t.ZERO,c=o;for(;a>fm;)a&Jo&&(s=s.add(c)),c=c.double(),a>>=Jo;return s},precomputeWindow(o,a){const{windows:s,windowSize:c}=i(a),l=[];let u=o,d=u;for(let h=0;h<s;h++){d=u,l.push(d);for(let f=1;f<c;f++)d=d.add(u),l.push(d);u=d.double()}return l},wNAF(o,a,s){const{windows:c,windowSize:l}=i(o);let u=t.ZERO,d=t.BASE;const h=BigInt(2**o-1),f=2**o,g=BigInt(o);for(let m=0;m<c;m++){const w=m*l;let p=Number(s&h);s>>=g,p>l&&(p-=f,s+=Jo);const S=w,_=w+Math.abs(p)-1,O=m%2!=0,I=p<0;p===0?d=d.add(n(O,a[S])):u=u.add(n(I,a[_]))}
8return{p:u,f:d}},wNAFCached(o,a,s){const c=Hc.get(o)||1;let l=Xo.get(o);return l||(l=this.precomputeWindow(o,c),c!==1&&Xo.set(o,s(l))),this.wNAF(c,l,a)},setWindowSize(o,a){r(a),Hc.set(o,a),Xo.delete(o)}}},Gn.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,a=(1<<o)-1,s=new Array(a+1).fill(t.ZERO),c=Math.floor((e.BITS-1)/o)*o;let l=t.ZERO;for(let u=c;u>=0;u-=o){s.fill(t.ZERO);for(let h=0;h<r.length;h++){const f=r[h],g=Number(f>>BigInt(u)&BigInt(a));s[g]=s[g].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},Gn.validateBasic=function(t){return(0,Kc.validateField)(t.Fp),(0,Uc.validateObject)(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,Kc.nLength)(t.n,t.nBitLength),...t,p:t.Fp.ORDER})};const Kc=Ce,Uc=me,fm=BigInt(0),Jo=BigInt(1),Xo=new WeakMap,Hc=new WeakMap;Object.defineProperty(Us,"__esModule",{value:!0}),Us.twistedEdwards=function(t){const e=function(L){const R=(0,Qo.val
8idateBasic)(L);return Xe.validateObject(L,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...R})}(t),{Fp:n,n:r,prehash:i,hash:o,randomBytes:a,nByteLength:s,h:c}=e,l=di<<BigInt(8*s)-Qe,u=n.create,d=(0,Fc.Field)(e.n,e.nBitLength),h=e.uvRatio||((L,R)=>{try{return{isValid:!0,value:n.sqrt(L*n.inv(R))}}catch{return{isValid:!1,value:bt}}}),f=e.adjustScalarBytes||(L=>L),g=e.domain||((L,R,C)=>{if((0,rt.abool)("phflag",C),R.length||C)throw new Error("Contexts/pre-hash are not supported");return L});function m(L,R){Xe.aInRange("coordinate "+L,R,bt,l)}function w(L){if(!(L instanceof _))throw new Error("ExtendedPoint expected")}const p=(0,rt.memoized)((L,R)=>{const{ex:C,ey:P,ez:D}=L,y=L.is0();R==null&&(R=y?pm:n.inv(D));const E=u(C*R),A=u(P*R),T=u(D*R);if(y)return{x:bt,y:Qe};if(T!==Qe)throw new Error("invZ was invalid");return{x:E,y:A}}),S=(0,rt.memoized)(L=>{const{a:R,d:C}=e;if(L.is0())throw new Error("bad point: ZERO");const{ex:P,ey:D,ez:y,et:E}=L,A=u(P*P),T=u(D*D),b=u(y*y),v=u(b*b),k=u(A*R);if(u(b*u(k+T))!==u(v+u(C*u(A*T))))throw new Error("bad point: equation left != right (1)");if(u(P*D)!==u(y*E))throw new Error("bad point: equation left != right (2)");return!0});class _{constructor(R,C,P,D){this.ex=R,this.ey=C,this.ez=P,this.et=D,m("x",R),m("y",C),m("z",P),m("t",D),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(R){if(R instanceof _)throw new Error("extended point not allowed");const{x:C,y:P}=R||{};return m("x",C),m("y",P),new _(C,P,Qe,u(C*P))}static normalizeZ(R){const C=n.invertBatch(R.map(P=>P.ez));return R.map((P,D)=>P.toAffine(C[D])).map(_.fromAffine)}static msm(R,C){return(0,Qo.pippenger)(_,d,R,C)}_setWindowSize(R){j.setWindowSize(this,R)}assertValidity(){S(this)}equals(R){w(R);const{ex:C,ey:P,ez:D}=this,{ex:y,ey:E,ez:A}=R,T=u(C*A),b=u(y*D),v=u(P*A),k=u(E*D);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:R}=e,{ex:C,ey:P,ez:D}=this,y=u(C*C),E=u(P*P),A=u(di*u(D*D)),T=u(R*y),b=C+P,v=u(u(b*b)-y-E),k=T+E,x=k-A,M=T-E,N=u(v*x),B=u(k*M),H=u(v*M),z=u(x*k);return new _(N,B,z,H)}add(R){w(R);const{a:C,d:P}=e,{ex:D,ey:y,ez:E,et:A}=this,{ex:T,ey:b,ez:v,et:k}=R;if(C===BigInt(-1)){const ie=u((y-D)*(b+T)),ce=u((y+D)*(b-T)),ae=u(ce-ie);if(ae===bt)return this.double();const ye=u(E*di*k),Ee=u(A*di*v),de=Ee+ye,ge=ce+ie,ve=Ee-ye,Pe=u(de*ae),lt=u(ge*ve),Lo=u(de*ve),Do=u(ae*ge);return new _(Pe,lt,Do,Lo)}const x=u(D*T),M=u(y*b),N=u(A*P*k),B=u(E*v),H=u((D+y)*(T+b)-x-M),z=B-N,J=B+N,Q=u(M-C*x),ne=u(H*z),se=u(J*Q),le=u(H*Q),re=u(z*J);return new _(ne,se,re,le)}subtract(R){return this.add(R.negate())}wNAF(R){return j.wNAFCached(this,R,_.normalizeZ)}multiply(R){const C=R;Xe.aInRange("scalar",C,Qe,r);const{p:P,f:D}=this.wNAF(C);return _.normalizeZ([P,D])[0]}multiplyUnsafe(R){const C=R;return Xe.aInRange("scalar",C,bt,r),C===bt?I:this.equals(I)||C===Qe?this:this.equals(O)?this.wNAF(C).p:j.unsafeLadder(this,C)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return j.unsafeLadder(this,r).is0()}toAffine(R){return p(this,R)}clearCofactor(){const{h:R}=e;return R===Qe?this:this.multiplyUnsafe(R)}static fromHex(R,C=!1){const{d:P,a:D}=e,y=n.BYTES;R=(0,rt.ensureBytes)("pointHex",R,y),(0,rt.abool)("zip215",C);const E=R.slice(),A=R[y-1];E[y-1]=-129&A;const T=Xe.bytesToNumberLE(E),b=C?l:n.ORDER;Xe.aInRange("pointHex.y",T,bt,b);const v=u(T*T),k=u(v-Qe),x=u(P*v-D);let{isValid:M,value:N}=h(k,x);if(!M)throw new Error("Point.fromHex: invalid y coordinate");const B=(N&Qe)===Qe,H=(128&A)!=0;if(!C&&N===bt&&H)throw new Error("Point.fromHex: x=0 and x_0=1");return H!==B&&(N=u(-N)),_.fromAffine({x:N,y:T})}static fromPrivateKey(R){return U(R).point}toRawBytes(){const{x:R,y:C}=this.toAffine(),P=Xe.numberToBytesLE(C,n.BYTES);return P[P.length-1]|=R&Qe?128:0,P}toHex(){return Xe.bytesToHex(this.toRawBytes())}}_.BASE=new _(e.Gx,e.Gy,Qe,u(e.Gx*e.Gy)),_.ZERO=new _(bt,Qe,Qe,bt);const{BASE:O,ZERO:I}=_,j=(0,Qo.wNAF)(_,8*s);function q(L){return(0,Fc.mod)(L,r)}function F(L){return q(Xe.bytesToNumberLE(L))}function U(L){const R=s;L=(0,rt.ensureBytes)("private key",L,R);const C=(0,rt.ensureBytes)("hashed private key",o(L),2*R),P=f(C.slice(0,R)),D=C.slice(R,2*R),y=F(P),E=O.multiply(y),A=E.toRawBytes();return{head:P,prefix:D,scalar:y,point:E,pointBytes:A}}function K(L=new Uint8Array,...R){const C=Xe.concatBytes(...R);return F(o(g(C,(0,rt.ensureBytes)("context",L),!!i)))}const G=mm;return O._setWindowSize(8),{CURVE:e,getPublicKey:function(L){return U(L).pointBytes},sign:function(L,R,C={}){L=(0,rt.ensureBytes)("message",L),i&&(L=i(L));const{prefix:P,scalar:D,pointBytes:y}=U(R),E=K(C.context,P,L),A=O.multiply(E).toRawBytes(),T=q(E+K(C.context,A,y,L)*D);Xe.aInRange("signature.s",T,bt,r);const b=Xe.concatBytes(A,Xe.numberToBytesLE(T,n.BYTES));return(0,rt.ensureBytes)("result",b,2*s)},verify:function(L,R,C,P=G){const{context:D,zip215:y}=P,E=n.BYTES;L=(0,rt.ensureBytes)("signature",L,2*E),R=(0,rt.ensureBytes)("message",R),y!==void 0&&(0,rt.abool)("zip215",y),i&&(R=i(R));const A=Xe.bytesToNumberLE(L.slice(E,2*E));let T,b,v;try{T=_.fromHex(C,y),b=_.fromHex(L.slice(0,E),y),v=O.multiplyUnsafe(A)}catch{return!1}if(!y&&T.isSmallOrder())return!1;const k=K(D,b.toRawBytes(),T.toRawBytes(),R);return b.add(T.multiplyUnsafe(k)).subtract(v).clearCofactor().equals(_.ZERO)},ExtendedPoint:_,utils:{getExtendedPublicKey:U,randomPrivateKey:()=>a(n.BYTES),precompute:(L=8,R=_.BASE)=>(R._setWindowSize(L),R.multiply(BigInt(3)),R)}}};const Qo=Gn,Fc=Ce,Xe=me,rt=me,bt=BigInt(0),Qe=BigInt(1),di=BigInt(2),pm=BigInt(8),mm={zip215:!0};var dn={};Object.defineProperty(dn,"__esModule",{value:!0}),dn.expand_message_xmd=Xd,dn.expand_message_xof=Qd,dn.hash_to_field=es,dn.isogenyMap=function(t,e){const n=e.map(r=>Array.from(r).reverse());return(r,i)=>{const[o,a,s,c]=n.map(l=>l.reduce((u,d)=>t.add(t.mul(u,r),d)));return r=t.div(o,a),i=t.mul(i,t.div(s,c)),{x:r,y:i}}},dn.createHasher=function(t,e,n){if(typeof e!="function")throw new Error("mapToCurve() must be defined");return{hashToCurve(r,i){const o=es(r,2,{...n,DST:n.DST,...i}),a=t.fromAffine(e(o[0])),s=t.fromAffine(e(o[1])),c=a.add(s).clearCofactor();return c.assertValidity(),c},encodeToCurve(r,i){const o=es(r,1,{...n,DST:n.encodeDST,...i}),a=t.fromAffine(e(o[0])).clearCofactor();return a.assertValidity(),a},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 gm=Ce,He=me,ym=He.bytesToNumberBE;function hn(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 vm(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 Xd(t,e,n,r){(0,He.abytes)(t),(0,He.abytes)(e),Nr(n),e.length>255&&(e=r((0,He.concatBytes)((0,He.utf8ToBytes)("H2C-OVERSIZE-DST-"),e)));const{outputLen:i,blockLen:o}=r,a=Math.ceil(n/i);if(n>65535||a>
8255)throw new Error("expand_message_xmd: invalid lenInBytes");const s=(0,He.concatBytes)(e,hn(e.length,1)),c=hn(0,o),l=hn(n,2),u=new Array(a),d=r((0,He.concatBytes)(c,t,l,hn(0,1),s));u[0]=r((0,He.concatBytes)(d,hn(1,1),s));for(let h=1;h<=a;h++){const f=[vm(d,u[h-1]),hn(h+1,1),s];u[h]=r((0,He.concatBytes)(...f))}return(0,He.concatBytes)(...u).slice(0,n)}function Qd(t,e,n,r,i){if((0,He.abytes)(t),(0,He.abytes)(e),Nr(n),e.length>255){const o=Math.ceil(2*r/8);e=i.create({dkLen:o}).update((0,He.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(hn(n,2)).update(e).update(hn(e.length,1)).digest()}function es(t,e,n){(0,He.validateObject)(n,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:r,k:i,m:o,hash:a,expand:s,DST:c}=n;(0,He.abytes)(t),Nr(e);const l=typeof c=="string"?(0,He.utf8ToBytes)(c):c,u=r.toString(2).length,d=Math.ceil((u+i)/8),h=e*o*d;let f;if(s==="xmd")f=Xd(t,l,h,a);else if(s==="xof")f=Qd(t,l,h,i,a);else{if(s!=="_internal_pass")throw new Error('expand must be "xmd" or "xof"');f=t}const g=new Array(e);for(let m=0;m<e;m++){const w=new Array(o);for(let p=0;p<o;p++){const S=d*(p+m*o),_=f.subarray(S,S+d);w[p]=(0,gm.mod)(ym(_),r)}g[m]=w}return g}var qs={};Object.defineProperty(qs,"__esModule",{value:!0}),qs.montgomery=function(t){const e=function(m){return(0,rn.validateObject)(m,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...m})}(t),{P:n}=e,r=m=>(0,zc.mod)(m,n),i=e.montgomeryBits,o=Math.ceil(i/8),a=e.nByteLength,s=e.adjustScalarBytes||(m=>m),c=e.powPminus2||(m=>(0,zc.pow)(m,n-BigInt(2),n));function l(m,w,p){const S=r(m*(w-p));return[w=r(w-S),p=r(p+S)]}const u=(e.a-BigInt(2))/BigInt(4);function d(m){return(0,rn.numberToBytesLE)(r(m),o)}function h(m,w){const p=function(O){const I=(0,rn.ensureBytes)("u coordinate",O,o);return a===32&&(I[31]&=127),(0,rn.bytesToNumberLE)(I)}(w),S=function(O){const I=(0,rn.ensureBytes)("scalar",O),j=I.length;if(j!==o&&j!==a)throw new Error(`Expected ${o} or ${a} bytes, got ${j}`);return(0,rn.bytesToNumberLE)(s(I))}(m),_=function(O,I){(0,rn.aInRange)("u",O,Hn,n),(0,rn.aInRange)("scalar",I,Hn,n);const j=I,q=O;let F,U=ts,K=Hn,G=O,$=ts,L=Hn;for(let C=BigInt(i-1);C>=Hn;C--){const P=j>>C&ts;L^=P,F=l(L,U,G),U=F[0],G=F[1],F=l(L,K,$),K=F[0],$=F[1],L=P;const D=U+K,y=r(D*D),E=U-K,A=r(E*E),T=y-A,b=G+$,v=r((G-$)*D),k=r(b*E),x=v+k,M=v-k;G=r(x*x),$=r(q*r(M*M)),U=r(y*A),K=r(T*(y+r(u*T)))}F=l(L,U,G),U=F[0],G=F[1],F=l(L,K,$),K=F[0],$=F[1];const R=c(K);return r(U*R)}(p,S);if(_===Hn)throw new Error("Invalid private or public key received");return d(_)}const f=d(e.Gu);function g(m){return h(m,f)}return{scalarMult:h,scalarMultBase:g,getSharedSecret:(m,w)=>h(m,w),getPublicKey:m=>g(m),utils:{randomPrivateKey:()=>e.randomBytes(e.nByteLength)},GuBytes:f}};const zc=Ce,rn=me,Hn=BigInt(0),ts=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=j,t.edwardsToMontgomeryPriv=function(k){const x=O.hash(k.subarray(0,32));return O.adjustScalarBytes(x).subarray(0,32)};const e=Le,n=en,r=Us,i=dn,o=Ce,a=qs,s=me,c=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),l=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),u=BigInt(0),d=BigInt(1),h=BigInt(2),f=BigInt(3),g=BigInt(5),m=BigInt(8);function w(k){const x=BigInt(10),M=BigInt(20),N=BigInt(40),B=BigInt(80),H=c,z=k*k%H*k%H,J=(0,o.pow2)(z,h,H)*z%H,Q=(0,o.pow2)(J,d,H)*k%H,ne=(0,o.pow2)(Q,g,H)*Q%H,se=(0,o.pow2)(ne,x,H)*ne%H,le=(0,o.pow2)(se,M,H)*se%H,re=(0,o.pow2)(le,N,H)*le%H,ie=(0,o.pow2)(re,B,H)*re%H,ce=(0,o.pow2)(ie,B,H)*re%H,ae=(0,o.pow2)(ce,x,H)*ne%H;return{pow_p_5_8:(0,o.pow2)(ae,h,H)*k%H,b2:z}}function p(k){return k[0]&=248,k[31]&=127,k[31]|=64,k}function S(k,x){const M=c,N=(0,o.mod)(x*x*x,M),B=w(k*(0,o.mod)(N*N*x,M)).pow_p_5_8;let H=(0,o.mod)(k*N*B,M);const z=(0,o.mod)(x*H*H,M),J=H,Q=(0,o.mod)(H*l,M),ne=z===k,se=z===(0,o.mod)(-k,M),le=z===(0,o.mod)(-k*l,M);return ne&&(H=J),(se||le)&&(H=Q),(0,o.isNegativeLE)(H,M)&&(H=(0,o.mod)(-H,M)),{isValid:ne||se,value:H}}t.ED25519_TORSION_SUBGROUP=["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"];const _=(0,o.Field)(c,void 0,!0),O={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:_,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:m,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:e.sha512,randomBytes:n.randomBytes,adjustScalarBytes:p,uvRatio:S};function I(k,x,M){if(x.length>255)throw new Error("Context is too big");
8return(0,n.concatBytes)((0,n.utf8ToBytes)("SigEd25519 no Ed25519 collisions"),new Uint8Array([M?1:0,x.length]),x,k)}function j(k){const{y:x}=t.ed25519.ExtendedPoint.fromHex(k),M=BigInt(1);return _.toBytes(_.create((M+x)*_.inv(M-x)))}t.ed25519=(0,r.twistedEdwards)(O),t.ed25519ctx=(0,r.twistedEdwards)({...O,domain:I}),t.ed25519ph=(0,r.twistedEdwards)(Object.assign({},O,{domain:I,prehash:e.sha512})),t.x25519=(0,a.montgomery)({P:c,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:k=>{const x=c,{pow_p_5_8:M,b2:N}=w(k);return(0,o.mod)((0,o.pow2)(M,f,x)*N,x)},adjustScalarBytes:p,randomBytes:n.randomBytes}),t.edwardsToMontgomery=j;const q=(_.ORDER+f)/m,F=_.pow(h,q),U=_.sqrt(_.neg(_.ONE)),K=(0,o.FpSqrtEven)(_,_.neg(BigInt(486664)));function G(k){const{xMn:x,xMd:M,yMn:N,yMd:B}=function(re){const ie=(_.ORDER-g)/m,ce=BigInt(486662);let ae=_.sqr(re);ae=_.mul(ae,h);let ye=_.add(ae,_.ONE),Ee=_.neg(ce),de=_.sqr(ye),ge=_.mul(de,ye),ve=_.mul(ae,ce);ve=_.mul(ve,Ee),ve=_.add(ve,de),ve=_.mul(ve,Ee);let Pe=_.sqr(ge);de=_.sqr(Pe),Pe=_.mul(Pe,ge),Pe=_.mul(Pe,ve),de=_.mul(de,Pe);let lt=_.pow(de,ie);lt=_.mul(lt,Pe);let Lo=_.mul(lt,U);de=_.sqr(lt),de=_.mul(de,ge);let Do=_.eql(de,ve),dc=_.cmov(Lo,lt,Do),Xf=_.mul(Ee,ae),hr=_.mul(lt,re);hr=_.mul(hr,F);let Qf=_.mul(hr,U),e0=_.mul(ve,ae);de=_.sqr(hr),de=_.mul(de,ge);let t0=_.eql(de,e0),n0=_.cmov(Qf,hr,t0);de=_.sqr(dc),de=_.mul(de,ge);let Bo=_.eql(de,ve),r0=_.cmov(Xf,Ee,Bo),fr=_.cmov(n0,dc,Bo),i0=_.isOdd(fr);return fr=_.cmov(fr,_.neg(fr),Bo!==i0),{xMn:r0,xMd:ye,yMn:fr,yMd:d}}(k);let H=_.mul(x,B);H=_.mul(H,K);let z=_.mul(M,N),J=_.sub(x,M),Q=_.add(x,M),ne=_.mul(z,Q),se=_.eql(ne,_.ZERO);H=_.cmov(H,_.ZERO,se),z=_.cmov(z,_.ONE,se),J=_.cmov(J,_.ONE,se),Q=_.cmov(Q,_.ONE,se);const le=_.invertBatch([z,Q]);return{x:_.mul(H,le[0]),y:_.mul(J,le[1])}}const $=(0,i.createHasher)(t.ed25519.ExtendedPoint,k=>G(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 L(k){if(!(k instanceof v))throw new Error("RistrettoPoint expected")}t.hashToCurve=$.hashToCurve,t.encodeToCurve=$.encodeToCurve;const R=l,C=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),P=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),D=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),y=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),E=k=>S(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,M=t.ed25519.CURVE.Fp.ORDER,N=t.ed25519.CURVE.Fp.create,B=N(R*k*k),H=N((B+d)*D);let z=BigInt(-1);const J=N((z-x*B)*N(B+x));let{isValid:Q,value:ne}=S(H,J),se=N(ne*k);(0,o.isNegativeLE)(se,M)||(se=N(-se)),Q||(ne=se),Q||(z=B);const le=N(z*(B-d)*y-J),re=ne*ne,ie=N((ne+ne)*J),ce=N(le*C),ae=N(d-re),ye=N(d+re);return new t.ed25519.ExtendedPoint(N(ie*ye),N(ae*ce),N(ce*ye),N(ie*ae))}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 M=b(T(x.slice(0,32))),N=b(T(x.slice(32,64)));return new v(M.add(N))}static fromHex(x){x=(0,s.ensureBytes)("ristrettoHex",x,32);const{a:M,d:N}=t.ed25519.CURVE,B=t.ed25519.CURVE.Fp.ORDER,H=t.ed25519.CURVE.Fp.create,z="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",J=T(x);if(!(0,s.equalBytes)((0,s.numberToBytesLE)(J,32),x)||(0,o.isNegativeLE)(J,B))throw new Error(z);const Q=H(J*J),ne=H(d+M*Q),se=H(d-M*Q),le=H(ne*ne),re=H(se*se),ie=H(M
8*N*le-re),{isValid:ce,value:ae}=E(H(ie*re)),ye=H(ae*se),Ee=H(ae*ye*ie);let de=H((J+J)*ye);(0,o.isNegativeLE)(de,B)&&(de=H(-de));const ge=H(ne*Ee),ve=H(de*ge);if(!ce||(0,o.isNegativeLE)(ve,B)||ge===u)throw new Error(z);return new v(new t.ed25519.ExtendedPoint(de,ge,d,ve))}toRawBytes(){let{ex:x,ey:M,ez:N,et:B}=this.ep;const H=t.ed25519.CURVE.Fp.ORDER,z=t.ed25519.CURVE.Fp.create,J=z(z(N+M)*z(N-M)),Q=z(x*M),ne=z(Q*Q),{value:se}=E(z(J*ne)),le=z(se*J),re=z(se*Q),ie=z(le*re*B);let ce;if((0,o.isNegativeLE)(B*ie,H)){let ye=z(M*R),Ee=z(x*R);x=ye,M=Ee,ce=z(le*P)}else ce=re;(0,o.isNegativeLE)(x*ie,H)&&(M=z(-M));let ae=z((N-M)*ce);return(0,o.isNegativeLE)(ae,H)&&(ae=z(-ae)),(0,s.numberToBytesLE)(ae,32)}toHex(){return(0,s.bytesToHex)(this.toRawBytes())}toString(){return this.toHex()}equals(x){L(x);const{ex:M,ey:N}=this.ep,{ex:B,ey:H}=x.ep,z=t.ed25519.CURVE.Fp.create,J=z(M*H)===z(N*B),Q=z(N*H)===z(M*B);return J||Q}add(x){return L(x),new v(this.ep.add(x.ep))}subtract(x){return L(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 M=x.DST,N=typeof M=="string"?(0,n.utf8ToBytes)(M):M,B=(0,i.expand_message_xmd)(k,N,64,e.sha512);return v.hashToCurve(B)},t.hash_to_ristretto255=t.hashToRistretto255})(Ed);var eh={},Zt={};Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.sha224=Zt.sha256=Zt.SHA256=void 0;
8const ns=Yt,ht=en,bm=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]),on=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),sn=new Uint32Array(64);class Pa extends ns.HashMD{constructor(){super(64,32,8,!1),this.A=0|on[0],this.B=0|on[1],this.C=0|on[2],this.D=0|on[3],this.E=0|on[4],this.F=0|on[5],this.G=0|on[6],this.H=0|on[7]}get(){const{A:e,B:n,C:r,D:i,E:o,F:a,G:s,H:c}=this;return[e,n,r,i,o,a,s,c]}set(e,n,r,i,o,a,s,c){this.A=0|e,this.B=0|n,this.C=0|r,this.D=0|i,this.E=0|o,this.F=0|a,this.G=0|s,this.H=0|c}process(e,n){for(let d=0;d<16;d++,n+=4)sn[d]=e.getUint32(n,!1);for(let d=16;d<64;d++){const h=sn[d-15],f=sn[d-2],g=(0,ht.rotr)(h,7)^(0,ht.rotr)(h,18)^h>>>3,m=(0,ht.rotr)(f,17)^(0,ht.rotr)(f,19)^f>>>10;sn[d]=m+sn[d-7]+g+sn[d-16]|0}let{A:r,B:i,C:o,D:a,E:s,F:c,G:l,H:u}=this;for(let d=0;d<64;d++){const h=u+((0,ht.rotr)(s,6)^(0,ht.rotr)(s,11)^(0,ht.rotr)(s,25))+(0,ns.Chi)(s,c,l)+bm[d]+sn[d]|0,f=((0,ht.rotr)(r,2)^(0,ht.rotr)(r,13)^(0,ht.rotr)(r,22))+(0,ns.Maj)(r,i,o)|0;u=l,l=c,c=s,s=a+h|0,a=o,o=i,i=r,r=h+f|0}r=r+this.A|0,i=i+this.B|0,o=o+this.C|0,a=a+this.D|0,s=s+this.E|0,c=c+this.F|0,l=l+this.G|0,u=u+this.H|0,this.set(r,i,o,a,s,c,l,u)}roundClean(){sn.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}Zt.SHA256=Pa;class wm extends Pa{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}}
8Zt.sha256=(0,ht.wrapConstructor)(()=>new Pa),Zt.sha224=(0,ht.wrapConstructor)(()=>new wm);var Pi={},Ia={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.hmac=t.HMAC=void 0;const e=st,n=en;class r extends n.Hash{constructor(o,a){super(),this.finished=!1,this.destroyed=!1,(0,e.hash)(o);const s=(0,n.toBytes)(a);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 c=this.blockLen,l=new Uint8Array(c);l.set(s.length>c?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:a,iHash:s,finished:c,destroyed:l,blockLen:u,outputLen:d}=this;return o.finished=c,o.destroyed=l,o.blockLen=u,o.outputLen=d,o.oHash=a._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,a)=>new r(i,o).update(a).digest(),t.hmac.create=(i,o)=>new r(i,o)})(Ia);var Na={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.DER=void 0,t.weierstrassPoints=f,t.weierstrass=function(m){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})}(m),{Fp:p,n:S}=w,_=p.BYTES+1,O=2*p.BYTES+1;function I(k){return n.mod(k,S)}function j(k){return n.invert(k,S)}const{ProjectivePoint:q,normPrivateKeyToScalar:F,weierstrassEquation:U,isWithinCurveOrder:K}=f({...w,toBytes(k,x,M){const N=x.toAffine(),B=p.toBytes(N.x),H=r.concatBytes;return(0,i.abool)("isCompressed",M),M?H(Uint8Array.from([x.hasEvenY()?2:3]),B):H(Uint8Array.from([4]),B,p.toBytes(N.y))},fromBytes(k){const x=k.length,M=k[0],N=k.subarray(1);if(x!==_||M!==2&&M!==3){if(x===O&&M===4)return{x:p.fromBytes(N.subarray(0,p.BYTES)),y:p.fromBytes(N.subarray(p.BYTES,2*p.BYTES))};throw new Error(`Point of length ${x} was invalid. Expected ${_} compressed bytes or ${O} uncompressed bytes`)}{const B=r.bytesToNumberBE(N);if(!r.inRange(B,l,p.ORDER))throw new Error("Point is not on curve");const H=U(B);let z;try{z=p.sqrt(H)}catch(J){const Q=J instanceof Error?": "+J.message:"";throw new Error("Point is not on curve"+Q)}return(1&M)==1!=((z&l)===l)&&(z=p.neg(z)),{x:B,y:z}}}}),G=k=>r.bytesToHex(r.numberToBytesBE(k,w.nByteLength));function $(k){return k>S>>l}const L=(k,x,M)=>r.bytesToNumberBE(k.slice(x,M));class R{constructor(x,M,N){this.r=x,this.s=M,this.recovery=N,this.assertValidity()}static fromCompact(x){const M=w.nByteLength;return x=(0,i.ensureBytes)("compactSignature",x,2*M),new R(L(x,0,M),L(x,M,2*M))}static fromDER(x){const{r:M,s:N}=t.DER.toSig((0,i.ensureBytes)("DER",x));return new R(M,N)}assertValidity(){r.aInRange("r",this.r,l,S),r.aInRange("s",this.s,l,S)}addRecoveryBit(x){return new R(this.r,this.s,x)}recoverPublicKey(x){const{r:M,s:N,recovery:B}=this,H=y((0,i.ensureBytes)("msgHash",x));if(B==null||![0,1,2,3].includes(B))throw new Error("recovery id invalid");const z=B===2||B===3?M+w.n:M;if(z>=p.ORDER)throw new Error("recovery id 2 or 3 invalid");const J=1&B?"03":"02",Q=q.fromHex(J+G(z)),ne=j(z),se=I(-H*ne),le=I(N*ne),re=q.BASE.multiplyAndAddUnsafe(Q,se,le);if(!re)throw new Error("point at infinify");return re.assertValidity(),re}hasHighS(){return $(this.s)}normalizeS(){return this.hasHighS()?new R(this.r,I(-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 G(this.r)+G(this.s)}}const C={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 P(k){const x=r.isBytes(k),M=typeof k=="string",N=(x||M)&&k.length;return x?N===_||N===O:M?N===2*_||N===2*O:k instanceof q}const D=w.bits2int||function(k){const x=r.bytesToNumberBE(k),M=8*k.length-w.nBitLength;return M>0?x>>BigInt(M):x},y=w.bits2int_modN||function(k){return I(D(k))},E=r.bitMask(w.nBitLength);function A(k){return r.aInRange(`num < 2^${w.nBitLength}`,k,c,E),r.numberToBytesBE(k,w.nByteLength)}function T(k,x,M=b){if(["recovered","canonical"].some(ie=>ie in M))throw new Error("sign() legacy options not supported");const{hash:N,randomBytes:B}=w;let{lowS:H,prehash:z,extraEntropy:J}=M;H==null&&(H=!0),k=(0,i.ensureBytes)("msgHash",k),o(M),z&&(k=(0,i.ensureBytes)("prehashed msgHash",N(k)));const Q=y(k),ne=F(x),se=[A(ne),A(Q)];if(J!=null&&J!==!1){const ie=J===!0?B(p.BYTES):J;
8se.push((0,i.ensureBytes)("extraEntropy",ie))}const le=r.concatBytes(...se),re=Q;return{seed:le,k2sig:function(ie){const ce=D(ie);if(!K(ce))return;const ae=j(ce),ye=q.BASE.multiply(ce).toAffine(),Ee=I(ye.x);if(Ee===c)return;const de=I(ae*I(re+Ee*ne));if(de===c)return;let ge=(ye.x===Ee?0:2)|Number(ye.y&l),ve=de;return H&&$(de)&&(ve=function(Pe){return $(Pe)?I(-Pe):Pe}(de),ge^=1),new R(Ee,ve,ge)}}}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,M=!0){if(P(k))throw new Error("first arg must be private key");if(!P(x))throw new Error("second arg must be public key");return q.fromHex(x).multiply(F(k)).toRawBytes(M)},sign:function(k,x,M=b){const{seed:N,k2sig:B}=T(k,x,M),H=w;return r.createHmacDrbg(H.hash.outputLen,H.nByteLength,H.hmac)(N,B)},verify:function(k,x,M,N=v){var Ee;const B=k;if(x=(0,i.ensureBytes)("msgHash",x),M=(0,i.ensureBytes)("publicKey",M),"strict"in N)throw new Error("options.strict was renamed to lowS");o(N);const{lowS:H,prehash:z}=N;let J,Q;try{if(typeof B=="string"||r.isBytes(B))try{J=R.fromDER(B)}catch(de){if(!(de instanceof t.DER.Err))throw de;J=R.fromCompact(B)}else{if(typeof B!="object"||typeof B.r!="bigint"||typeof B.s!="bigint")throw new Error("PARSE");{const{r:de,s:ge}=B;
8J=new R(de,ge)}}Q=q.fromHex(M)}catch(de){if(de.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(H&&J.hasHighS())return!1;z&&(x=w.hash(x));const{r:ne,s:se}=J,le=y(x),re=j(se),ie=I(le*re),ce=I(ne*re),ae=(Ee=q.BASE.multiplyAndAddUnsafe(Q,ie,ce))==null?void 0:Ee.toAffine();return ae?I(ae.x)===ne:!1},ProjectivePoint:q,Signature:R,utils:C}},t.SWUFpSqrtRatio=g,t.mapToCurveSimpleSWU=function(m,w){if(n.validateField(m),!m.isValid(w.A)||!m.isValid(w.B)||!m.isValid(w.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const p=g(m,w.Z);if(!m.isOdd)throw new Error("Fp.isOdd is not implemented!");return S=>{let _,O,I,j,q,F,U,K;_=m.sqr(S),_=m.mul(_,w.Z),O=m.sqr(_),O=m.add(O,_),I=m.add(O,m.ONE),I=m.mul(I,w.B),j=m.cmov(w.Z,m.neg(O),!m.eql(O,m.ZERO)),j=m.mul(j,w.A),O=m.sqr(I),F=m.sqr(j),q=m.mul(F,w.A),O=m.add(O,q),O=m.mul(O,I),F=m.mul(F,j),q=m.mul(F,w.B),O=m.add(O,q),U=m.mul(_,I);const{isValid:G,value:$}=p(O,F);K=m.mul(_,S),K=m.mul(K,$),U=m.cmov(U,I,G),K=m.cmov(K,$,G);const L=m.isOdd(S)===m.isOdd(K);return K=m.cmov(m.neg(K),K,L),U=m.div(U,j),{x:U,y:K}}};const e=Gn,n=Ce,r=me,i=me;function o(m){m.lowS!==void 0&&(0,i.abool)("lowS",m.lowS),m.prehash!==void 0&&(0,i.abool)("prehash",m.prehash)}const{bytesToNumberBE:a,hexToBytes:s}=r;t.DER={Err:class extends Error{constructor(m=""){super(m)}},_tlv:{encode:(m,w)=>{const{Err:p}=t.DER;if(m<0||m>256)throw new p("tlv.encode: wrong tag");if(1&w.length)throw new p("tlv.encode: unpadded data");const S=w.length/2,_=r.numberToHexUnpadded(S);if(_.length/2&128)throw new p("tlv.encode: long form length too big");const O=S>127?r.numberToHexUnpadded(_.length/2|128):"";return`${r.numberToHexUnpadded(m)}${O}${_}${w}`},decode(m,w){const{Err:p}=t.DER;let S=0;if(m<0||m>256)throw new p("tlv.encode: wrong tag");if(w.length<2||w[S++]!==m)throw new p("tlv.decode: wrong tlv");const _=w[S++];let O=0;if(128&_){const j=127&_;if(!j)throw new p("tlv.decode(long): indefinite length not supported");if(j>4)throw new p("tlv.decode(long): byte length is too big");const q=w.subarray(S,S+j);if(q.length!==j)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)O=O<<8|F;if(S+=j,O<128)throw new p("tlv.decode(long): not minimal encoding")}else O=_;const I=w.subarray(S,S+O);if(I.length!==O)throw new p("tlv.decode: wrong value length");return{v:I,l:w.subarray(S+O)}}},_int:{encode(m){const{Err:w}=t.DER;if(m<c)throw new w("integer: negative integers are not allowed");let p=r.numberToHexUnpadded(m);if(8&Number.parseInt(p[0],16)&&(p="00"+p),1&p.length)throw new w("unexpected assertion");return p},decode(m){const{Err:w}=t.DER;if(128&m[0])throw new w("Invalid signature integer: negative");if(m[0]===0&&!(128&m[1]))throw new w("Invalid signature integer: unnecessary leading zero");return a(m)}},toSig(m){const{Err:w,_int:p,_tlv:S}=t.DER,_=typeof m=="string"?s(m):m;r.abytes(_);const{v:O,l:I}=S.decode(48,_);if(I.length)throw new w("Invalid signature: left bytes after parsing");const{v:j,l:q}=S.decode(2,O),{v:F,l:U}=S.decode(2,q);if(U.length)throw new w("Invalid signature: left bytes after parsing");return{r:p.decode(j),s:p.decode(F)}},hexFromSig(m){const{_tlv:w,_int:p}=t.DER,S=`${w.encode(2,p.encode(m.r))}${w.encode(2,p.encode(m.s))}`;return w.encode(48,S)}};const c=BigInt(0),l=BigInt(1),u=BigInt(2),d=BigInt(3),h=BigInt(4);function f(m){const w=function(L){const R=(0,e.validateBasic)(L);r.validateObject(R,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:C,Fp:P,a:D}=R;if(C){if(!P.eql(D,P.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof C!="object"||typeof C.beta!="bigint"||typeof C.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...R})}(m),{Fp:p}=w,S=n.Field(w.n,w.nBitLength),_=w.toBytes||((L,R,C)=>{const P=R.toAffine();return r.concatBytes(Uint8Array.from([4]),p.toBytes(P.x),p.toBytes(P.y))}),O=w.fromBytes||(L=>{const R=L.subarray(1);return{x:p.fromBytes(R.subarray(0,p.BYTES)),y:p.fromBytes(R.subarray(p.BYTES,2*p.BYTES))}});function I(L){const{a:R,b:C}=w,P=p.sqr(L),D=p.mul(P,L);return p.add(p.add(D,p.mul(L,R)),C)}if(!p.eql(p.sqr(w.Gy),I(w.Gx)))throw new Error("bad generator point: equation left != right");function j(L){const{allowedPrivateKeyLengths:R,nByteLength:C,wrapPrivateKey:P,n:D}=w;if(R&&typeof L!="bigint"){if(r.isBytes(L)&&(L=r.bytesToHex(L)),typeof L!="str
8ing"||!R.includes(L.length))throw new Error("Invalid key");L=L.padStart(2*C,"0")}let y;try{y=typeof L=="bigint"?L:r.bytesToNumberBE((0,i.ensureBytes)("private key",L,C))}catch{throw new Error(`private key must be ${C} bytes, hex or bigint, not ${typeof L}`)}return P&&(y=n.mod(y,D)),r.aInRange("private key",y,l,D),y}function q(L){if(!(L instanceof K))throw new Error("ProjectivePoint expected")}const F=(0,i.memoized)((L,R)=>{const{px:C,py:P,pz:D}=L;if(p.eql(D,p.ONE))return{x:C,y:P};const y=L.is0();R==null&&(R=y?p.ONE:p.inv(D));const E=p.mul(C,R),A=p.mul(P,R),T=p.mul(D,R);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}}),U=(0,i.memoized)(L=>{if(L.is0()){if(w.allowInfinityPoint&&!p.is0(L.py))return;throw new Error("bad point: ZERO")}const{x:R,y:C}=L.toAffine();if(!p.isValid(R)||!p.isValid(C))throw new Error("bad point: x or y not FE");const P=p.sqr(C),D=I(R);if(!p.eql(P,D))throw new Error("bad point: equation left != right");if(!L.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class K{constructor(R,C,P){if(this.px=R,this.py=C,this.pz=P,R==null||!p.isValid(R))throw new Error("x required");if(C==null||!p.isValid(C))throw new Error("y required");if(P==null||!p.isValid(P))throw new Error("z required");Object.freeze(this)}static fromAffine(R){const{x:C,y:P}=R||{};if(!R||!p.isValid(C)||!p.isValid(P))throw new Error("invalid affine point");if(R instanceof K)throw new Error("projective point not allowed");const D=y=>p.eql(y,p.ZERO);return D(C)&&D(P)?K.ZERO:new K(C,P,p.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(R){const C=p.invertBatch(R.map(P=>P.pz));return R.map((P,D)=>P.toAffine(C[D])).map(K.fromAffine)}static fromHex(R){const C=K.fromAffine(O((0,i.ensureBytes)("pointHex",R)));return C.assertValidity(),C}static fromPrivateKey(R){return K.BASE.multiply(j(R))}static msm(R,C){return(0,e.pippenger)(K,S,R,C)}_setWindowSize(R){$.setWindowSize(this,R)}assertValidity(){U(this)}hasEvenY(){const{y:R}=this.toAffine();if(p.isOdd)return!p.isOdd(R);throw new Error("Field doesn't support isOdd")}equals(R){q(R);const{px:C,py:P,pz:D}=this,{px:y,py:E,pz:A}=R,T=p.eql(p.mul(C,A),p.mul(y,D)),b=p.eql(p.mul(P,A),p.mul(E,D));return T&&b}negate(){return new K(this.px,p.neg(this.py),this.pz)}double(){const{a:R,b:C}=w,P=p.mul(C,d),{px:D,py:y,pz:E}=this;let A=p.ZERO,T=p.ZERO,b=p.ZERO,v=p.mul(D,D),k=p.mul(y,y),x=p.mul(E,E),M=p.mul(D,y);return M=p.add(M,M),b=p.mul(D,E),b=p.add(b,b),A=p.mul(R,b),T=p.mul(P,x),T=p.add(A,T),A=p.sub(k,T),T=p.add(k,T),T=p.mul(A,T),A=p.mul(M,A),b=p.mul(P,b),x=p.mul(R,x),M=p.sub(v,x),M=p.mul(R,M),M=p.add(M,b),b=p.add(v,v),v=p.add(b,v),v=p.add(v,x),v=p.mul(v,M),T=p.add(T,v),x=p.mul(y,E),x=p.add(x,x),v=p.mul(x,M),A=p.sub(A,v),b=p.mul(x,k),b=p.add(b,b),b=p.add(b,b),new K(A,T,b)}add(R){q(R);const{px:C,py:P,pz:D}=this,{px:y,py:E,pz:A}=R;let T=p.ZERO,b=p.ZERO,v=p.ZERO;const k=w.a,x=p.mul(w.b,d);let M=p.mul(C,y),N=p.mul(P,E),B=p.mul(D,A),H=p.add(C,P),z=p.add(y,E);H=p.mul(H,z),z=p.add(M,N),H=p.sub(H,z),z=p.add(C,D);let J=p.add(y,A);return z=p.mul(z,J),J=p.add(M,B),z=p.sub(z,J),J=p.add(P,D),T=p.add(E,A),J=p.mul(J,T),T=p.add(N,B),J=p.sub(J,T),v=p.mul(k,z),T=p.mul(x,B),v=p.add(T,v),T=p.sub(N,v),v=p.add(N,v),b=p.mul(T,v),N=p.add(M,M),N=p.add(N,M),B=p.mul(k,B),z=p.mul(x,z),N=p.add(N,B),B=p.sub(M,B),B=p.mul(k,B),z=p.add(z,B),M=p.mul(N,z),b=p.add(b,M),M=p.mul(J,z),T=p.mul(H,T),T=p.sub(T,M),M=p.mul(H,N),v=p.mul(J,v),v=p.add(v,M),new K(T,b,v)}subtract(R){return this.add(R.negate())}is0(){return this.equals(K.ZERO)}wNAF(R){return $.wNAFCached(this,R,K.normalizeZ)}multiplyUnsafe(R){r.aInRange("scalar",R,c,w.n);const C=K.ZERO;if(R===c)return C;if(R===l)return this;const{endo:P}=w;if(!P)return $.unsafeLadder(this,R);let{k1neg:D,k1:y,k2neg:E,k2:A}=P.splitScalar(R),T=C,b=C,v=this;for(;y>c||A>c;)y&l&&(T=T.add(v)),A&l&&(b=b.add(v)),v=v.double(),y>>=l,A>>=l;return D&&(T=T.negate()),E&&(b=b.negate()),b=new K(p.mul(b.px,P.beta),b.py,b.pz),T.add(b)}multiply(R){const{endo:C,n:P}=w;let D,y;if(r.aInRange("scalar",R,l,P),C){const{k1neg:E,k1:A,k2neg:T,k2:b}=C.splitScalar(R);let{p:v,f:k}=this.wNAF(A),{p:x,f:M}=this.wNAF(b);
8v=$.constTimeNegate(E,v),x=$.constTimeNegate(T,x),x=new K(p.mul(x.px,C.beta),x.py,x.pz),D=v.add(x),y=k.add(M)}else{const{p:E,f:A}=this.wNAF(R);D=E,y=A}return K.normalizeZ([D,y])[0]}multiplyAndAddUnsafe(R,C,P){const D=K.BASE,y=(A,T)=>T!==c&&T!==l&&A.equals(D)?A.multiply(T):A.multiplyUnsafe(T),E=y(this,C).add(y(R,P));return E.is0()?void 0:E}toAffine(R){return F(this,R)}isTorsionFree(){const{h:R,isTorsionFree:C}=w;if(R===l)return!0;if(C)return C(K,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:R,clearCofactor:C}=w;return R===l?this:C?C(K,this):this.multiplyUnsafe(w.h)}toRawBytes(R=!0){return(0,i.abool)("isCompressed",R),this.assertValidity(),_(K,this,R)}toHex(R=!0){return(0,i.abool)("isCompressed",R),r.bytesToHex(this.toRawBytes(R))}}K.BASE=new K(w.Gx,w.Gy,p.ONE),K.ZERO=new K(p.ZERO,p.ONE,p.ZERO);const G=w.nBitLength,$=(0,e.wNAF)(K,w.endo?Math.ceil(G/2):G);return{CURVE:w,ProjectivePoint:K,normPrivateKeyToScalar:j,weierstrassEquation:I,isWithinCurveOrder:function(L){return r.inRange(L,l,w.n)}}}function g(m,w){const p=m.ORDER;let S=c;for(let L=p-l;L%u===c;L/=u)S+=l;const _=S,O=u<<_-l-l,I=O*u,j=(p-l)/I,q=(j-l)/u,F=I-l,U=O,K=m.pow(w,j),G=m.pow(w,(j+l)/u);let $=(L,R)=>{let C=K,P=m.pow(R,F),D=m.sqr(P);D=m.mul(D,R);let y=m.mul(L,D);y=m.pow(y,q),y=m.mul(y,P),P=m.mul(y,R),D=m.mul(y,L);let E=m.mul(D,P);y=m.pow(E,U);let A=m.eql(y,m.ONE);P=m.mul(D,G),y=m.mul(E,C),D=m.cmov(P,D,A),E=m.cmov(y,E,A);for(let T=_;T>l;T--){let b=T-u;b=u<<b-l;let v=m.pow(E,b);const k=m.eql(v,m.ONE);P=m.mul(D,C),C=m.mul(C,C),v=m.mul(E,C),D=m.cmov(P,D,k),E=m.cmov(v,E,k)}return{isValid:A,value:D}};if(m.ORDER%h===d){const L=(m.ORDER-d)/h,R=m.sqrt(m.neg(w));$=(C,P)=>{let D=m.sqr(P);const y=m.mul(C,P);D=m.mul(D,y);let E=m.pow(D,L);E=m.mul(E,y);const A=m.mul(E,R),T=m.mul(m.sqr(E),P),b=m.eql(T,C);return{isValid:b,value:m.cmov(A,E,b)}}}return $}})(Na),Object.defineProperty(Pi,"__esModule",{value:!0}),Pi.getHash=Vc,Pi.createCurve=function(t,e){const n=r=>(0,_m.weierstrass)({...t,...Vc(r)});return Object.freeze({...n(e),create:n})};const Em=Ia,qc=en,_m=Na;function Vc(t){return{hash:t,hmac:(e,...n)=>(0,Em.hmac)(t,e,(0,qc.concatBytes)(...n)),randomBytes:qc.randomBytes}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.encodeToCurve=t.hashToCurve=t.schnorr=t.secp256k1=void 0;const e=Zt,n=en,r=Pi,i=dn,o=Ce,a=me,s=Na,c=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),l=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),u=BigInt(1),d=BigInt(2),h=(y,E)=>(y+E/d)/E;function f(y){const E=c,A=BigInt(3),T=BigInt(6),b=BigInt(11),v=BigInt(22),k=BigInt(23),x=BigInt(44),M=BigInt(88),N=y*y*y%E,B=N*N*y%E,H=(0,o.pow2)(B,A,E)*B%E,z=(0,o.pow2)(H,A,E)*B%E,J=(0,o.pow2)(z,d,E)*N%E,Q=(0,o.pow2)(J,b,E)*J%E,ne=(0,o.pow2)(Q,v,E)*Q%E,se=(0,o.pow2)(ne,x,E)*ne%E,le=(0,o.pow2)(se,M,E)*se%E,re=(0,o.pow2)(le,x,E)*ne%E,ie=(0,o.pow2)(re,A,E)*B%E,ce=(0,o.pow2)(ie,k,E)*Q%E,ae=(0,o.pow2)(ce,T,E)*N%E,ye=(0,o.pow2)(ae,d,E);if(!g.eql(g.sqr(ye),y))throw new Error("Cannot find square root");return ye}const g=(0,o.Field)(c,void 0,void 0,{sqrt:f});t.secp256k1=(0,r.createCurve)({a:BigInt(0),b:BigInt(7),Fp:g,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),M=h(-T*y,E);let N=(0,o.mod)(y-x*A-M*b,E),B=(0,o.mod)(-x*T-M*v,E);const H=N>k,z=B>k;if(H&&(N=E-N),z&&(B=E-B),N>k||B>k)throw new Error("splitScalar: Endomorphism failed, k="+y);return{k1neg:H,k1:N,k2neg:z,k2:B}}}},e.sha256);const m=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,a.concatBytes)(T,T),w[y]=A}return(0,e.sha256)((0,a.concatBytes)(A,...E))}const S=y=>y.toRawBytes(!0).slice(1),_=y=>(0,a.numberToBytesBE)(y,32),O=y=>(0,o.mod)(y,c),I=y=>(0,o.mod)(y,l),j=t.secp256k1.ProjectivePoint,q=(y,E,A)=>j.BASE.multiplyAndAddUnsafe(y,E,A);function F(y){let E=t.secp256k1.utils.normPrivateKeyToScalar(y),A=j.fromPrivateKey(E);return{scalar:A.hasEvenY()?E:I(-E),bytes:S(A)}}function U(y){(0,a.aInRange)("x",y,u,c);const E=O(y*y);let A=f(O(E*y+BigInt(7)));A%d!==m&&(A=O(-A));const T=new j(y,A,u);return T.assertValidity(),T}const K=a.bytesToNumberBE;function G(...y){return I(K(p("BIP0340/challenge",...y)))}function $(y){return F(y).bytes}function L(y,E,A=(0,n.randomBytes)(32)){const T=(0,a.ensureBytes)("message",y),{bytes:b,scalar:v}=F(E),k=(0,a.ensureBytes)("auxRand",A,32),x=_(v^K(p("BIP0340/aux",k))),M=p("BIP0340/nonce",x,b,T),N=I(K(M));if(N===m)throw new Error("sign failed: k is zero");const{bytes:B,scalar:H}=F(N),z=G(B,b,T),J=new Uint8Array(64);if(J.set(B,0),J.set(_(I(H+z*v)),32),!R(J,T,b))throw new Error("sign: Invalid signature produced");return J}function R(y,E,A){const T=(0,a.ensureBytes)("signature",y,64),b=(0,a.ensureBytes)("message",E),v=(0,a.ensureBytes)("publicKey",A,32);try{const k=U(K(v)),x=K(T.subarray(0,32));if(!(0,a.inRange)(x,u,c))return!1;const M=K(T.subarray(32,64));if(!(0,a.inRange)(M,u,l))return!1;const N=G(_(x),S(k),b),B=q(k,M,I(-N));return!(!B||!B.hasEvenY()||B.toAffine().x!==x)}catch{return!1}}t.schnorr={getPublicKey:$,sign:L,verify:R,utils:{randomPrivateKey:t.secp256k1.utils.randomPrivateKey,lift_x:U,pointToBytes:S,numberToBytesBE:a.numberToBytesBE,bytesToNumberBE:a.bytesToNumberBE,taggedHash:p,mod:o.mod}};const C=(0,i.isogenyMap)(g,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a4
813deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(y=>y.map(E=>BigInt(E)))),P=(0,s.mapToCurveSimpleSWU)(g,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:g.create(BigInt("-11"))}),D=(0,i.createHasher)(t.secp256k1.ProjectivePoint,y=>{const{x:E,y:A}=P(g.create(y[0]));return C(E,A)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:g.ORDER,m:1,k:128,expand:"xmd",hash:e.sha256});t.hashToCurve=D.hashToCurve,t.encodeToCurve=D.encodeToCurve})(eh);var Vs={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.decodeHex=t.remove0x=void 0;var e=ct;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))}})(Vs),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.hexToPublicKey=t.convertPublicKeyFormat=t.getSharedPoint=t.getPublicKey=t.isValidPrivateKey=t.getValidSecret=void 0;var e=Ma,n=Ed,r=eh,i=Ir,o=Ne,a=Vs;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,a.decodeHex)(u);return s((0,i.ellipticCurve)(),function(){return c(d)},function(){return d},function(){return d})};var c=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()}}(wd);var th={},Yn={};Object.defineProperty(Yn,"__esModule",{value:!0}),Yn.hkdf=void 0,Yn.extract=rh,Yn.expand=ih;const Ws=st,Wc=en,nh=Ia;function rh(t,e,n){return(0,Ws.hash)(t),n===void 0&&(n=new Uint8Array(t.outputLen)),(0,nh.hmac)(t,(0,Wc.toBytes)(n),(0,Wc.toBytes)(e))}const rs=new Uint8Array([0]),Gc=new Uint8Array;function ih(t,e,n,r=32){if((0,Ws.hash)(t),(0,Ws.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),a=nh.hmac.create(t,e),s=a._cloneInto(),c=new Uint8Array(a.outputLen);for(let l=0;l<i;l++)rs[0]=l+1,s.update(l===0?Gc:c).update(n).update(rs).digestInto(c),o.set(c,t.outputLen*l),a._cloneInto(s);return a.destroy(),s.destroy(),c.fill(0),rs.fill(0),o.slice(0,r)}Yn.hkdf=(t,e,n,r,i)=>
8ih(t,rh(t,e,n),r,i),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getSharedKey=t.deriveKey=void 0;var e=ct,n=Yn,r=Zt;t.deriveKey=function(i,o,a){return(0,n.hkdf)(r.sha256,i,o,a,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))}}(th);var Yc={},tr={},xe={},On={};Object.defineProperty(On,"__esModule",{value:!0}),On.polyval=On.ghash=void 0,On._toGHASHKey=oh;const Pn=Fe,We=ct,zt=16,La=new Uint8Array(16),Ot=(0,We.u32)(La),mt=t=>(t>>>0&255)<<24|(t>>>8&255)<<16|(t>>>16&255)<<8|t>>>24&255|0;function oh(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 sh{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,We.toBytes)(e),(0,Pn.bytes)(e,16);const r=(0,We.createView)(e);let i=r.getUint32(0,!1),o=r.getUint32(4,!1),a=r.getUint32(8,!1),s=r.getUint32(12,!1);const c=[];for(let p=0;p<128;p++)c.push({s0:mt(i),s1:mt(o),s2:mt(a),s3:mt(s)}),{s0:i,s1:o,s2:a,s3:s}={s3:(d=a)<<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 g=128/f,m=this.windowSize=2**f,w=[];for(let p=0;p<g;p++)for(let S=0;S<m;S++){let _=0,O=0,I=0,j=0;for(let q=0;q<f;q++){if(!(S>>>f-q-1&1))continue;const{s0:F,s1:U,s2:K,s3:G}=c[f*p+q];_^=F,O^=U,I^=K,j^=G}w.push({s0:_,s1:O,s2:I,s3:j})}this.t=w}_updateBlock(e,n,r,i){e^=this.s0,n^=this.s1,r^=this.s2,i^=this.s3;const{W:o,t:a,windowSize:s}=this;let c=0,l=0,u=0,d=0;const h=(1<<o)-1;let f=0;for(const g of[e,n,r,i])for(let m=0;m<4;m++){const w=g>>>8*m&255;for(let p=8/o-1;p>=0;p--){const S=w>>>o*p&h,{s0:_,s1:O,s2:I,s3:j}=a[f*s+S];c^=_,l^=O,u^=I,d^=j,f+=1}}this.s0=c,this.s1=l,this.s2=u,this.s3=d}update(e){e=(0,We.toBytes)(e),(0,Pn.exists)(this);const n=(0,We.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&&(La.set(e.subarray(r*zt)),this._updateBlock(Ot[0],Ot[1],Ot[2],Ot[3]),(0,We.clean)(Ot)),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,Pn.exists)(this),(0,Pn.output)(e,this),this.finished=!0;const{s0:n,s1:r,s2:i,s3:o}=this,a=(0,We.u32)(e);return a[0]=n,a[1]=r,a[2]=i,a[3]=o,e}digest(){const e=new Uint8Array(zt);return this.digestInto(e),this.destroy(),e}}class Sm extends sh{constructor(e,n){e=(0,We.toBytes)(e);const r=oh((0,We.copyBytes)(e));super(r,n),(0,We.clean)(r)}update(e){e=(0,We.toBytes)(e),(0,Pn.exists)(this);const n=(0,We.u32)(e),r=e.length%zt,i=Math.floor(e.length/zt);for(let o=0;o<i;o++)this._updateBlock(mt(n[4*o+3]),mt(n[4*o+2]),mt(n[4*o+1]),mt(n[4*o+0]));return r&&(La.set(e.subarray(i*zt)),this._updateBlock(mt(Ot[3]),mt(Ot[2]),mt(Ot[1]),mt(Ot[0])),(0,We.clean)(Ot)),this}digestInto(e){(0,Pn.exists)(this),(0,Pn.output)(e,this),this.finished=!0;const{s0:n,s1:r,s2:i,s3:o}=this,a=(0,We.u32)(e);return a[0]=n,a[1]=r,a[2]=i,a[3]=o,e.reverse()}}function Zc(t){const e=(r,i)=>t(i,r.length).update((0,We.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}On.ghash=Zc((t,e)=>new sh(t,e)),On.polyval=Zc((t,e)=>new Sm(t,e)),Object.defineProperty(xe,"__esModule",{value:!0}),xe.unsafe=xe.aeskwp=xe.aeskw=xe.siv=xe.gcm=xe.cfb=xe.cbc=xe.ecb=xe.ctr=void 0,xe.expandKeyLE=St,xe.expandKeyDecLE=Lr;const be=Fe,Gs=On,ee=ct,tt=16,hi=new Uint8Array(tt),Cm=283;function Da(t){return t<<1^Cm&-(t>>7)}function Zn(t,e){let n=0;for(;e>0;e>>=1)n^=t&-(1&e),t=Da(t);return n}const Ys=(()=>{const t=new Uint8Array(256);for(let n=0,r=1;n<256;n++,r^=Da(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})(),km=Ys.map((t,e)=>Ys.indexOf(e)),Am=t=>t<<24|t>>>8,is=t=>t<<8|t>>>24,no=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function ah(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(is),i=r.map(is),o=i.map(is),a=new Uint32Array(65536),s=new Uint32Array(65536),c=new Uint16Array(65536);for(let l=0;l<256;l++)for(let u=0;u<256;u++){const d=256*l+u;a[d]=n[l]^r[u],s[d]=i[l]^o[u],c[d]=t[l]<<8|t[u]}return{sbox:t,sbox2:c,T0:n,T1:r,T2:i,T3:o,T01:a,T23:s}}const Ba=ah(Ys,t=>Zn(t,3)<<24|t<<16|t<<8|Zn(t,2)),ch=ah(km,t=>Zn(t,11)<<24|Zn(t,13)<<16|Zn(t,9)<<8|Zn(t,14)),xm=(()=>{const t=new Uint8Array(16);for(let e=0,n=1;e<16;e++,n=Da(n))t[e]=n;return t})();function St(t){(0,be.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}=Ba,r=[];(0,ee.isAligned32)(t)||r.push(t=(0,ee.copyBytes)(t));const i=(0,ee.u32)(t),o=i.length,a=c=>It(n,c,c,c,c),s=new Uint32Array(e+28);s.set(i);for(let c=o;c<s.length;c++){let l=s[c-1];c%o==0?l=a(Am(l))^xm[c/o-1]:o>6&&c%o==4&&(l=a(l)),s[c]=s[c-o]^l}return(0,ee.clean)(...r),s}function Lr(t){const e=St(t),n=e.slice(),r=e.length,{sbox2:i}=Ba,{T0:o,T1:a,T2:s,T3:c}=ch;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=It(i,u,u,u,u);n[l]=o[255&d]^a[d>>>8&255]^s[d>>>16&255]^c[d>>>24]}return n}function bn(t,e,n,r,i,o){return t[n<<8&65280|r>>>8&255]^e[i>>>8&65280|o>>>24&255]}function It(t,e,n,r,i){return t[255&e|65280&n]|t[r>>>16&255|i>>>16&65280]<<16}
8function Ge(t,e,n,r,i){const{sbox2:o,T01:a,T23:s}=Ba;let c=0;e^=t[c++],n^=t[c++],r^=t[c++],i^=t[c++];const l=t.length/4-2;for(let u=0;u<l;u++){const d=t[c++]^bn(a,s,e,n,r,i),h=t[c++]^bn(a,s,n,r,i,e),f=t[c++]^bn(a,s,r,i,e,n),g=t[c++]^bn(a,s,i,e,n,r);e=d,n=h,r=f,i=g}return{s0:t[c++]^It(o,e,n,r,i),s1:t[c++]^It(o,n,r,i,e),s2:t[c++]^It(o,r,i,e,n),s3:t[c++]^It(o,i,e,n,r)}}function Dr(t,e,n,r,i){const{sbox2:o,T01:a,T23:s}=ch;let c=0;e^=t[c++],n^=t[c++],r^=t[c++],i^=t[c++];const l=t.length/4-2;for(let u=0;u<l;u++){const d=t[c++]^bn(a,s,e,i,r,n),h=t[c++]^bn(a,s,n,e,i,r),f=t[c++]^bn(a,s,r,n,e,i),g=t[c++]^bn(a,s,i,r,n,e);e=d,n=h,r=f,i=g}return{s0:t[c++]^It(o,e,i,r,n),s1:t[c++]^It(o,n,e,i,r),s2:t[c++]^It(o,r,n,e,i),s3:t[c++]^It(o,i,r,n,e)}}function nr(t,e){if(e===void 0)return new Uint8Array(t);if((0,be.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 lh(t,e,n,r){(0,be.bytes)(e,tt),(0,be.bytes)(n);const i=n.length;r=nr(i,r);const o=e,a=(0,ee.u32)(o);let{s0:s,s1:c,s2:l,s3:u}=Ge(t,a[0],a[1],a[2],a[3]);const d=(0,ee.u32)(n),h=(0,ee.u32)(r);for(let g=0;g+4<=d.length;g+=4){h[g+0]=d[g+0]^s,h[g+1]=d[g+1]^c,h[g+2]=d[g+2]^l,h[g+3]=d[g+3]^u;let m=1;for(let w=o.length-1;w>=0;w--)m=m+(255&o[w])|0,o[w]=255&m,m>>>=8;({s0:s,s1:c,s2:l,s3:u}=Ge(t,a[0],a[1],a[2],a[3]))}const f=tt*Math.floor(d.length/4);if(f<i){const g=new Uint32Array([s,c,l,u]),m=(0,ee.u8)(g);for(let w=f,p=0;w<i;w++,p++)r[w]=n[w]^m[p];(0,ee.clean)(g)}return r}function Jn(t,e,n,r,i){(0,be.bytes)(n,tt),(0,be.bytes)(r),i=nr(r.length,i);const o=n,a=(0,ee.u32)(o),s=(0,ee.createView)(o),c=(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:g,s2:m,s3:w}=Ge(t,a[0],a[1],a[2],a[3]);for(let S=0;S+4<=c.length;S+=4)l[S+0]=c[S+0]^f,l[S+1]=c[S+1]^g,l[S+2]=c[S+2]^m,l[S+3]=c[S+3]^w,h=h+1>>>0,s.setUint32(u,h,e),{s0:f,s1:g,s2:m,s3:w}=Ge(t,a[0],a[1],a[2],a[3]);const p=tt*Math.floor(c.length/4);if(p<d){const S=new Uint32Array([f,g,m,w]),_=(0,ee.u8)(S);for(let O=p,I=0;O<d;O++,I++)i[O]=r[O]^_[I];(0,ee.clean)(S)}return i}function Jc(t){if((0,be.bytes)(t),t.length%tt!=0)throw new Error("aes/(cbc-ecb).decrypt ciphertext should consist of blocks with size 16")}function Xc(t,e,n){(0,be.bytes)(t);let r=t.length;const i=r%tt;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=tt-i;s||(s=tt),r+=s}const a=nr(r,n);return{b:o,o:(0,ee.u32)(a),out:a}}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=tt-t.length;for(let i=tt-r;i<tt;i++)e[i]=r;return n}function uh(t,e,n,r,i){const o=i==null?0:i.length,a=t.create(n,r.length+o);i&&a.update(i),a.update(r);const s=new Uint8Array(16),c=(0,ee.createView)(s);i&&(0,ee.setBigUint64)(c,0,BigInt(8*o),e),(0,ee.setBigUint64)(c,8,BigInt(8*r.length),e),a.update(s);const l=a.digest();return(0,ee.clean)(s),l}xe.ctr=(0,ee.wrapCipher)({blockSize:16,nonceLength:16},function(t,e){function n(r,i){if((0,be.bytes)(r),i!==void 0&&((0,be.bytes)(i),!(0,ee.isAligned32)(i)))throw new Error("unaligned destination");const o=St(t),a=(0,ee.copyBytes)(e),s=[o,a];(0,ee.isAligned32)(r)||s.push(r=(0,ee.copyBytes)(r));const c=lh(o,a,r,i);return(0,ee.clean)(...s),c}return(0,be.bytes)(t),(0,be.bytes)(e,tt),{encrypt:(r,i)=>n(r,i),decrypt:(r,i)=>n(r,i)}}),xe.ecb=(0,ee.wrapCipher)({blockSize:16},function(t,e={}){(0,be.bytes)(t);const n=!e.disablePadding;return{encrypt(r,i){const{b:o,o:a,out:s}=Xc(r,n,i),c=St(t);let l=0;for(;l+4<=o.length;){const{s0:u,s1:d,s2:h,s3:f}=Ge(c,o[l+0],o[l+1],o[l+2],o[l+3]);a[l++]=u,a[l++]=d,a[l++]=h,a[l++]=f}if(n){const u=el(r.subarray(4*l)),{s0:d,s1:h,s2:f,s3:g}=Ge(c,u[0],u[1],u[2],u[3]);a[l++]=d,a[l++]=h,a[l++]=f,a[l++]=g}return(0,ee.clean)(c),s},decrypt(r,i){Jc(r);const o=Lr(t),a=nr(r.length,i),s=[o];
8(0,ee.isAligned32)(r)||s.push(r=(0,ee.copyBytes)(r));const c=(0,ee.u32)(r),l=(0,ee.u32)(a);for(let u=0;u+4<=c.length;){const{s0:d,s1:h,s2:f,s3:g}=Dr(o,c[u+0],c[u+1],c[u+2],c[u+3]);l[u++]=d,l[u++]=h,l[u++]=f,l[u++]=g}return(0,ee.clean)(...s),Qc(a,n)}}}),xe.cbc=(0,ee.wrapCipher)({blockSize:16,nonceLength:16},function(t,e,n={}){(0,be.bytes)(t),(0,be.bytes)(e,16);const r=!n.disablePadding;return{encrypt(i,o){const a=St(t),{b:s,o:c,out:l}=Xc(i,r,o);let u=e;const d=[a];(0,ee.isAligned32)(u)||d.push(u=(0,ee.copyBytes)(u));const h=(0,ee.u32)(u);let f=h[0],g=h[1],m=h[2],w=h[3],p=0;for(;p+4<=s.length;)f^=s[p+0],g^=s[p+1],m^=s[p+2],w^=s[p+3],{s0:f,s1:g,s2:m,s3:w}=Ge(a,f,g,m,w),c[p++]=f,c[p++]=g,c[p++]=m,c[p++]=w;if(r){const S=el(i.subarray(4*p));f^=S[0],g^=S[1],m^=S[2],w^=S[3],{s0:f,s1:g,s2:m,s3:w}=Ge(a,f,g,m,w),c[p++]=f,c[p++]=g,c[p++]=m,c[p++]=w}return(0,ee.clean)(...d),l},decrypt(i,o){Jc(i);const a=Lr(t);let s=e;const c=[a];(0,ee.isAligned32)(s)||c.push(s=(0,ee.copyBytes)(s));const l=(0,ee.u32)(s),u=nr(i.length,o);(0,ee.isAligned32)(i)||c.push(i=(0,ee.copyBytes)(i));const d=(0,ee.u32)(i),h=(0,ee.u32)(u);let f=l[0],g=l[1],m=l[2],w=l[3];for(let p=0;p+4<=d.length;){const S=f,_=g,O=m,I=w;f=d[p+0],g=d[p+1],m=d[p+2],w=d[p+3];const{s0:j,s1:q,s2:F,s3:U}=Dr(a,f,g,m,w);h[p++]=j^S,h[p++]=q^_,h[p++]=F^O,h[p++]=U^I}return(0,ee.clean)(...c),Qc(u,r)}}}),xe.cfb=(0,ee.wrapCipher)({blockSize:16,nonceLength:16},function(t,e){function n(r,i,o){(0,be.bytes)(r);const a=r.length;o=nr(a,o);const s=St(t);let c=e;const l=[s];(0,ee.isAligned32)(c)||l.push(c=(0,ee.copyBytes)(c)),(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)(c);let g=f[0],m=f[1],w=f[2],p=f[3];for(let _=0;_+4<=u.length;){const{s0:O,s1:I,s2:j,s3:q}=Ge(s,g,m,w,p);d[_+0]=u[_+0]^O,d[_+1]=u[_+1]^I,d[_+2]=u[_+2]^j,d[_+3]=u[_+3]^q,g=h[_++],m=h[_++],w=h[_++],p=h[_++]}const S=tt*Math.floor(u.length/4);if(S<a){({s0:g,s1:m,s2:w,s3:p}=Ge(s,g,m,w,p));const _=(0,ee.u8)(new Uint32Array([g,m,w,p]));for(let O=S,I=0;O<a;O++,I++)o[O]=r[O]^_[I];(0,ee.clean)(_)}return(0,ee.clean)(...l),o}return(0,be.bytes)(t),(0,be.bytes)(e,16),{encrypt:(r,i)=>n(r,!0,i),decrypt:(r,i)=>n(r,!1,i)}}),xe.gcm=(0,ee.wrapCipher)({blockSize:16,nonceLength:12,tagLength:16},function(t,e,n){if((0,be.bytes)(t),(0,be.bytes)(e),n!==void 0&&(0,be.bytes)(n),e.length<8)throw new Error("aes/gcm: invalid nonce length");const r=16;function i(a,s,c){const l=uh(Gs.ghash,!1,a,c,n);for(let u=0;u<s.length;u++)l[u]^=s[u];return l}function o(){const a=St(t),s=hi.slice(),c=hi.slice();if(Jn(a,!1,c,c,s),e.length===12)c.set(e);else{const l=hi.slice(),u=(0,ee.createView)(l);(0,ee.setBigUint64)(u,8,BigInt(8*e.length),!1);const d=Gs.ghash.create(s).update(e).update(l);d.digestInto(c),d.destroy()}return{xk:a,authKey:s,counter:c,tagMask:Jn(a,!1,c,hi)}}return{encrypt(a){(0,be.bytes)(a);const{xk:s,authKey:c,counter:l,tagMask:u}=o(),d=new Uint8Array(a.length+r),h=[s,c,l,u];(0,ee.isAligned32)(a)||h.push(a=(0,ee.copyBytes)(a)),Jn(s,!1,l,a,d);const f=i(c,u,d.subarray(0,d.length-r));return h.push(f),d.set(f,a.length),(0,ee.clean)(...h),d},decrypt(a){if((0,be.bytes)(a),a.length<r)throw new Error("aes/gcm: ciphertext less than tagLen (16)");const{xk:s,authKey:c,counter:l,tagMask:u}=o(),d=[s,c,u,l];(0,ee.isAligned32)(a)||d.push(a=(0,ee.copyBytes)(a));const h=a.subarray(0,-16),f=a.subarray(-16),g=i(c,u,h);if(d.push(g),!(0,ee.equalBytes)(g,f))throw new Error("aes/gcm: invalid ghash tag");const m=Jn(s,!1,l,h);return(0,ee.clean)(...d),m}}});const fi=(t,e,n)=>r=>{if(!Number.isSafeInteger(r)||e>r||r>n)throw new Error(`${t}: invalid value=${r}, must be [${e}..${n}]`)};function dh(t){return t!=null&&typeof t=="object"&&(t instanceof Uint32Array||t.constructor.name==="Uint32Array")}function hh(t,e){if((0,be.bytes)(e,16),!dh(t))throw new Error("_encryptBlock accepts result of expandKeyLE");const n=(0,ee.u32)(e);let{s0:r,s1:i,s2:o,s3:a}=Ge(t,n[0],n[1],n[2],n[3]);return n[0]=r,n[1]=i,n[2]=o,n[3]=a,e}function fh(t,e){if((0,be.bytes)(e,16),!dh(t))throw new Error("_decryptBlock accepts result of expandKeyLE");const n=(0,ee.u32)(e);let{s0:r,s1:i,s2:o,s3:a}=Dr(t,n[0],n[1],n[2],n[3]);return n[0]=r,n[1]=i,n[2]=o,n[3]=a,e}xe.siv=(0,ee.wrapCipher)({blockSize:16,nonceLength:12,tagLength:16},function(t,e,n){const r=fi("AAD",0,68719476736),i=fi("plaintext",0,2**36),o=fi("nonce",12,12),a=fi("ciphertext",16,2**36+16);function s(){const u=St(t),d=new Uint8Array(t.length),h=new Uint8Array(16),f=[u,d];let g=e;(0,ee.isAligned32)(g)||f.push(g=(0,ee.copyBytes)(g));const m=(0,ee.u32)(g);let w=0,p=m[0],S=m[1],_=m[2],O=0;for(const j of[h,d].map(ee.u32)){const q=(0,ee.u32)(j);for(let F=0;F<q.length;F+=2){const{s0:U,s1:K}=Ge(u,w,p,S,_);q[F+0]=U,q[F+1]=K,w=++O}}const I={authKey:h,encKey:St(d)};return(0,ee.clean)(...f),I}function c(u,d,h){const f=uh(Gs.polyval,!0,d,h,n);for(let _=0;_<12;_++)f[_]^=e[_];f[15]&=127;const g=(0,ee.u32)(f);let m=g[0],w=g[1],p=g[2],S=g[3];return{s0:m,s1:w,s2:p,s3:S}=Ge(u,m,w,p,S),g[0]=m,g[1]=w,g[2]=p,g[3]=S,f}function l(u,d,h){let f=(0,ee.copyBytes)(d);f[15]|=128;const g=Jn(u,!0,f,h);return(0,ee.clean)(f),g}return(0,be.bytes)(t,16,24,32),(0,be.bytes)(e),o(e.length),n!==void 0&&((0,be.bytes)(n),r(n.length)),{encrypt
8(u){(0,be.bytes)(u),i(u.length);const{encKey:d,authKey:h}=s(),f=c(d,h,u),g=[d,h,f];(0,ee.isAligned32)(u)||g.push(u=(0,ee.copyBytes)(u));const m=new Uint8Array(u.length+16);return m.set(f,u.length),m.set(l(d,f,u)),(0,ee.clean)(...g),m},decrypt(u){(0,be.bytes)(u),a(u.length);const d=u.subarray(-16),{encKey:h,authKey:f}=s(),g=[h,f];(0,ee.isAligned32)(u)||g.push(u=(0,ee.copyBytes)(u));const m=l(h,d,u.subarray(0,-16)),w=c(h,f,m);if(g.push(w),!(0,ee.equalBytes)(d,w))throw(0,ee.clean)(...g),new Error("invalid polyval tag");return(0,ee.clean)(...g),m}}});const ro={encrypt(t,e){if(e.length>=2**32)throw new Error("plaintext should be less than 4gb");const n=St(t);if(e.length===16)hh(n,e);else{const r=(0,ee.u32)(e);let i=r[0],o=r[1];for(let a=0,s=1;a<6;a++)for(let c=2;c<r.length;c+=2,s++){const{s0:l,s1:u,s2:d,s3:h}=Ge(n,i,o,r[c],r[c+1]);i=l,o=u^no(s),r[c]=d,r[c+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=Lr(t),r=e.length/8-1;if(r===1)fh(n,e);else{const i=(0,ee.u32)(e);let o=i[0],a=i[1];for(let s=0,c=6*r;s<6;s++)for(let l=2*r;l>=1;l-=2,c--){a^=no(c);const{s0:u,s1:d,s2:h,s3:f}=Dr(n,o,a,i[l],i[l+1]);o=u,a=d,i[l]=h,i[l+1]=f}i[0]=o,i[1]=a}n.fill(0)}},tl=new Uint8Array(8).fill(166);xe.aeskw=(0,ee.wrapCipher)({blockSize:8},t=>({encrypt(e){if((0,be.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,be.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;xe.aeskwp=(0,ee.wrapCipher)({blockSize:8},t=>({encrypt(e){if((0,be.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,be.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 a=i;a<o;a++)if(n[8+a]!==0)throw new Error("integrity check failed");return n.subarray(0,8).fill(0),n.subarray(8,8+i)}})),xe.unsafe={expandKeyLE:St,expandKeyDecLE:Lr,encrypt:Ge,decrypt:Dr,encryptBlock:hh,decryptBlock:fh,ctrCounter:lh,ctr32:Jn},Object.defineProperty(tr,"__esModule",{value:!0}),tr.aes256cbc=tr.aes256gcm=void 0;var ph=xe;tr.aes256gcm=function(t,e,n){return(0,ph.gcm)(t,e,n)};tr.aes256cbc=function(t,e,n){return(0,ph.cbc)(t,e)};var io={},mh={},Xn={};Object.defineProperty(Xn,"__esModule",{value:!0}),Xn.sigma=void 0,Xn.rotl=function(t,e){return t<<e|t>>>32-e},Xn.createCipher=function(t,e){const{allowShortKeys:n,extendNonceFn:r,counterLength:i,counterRight:o,rounds:a}=(0,ft.checkOpts)({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},e);if(typeof t!="function")throw new Error("core must be a function");return(0,Ft.number)(i),(0,Ft.number)(a),(0,Ft.bool)(o),(0,Ft.bool)(n),(s,c,l,u,d=0)=>{(0,Ft.bytes)(s),(0,Ft.bytes)(c),(0,Ft.bytes)(l);const h=l.length;if(u===void 0&&(u=new Uint8Array(h)),(0,Ft.bytes)(u),(0,Ft.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 g,m,w=s.length;if(w===32)f.push(g=(0,ft.copyBytes)(s)),m=yh;else{if(w!==16||!n)throw new Error(`arx: invalid 32-byte key, got length=${w}`);g=new Uint8Array(32),g.set(s),g.set(s,16),m=Rm,f.push(g)}os(c)||f.push(c=(0,ft.copyBytes)(c));const p=(0,ft.u32)(g);if(r){if(c.length!==24)throw new Error("arx: extended nonce must be 24 bytes");r(m,p,(0,ft.u32)(c.subarray(0,16)),p),c=c.subarray(16)}const S=16-i;if(S!==c.length)throw new Error(`arx: nonce must be ${S} or 16 bytes`);
8if(S!==12){const O=new Uint8Array(12);O.set(c,o?0:12-c.length),c=O,f.push(c)}const _=(0,ft.u32)(c);return function(O,I,j,q,F,U,K,G){const $=F.length,L=new Uint8Array(pi),R=(0,ft.u32)(L),C=os(F)&&os(U),P=C?(0,ft.u32)(F):il,D=C?(0,ft.u32)(U):il;for(let y=0;y<$;K++){if(O(I,j,q,R,K,G),K>=rl)throw new Error("arx: counter overflow");const E=Math.min(pi,$-y);if(C&&E===pi){const A=y/4;if(y%4!=0)throw new Error("arx: invalid block position");for(let T,b=0;b<Om;b++)T=A+b,D[T]=P[T]^R[b];y+=pi}else{for(let A,T=0;T<E;T++)A=y+T,U[A]=F[A]^L[T];y+=E}}}(t,m,p,_,l,u,d,a),(0,ft.clean)(...f),u}};const Ft=Fe,ft=ct,gh=t=>Uint8Array.from(t.split("").map(e=>e.charCodeAt(0))),Tm=gh("expand 16-byte k"),Mm=gh("expand 32-byte k"),Rm=(0,ft.u32)(Tm),yh=(0,ft.u32)(Mm);function os(t){return t.byteOffset%4==0}Xn.sigma=yh.slice();const pi=64,Om=16,rl=2**32-1,il=new Uint32Array;var kr={};Object.defineProperty(kr,"__esModule",{value:!0}),kr.poly1305=void 0,kr.wrapConstructorWithKey=vh;const mi=Fe,Er=ct,Be=(t,e)=>255&t[e++]|(255&t[e++])<<8;class Pm{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,Er.toBytes)(e),(0,mi.bytes)(e,32);const n=Be(e,0),r=Be(e,2),i=Be(e,4),o=Be(e,6),a=Be(e,8),s=Be(e,10),c=Be(e,12),l=Be(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|a<<12),this.r[5]=a>>>1&8190,this.r[6]=8191&(a>>>14|s<<2),this.r[7]=8065&(s>>>11|c<<5),this.r[8]=8191&(c>>>8|l<<8),this.r[9]=l>>>5&127;for(let u=0;u<8;u++)this.pad[u]=Be(e,16+2*u)}process(e,n,r=!1){const i=r?0:2048,{h:o,r:a}=this,s=a[0],c=a[1],l=a[2],u=a[3],d=a[4],h=a[5],f=a[6],g=a[7],m=a[8],w=a[9],p=Be(e,n+0),S=Be(e,n+2),_=Be(e,n+4),O=Be(e,n+6),I=Be(e,n+8),j=Be(e,n+10),q=Be(e,n+12),F=Be(e,n+14);let U=o[0]+(8191&p),K=o[1]+(8191&(p>>>13|S<<3)),G=o[2]+(8191&(S>>>10|_<<6)),$=o[3]+(8191&(_>>>7|O<<9)),L=o[4]+(8191&(O>>>4|I<<12)),R=o[5]+(I>>>1&8191),C=o[6]+(8191&(I>>>14|j<<2)),P=o[7]+(8191&(j>>>11|q<<5)),D=o[8]+(8191&(q>>>8|F<<8)),y=o[9]+(F>>>5|i),E=0,A=E+U*s+K*(5*w)+G*(5*m)+$*(5*g)+L*(5*f);E=A>>>13,A&=8191,A+=R*(5*h)+C*(5*d)+P*(5*u)+D*(5*l)+y*(5*c),E+=A>>>13,A&=8191;let T=E+U*c+K*s+G*(5*w)+$*(5*m)+L*(5*g);E=T>>>13,T&=8191,T+=R*(5*f)+C*(5*h)+P*(5*d)+D*(5*u)+y*(5*l),E+=T>>>13,T&=8191;let b=E+U*l+K*c+G*s+$*(5*w)+L*(5*m);E=b>>>13,b&=8191,b+=R*(5*g)+C*(5*f)+P*(5*h)+D*(5*d)+y*(5*u),E+=b>>>13,b&=8191;let v=E+U*u+K*l+G*c+$*s+L*(5*w);E=v>>>13,v&=8191,v+=R*(5*m)+C*(5*g)+P*(5*f)+D*(5*h)+y*(5*d),E+=v>>>13,v&=8191;let k=E+U*d+K*u+G*l+$*c+L*s;E=k>>>13,k&=8191,k+=R*(5*w)+C*(5*m)+P*(5*g)+D*(5*f)+y*(5*h),E+=k>>>13,k&=8191;let x=E+U*h+K*d+G*u+$*l+L*c;E=x>>>13,x&=8191,x+=R*s+C*(5*w)+P*(5*m)+D*(5*g)+y*(5*f),E+=x>>>13,x&=8191;let M=E+U*f+K*h+G*d+$*u+L*l;E=M>>>13,M&=8191,M+=R*c+C*s+P*(5*w)+D*(5*m)+y*(5*g),E+=M>>>13,M&=8191;let N=E+U*g+K*f+G*h+$*d+L*u;E=N>>>13,N&=8191,N+=R*l+C*c+P*s+D*(5*w)+y*(5*m),E+=N>>>13,N&=8191;let B=E+U*m+K*g+G*f+$*h+L*d;E=B>>>13,B&=8191,B+=R*u+C*l+P*c+D*s+y*(5*w),E+=B>>>13,B&=8191;let H=E+U*w+K*m+G*g+$*f+L*h;E=H>>>13,H&=8191,H+=R*d+C*u+P*l+D*c+y*s,E+=H>>>13,H&=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]=M,o[7]=N,o[8]=B,o[9]=H}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 a=e[0]+n[0];e[0]=65535&a;for(let s=1;s<8;s++)a=(e[s]+n[s]|0)+(a>>>16)|0,e[s]=65535&a;(0,Er.clean)(r)}update(e){(0,mi.exists)(this);const{buffer:n,blockLen:r}=this,i=(e=(0,Er.toBytes)(e)).length;for(let o=0;o<i;){const a=Math.min(r-this.pos,i-o);if(a!==r)n.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,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,Er.clean)(this.h,this.r,this.buffer,this.pad)}digestInto(e){(0,mi.exists)(this),(0,mi.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 a=0;a<8;a++)e[o++]=r[a]>>>0,e[o++]=r[a]>>>8;return e}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const r=e.slice(0,n);return this.destroy(),r}}function vh(t){const e=(r,i)=>t(i).update((0,Er.toBytes)(r)).digest(),n=t(new Uint8Array(32));return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=r=>t(r),e}kr.poly1305=vh(t=>
8new Pm(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=a;const e=Xn,n=Fe,r=kr,i=ct;function o(d,h,f,g,m,w=20){let p=d[0],S=d[1],_=d[2],O=d[3],I=h[0],j=h[1],q=h[2],F=h[3],U=h[4],K=h[5],G=h[6],$=h[7],L=m,R=f[0],C=f[1],P=f[2],D=p,y=S,E=_,A=O,T=I,b=j,v=q,k=F,x=U,M=K,N=G,B=$,H=L,z=R,J=C,Q=P;for(let se=0;se<w;se+=2)D=D+T|0,H=(0,e.rotl)(H^D,16),x=x+H|0,T=(0,e.rotl)(T^x,12),D=D+T|0,H=(0,e.rotl)(H^D,8),x=x+H|0,T=(0,e.rotl)(T^x,7),y=y+b|0,z=(0,e.rotl)(z^y,16),M=M+z|0,b=(0,e.rotl)(b^M,12),y=y+b|0,z=(0,e.rotl)(z^y,8),M=M+z|0,b=(0,e.rotl)(b^M,7),E=E+v|0,J=(0,e.rotl)(J^E,16),N=N+J|0,v=(0,e.rotl)(v^N,12),E=E+v|0,J=(0,e.rotl)(J^E,8),N=N+J|0,v=(0,e.rotl)(v^N,7),A=A+k|0,Q=(0,e.rotl)(Q^A,16),B=B+Q|0,k=(0,e.rotl)(k^B,12),A=A+k|0,Q=(0,e.rotl)(Q^A,8),B=B+Q|0,k=(0,e.rotl)(k^B,7),D=D+b|0,Q=(0,e.rotl)(Q^D,16),N=N+Q|0,b=(0,e.rotl)(b^N,12),D=D+b|0,Q=(0,e.rotl)(Q^D,8),N=N+Q|0,b=(0,e.rotl)(b^N,7),y=y+v|0,H=(0,e.rotl)(H^y,16),B=B+H|0,v=(0,e.rotl)(v^B,12),y=y+v|0,H=(0,e.rotl)(H^y,8),B=B+H|0,v=(0,e.rotl)(v^B,7),E=E+k|0,z=(0,e.rotl)(z^E,16),x=x+z|0,k=(0,e.rotl)(k^x,12),E=E+k|0,z=(0,e.rotl)(z^E,8),x=x+z|0,k=(0,e.rotl)(k^x,7),A=A+T|0,J=(0,e.rotl)(J^A,16),M=M+J|0,T=(0,e.rotl)(T^M,12),A=A+T|0,J=(0,e.rotl)(J^A,8),M=M+J|0,T=(0,e.rotl)(T^M,7);let ne=0;g[ne++]=p+D|0,g[ne++]=S+y|0,g[ne++]=_+E|0,g[ne++]=O+A|0,g[ne++]=I+T|0,g[ne++]=j+b|0,g[ne++]=q+v|0,g[ne++]=F+k|0,g[ne++]=U+x|0,g[ne++]=K+M|0,g[ne++]=G+N|0,g[ne++]=$+B|0,g[ne++]=L+H|0,g[ne++]=R+z|0,g[ne++]=C+J|0,g[ne++]=P+Q|0}function a(d,h,f,g){let m=d[0],w=d[1],p=d[2],S=d[3],_=h[0],O=h[1],I=h[2],j=h[3],q=h[4],F=h[5],U=h[6],K=h[7],G=f[0],$=f[1],L=f[2],R=f[3];for(let P=0;P<20;P+=2)m=m+_|0,G=(0,e.rotl)(G^m,16),q=q+G|0,_=(0,e.rotl)(_^q,12),m=m+_|0,G=(0,e.rotl)(G^m,8),q=q+G|0,_=(0,e.rotl)(_^q,7),w=w+O|0,$=(0,e.rotl)($^w,16),F=F+$|0,O=(0,e.rotl)(O^F,12),w=w+O|0,$=(0,e.rotl)($^w,8),F=F+$|0,O=(0,e.rotl)(O^F,7),p=p+I|0,L=(0,e.rotl)(L^p,16),U=U+L|0,I=(0,e.rotl)(I^U,12),p=p+I|0,L=(0,e.rotl)(L^p,8),U=U+L|0,I=(0,e.rotl)(I^U,7),S=S+j|0,R=(0,e.rotl)(R^S,16),K=K+R|0,j=(0,e.rotl)(j^K,12),S=S+j|0,R=(0,e.rotl)(R^S,8),K=K+R|0,j=(0,e.rotl)(j^K,7),m=m+O|0,R=(0,e.rotl)(R^m,16),U=U+R|0,O=(0,e.rotl)(O^U,12),m=m+O|0,R=(0,e.rotl)(R^m,8),U=U+R|0,O=(0,e.rotl)(O^U,7),w=w+I|0,G=(0,e.rotl)(G^w,16),K=K+G|0,I=(0,e.rotl)(I^K,12),w=w+I|0,G=(0,e.rotl)(G^w,8),K=K+G|0,I=(0,e.rotl)(I^K,7),p=p+j|0,$=(0,e.rotl)($^p,16),q=q+$|0,j=(0,e.rotl)(j^q,12),p=p+j|0,$=(0,e.rotl)($^p,8),q=q+$|0,j=(0,e.rotl)(j^q,7),S=S+_|0,L=(0,e.rotl)(L^S,16),F=F+L|0,_=(0,e.rotl)(_^F,12),S=S+_|0,L=(0,e.rotl)(L^S,8),F=F+L|0,_=(0,e.rotl)(_^F,7);let C=0;g[C++]=m,g[C++]=w,g[C++]=p,g[C++]=S,g[C++]=G,g[C++]=$,g[C++]=L,g[C++]=R}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:a,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),c=(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,g,m){const w=d(h,f,l),p=r.poly1305.create(w);m&&c(p,m),c(p,g);const S=new Uint8Array(16),_=(0,i.createView)(S);(0,i.setBigUint64)(_,0,BigInt(m?m.length:0),!0),(0,i.setBigUint64)(_,8,BigInt(g.length),!0),p.update(S);const O=p.digest();return(0,i.clean)(w,S),O}t._poly1305_aead=d=>(h,f,g)=>((0,n.bytes)(h,32),(0,n.bytes)(f),{encrypt(w,p){const S=w.length,_=S+16;p?(0,n.bytes)(p,_):p=new Uint8Array(_),d(h,f,w,p,1);const O=u(d,h,f,p.subarray(0,-16),g);return p.set(O,S),(0,i.clean)(O),p},decrypt(w,p){const S=w.length,_=S-16;if(S<16)throw new Error("encrypted data must be at least 16 bytes");p?(0,n.bytes)(p,_):p=new Uint8Array(_);const O=w.subarray(0,-16),I=w.subarray(-16),j=u(d,h,f,O,g);if(!(0,i.equalBytes)(I,j))throw new Error("invalid tag");return d(h,f,O,p,1),(0,i.clean)(j),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))}(mh),Object.defineProperty(io,"__esModule",{value:!0}),io.xchacha20=void 0;var Fn,ol,gr,Im=mh;io.xchacha20=function(t,e,n){return(0,Im.xchacha20poly1305)(t,e,n)}
8,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.aesDecrypt=t.aesEncrypt=t.symDecrypt=t.symEncrypt=void 0;var e=ct,n=Ma,r=tr,i=io,o=Ir,a=Ne;t.symEncrypt=function(u,d,h){return s(c,u,d,h)};function s(u,d,h,f){var g=(0,o.symmetricAlgorithm)();if(g==="aes-256-gcm")return u(r.aes256gcm,d,h,(0,o.symmetricNonceLength)(),a.AEAD_TAG_LENGTH,f);if(g==="xchacha20")return u(i.xchacha20,d,h,a.XCHACHA20_NONCE_LENGTH,a.AEAD_TAG_LENGTH,f);if(g==="aes-256-cbc")return u(r.aes256cbc,d,h,16,0);throw new Error("Not implemented")}function c(u,d,h,f,g,m){var w=(0,n.randomBytes)(f),p=u(d,w,m).encrypt(h);if(g===0)return(0,e.concatBytes)(w,p);var S=p.length-g,_=p.subarray(0,S),O=p.subarray(S);return(0,e.concatBytes)(w,O,_)}function l(u,d,h,f,g,m){var w=h.subarray(0,f),p=u(d,Uint8Array.from(w),m),S=h.subarray(f);if(g===0)return p.decrypt(S);var _=S.subarray(0,g),O=S.subarray(g);return p.decrypt((0,e.concatBytes)(O,_))}t.symDecrypt=function(u,d,h){return s(l,u,d,h)},t.aesEncrypt=t.symEncrypt,t.aesDecrypt=t.symDecrypt}(Yc),Fn=To,ol=vt&&vt.__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]}),gr=vt&&vt.__exportStar||function(t,e){for(var n in t)n==="default"||Object.prototype.hasOwnProperty.call(e,n)||ol(e,t,n)},Object.defineProperty(Fn,"__esModule",{value:!0}),gr(wd,Fn),gr(th,Fn),gr(Vs,Fn),gr(Yc,Fn);var Br={};Object.defineProperty(Br,"__esModule",{value:!0}),Br.PublicKey=void 0;var sl=ct,gi=To,Nm=function(){function t(e){this.data=(0,gi.convertPublicKeyFormat)(e,!0)}return t.fromHex=function(e){return new t((0,gi.hexToPublicKey)(e))},Object.defineProperty(t.prototype,"uncompressed",{get:function(){return X.from((0,gi.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)}
8,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,gi.getSharedKey)(r,i)},t.prototype.equals=function(e){return(0,sl.equalBytes)(this.data,e.data)},t}();Br.PublicKey=Nm,Object.defineProperty(Xi,"__esModule",{value:!0}),Xi.PrivateKey=void 0;var al=ct,zn=To,Lm=Br,Dm=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 Lm.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=Dm,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=Br;Object.defineProperty(t,"PublicKey",{enumerable:!0,get:function(){return n.PublicKey}})}(zo),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.utils=t.PublicKey=t.PrivateKey=t.ECIES_CONFIG=void 0,t.encrypt=function(s,c){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,c);return X.from((0,e.concatBytes)(h,f))},t.decrypt=function(s,c){var l=s instanceof Uint8Array?new r.PrivateKey(s):r.PrivateKey.fromHex(s),u=(0,n.ephemeralKeySize)(),d=new r.PublicKey(c.subarray(0,u)),h=c.subarray(u),f=d.decapsulate(l,(0,n.isHkdfKeyCompressed)());return X.from((0,i.symDecrypt)(f,h))};var e=ct,n=Ir,r=zo,i=To,o=Ir;Object.defineProperty(t,"ECIES_CONFIG",{enumerable:!0,get:function(){return o.ECIES_CONFIG}});var a=zo;Object.defineProperty(t,"PrivateKey",{enumerable:!0,get:function(){return a.PrivateKey}}),Object.defineProperty(t,"PublicKey",{enumerable:!0,get:function(){return a.PublicKey}}),t.utils={aesEncrypt:i.aesEncrypt,aesDecrypt:i.aesDecrypt,symEncrypt:i.symEncrypt,symDecrypt:i.symDecrypt,decodeHex:i.decodeHex,getValidSecret:i.getValidSecret,remove0x:i.remove0x}}(Vn);const bh=Ye("KeyExchange:Layer"),wh=Ye("SocketService:Layer"),Eh=Ye("Ecies:Layer"),_h=Ye("RemoteCommunication:Layer");bh.color="##95c44e",wh.color="#f638d7",Eh.color="#465b9c",_h.color="#47a2be";const V={KeyExchange:bh,SocketService:wh,Ecies:Eh,RemoteCommunication:_h};let yr,yi=[],ss=[];const Qt=(t,e)=>Z(void 0,void 0,void 0,function*(){yr=e,ss.push(t),function(n){return Z(this,void 0,void 0,function*(){if(!yr||!n)return;(function(){const a=ss;ss=yi,yi=a})();const r=yr.endsWith("/")?`${yr}evt`:`${yr}/evt`,i=Object.assign({},n);if(delete i.params,n.params)for(const[a,s]of Object.entries(n.params))i[a]=s;const o=JSON.stringify(i);V.RemoteCommunication(`[sendBufferedEvents] Sending ${yi.length} analytics events to ${r}`);try{const a=yield Pu(r,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:o}),s=yield a.text();V.RemoteCommunication(`[sendBufferedEvents] Response: ${s}`),yi.length=0}catch{}})}(t).catch(()=>{})});class as{constructor(e){this.enabled=!0,e!=null&&e.debug&&Ye.enable("Ecies:Layer"),this.ecies=e!=null&&e.privateKey?Vn.PrivateKey.fromHex(e.privateKey):new Vn.PrivateKey,V.Ecies("[ECIES constructor()] initialized secret: ",this.ecies.toHex()),V.Ecies("[ECIES constructor()] initialized public: ",this.ecies.publicKey.toHex()),V.Ecies("[ECIES constructor()] init with",this)}generateECIES(){this.ecies=new Vn.PrivateKey}getPublicKey(){return this.ecies.publicKey.toHex()}encrypt(e,n){let r=e;if(this.enabled)try{V.Ecies("[ECIES: encrypt()] using otherPublicKey",n);
8const i=X.from(e),o=Vn.encrypt(n,i);r=X.from(o).toString("base64")}catch(i){throw V.Ecies("[ECIES: encrypt()] error encrypt:",i),V.Ecies("[ECIES: encrypt()] private: ",this.ecies.toHex()),V.Ecies("[ECIES: encrypt()] data: ",e),V.Ecies("[ECIES: encrypt()] otherkey: ",n),i}return r}decrypt(e){let n=e;if(this.enabled)try{V.Ecies("[ECIES: decrypt()] using privateKey",this.ecies.toHex());const r=X.from(e.toString(),"base64");n=Vn.decrypt(this.ecies.toHex(),r).toString()}catch(r){throw V.Ecies("[ECIES: decrypt()] error decrypt",r),V.Ecies("[ECIES: decrypt()] private: ",this.ecies.toHex()),V.Ecies("[ECIES: decrypt()] encryptedData: ",e),r}return n}getKeyInfo(){return{private:this.ecies.toHex(),public:this.ecies.publicKey.toHex()}}toString(){V.Ecies("[ECIES: toString()]",this.getKeyInfo())}}var Cn={name:"@metamask/sdk-communication-layer",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.git",directory:"packages/sdk-communication-layer"},main:"dist/node/cjs/metamask-sdk-communication-layer.js",unpkg:"dist/browser/umd/metamask-sdk-communication-layer.js",module:"dist/node/es/metamask-sdk-communication-layer.js",browser:"dist/browser/es/metamask-sdk-communication-layer.js","react-native":"dist/react-native/es/metamask-sdk-communication-layer.js",types:"dist/types/src/index.d.ts",files:["/dist"],scripts:{"build:types":"tsc --project tsconfig.build.json --emitDeclarationOnly --outDir dist/types","build:clean":"yarn clean && yarn build",build:"yarn build:types && rollup -c --bundleConfigAsCjs","build:dev":"yarn build:types && NODE_ENV=dev rollup -c --bundleConfigAsCjs",dev:'concurrently "tsc --watch" "rollup -c --bundleConfigAsCjs -w"',"build:post-tsc":"echo 'N/A'","build:pre-tsc":"echo 'N/A'",size:"size-limit",clean:"rimraf ./dist",lint:"yarn lint:eslint && yarn lint:misc --check","lint:changelog":"../../scripts/validate-changelog.sh @metamask/sdk-communication-layer","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","publish:preview":"yarn npm publish --tag preview",prepack:"../../scripts/prepack.sh",reset:"yarn clean && rimraf ./node_modules/",test:'jest --testPathIgnorePatterns "/e2e/"',"test:e2e":'jest --testPathPattern "/e2e/"',"test:coverage":"jest --coverage","test:ci":'jest --coverage --passWithNoTests --setupFilesAfterEnv ./jest-preload.js --testPathIgnorePatterns "/e2e/"',"test:dev":"jest",watch:"rollup -c --bundleConfigAsCjs -w"},dependencies:{"@metamask/sdk-analytics":"workspace:*",bufferutil:"^4.0.8","date-fns":"^2.29.3",debug:"4.3.4","utf-8-validate":"^5.0.2",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","@rollup/plugin-commonjs":"^25.0.0","@rollup/plugin-json":"^6.0.0","@rollup/plugin-node-resolve":"^15.0.2","@rollup/plugin-replace":"^6.0.1","@rollup/plugin-terser":"^0.4.4","@size-limit/preset-big-lib":"^11.0.2","@types/jest":"^29.2.4","@types/node":"^20.1.3","@types/uuid":"^9.0.0","@typescript-eslint/eslint-plugin":"^4.26.0","@typescript-eslint/parser":"^4.26.0",concurrently:"^9.1.2","cross-fetch":"^4.0.0",eciesjs:"^0.4.11",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",eventemitter2:"^6.4.9",jest:"^29.3.1",prettier:"^2.3.0",rimraf:"^3.0.2",rollup:"^4.26.0","rollup-plugin-jscc":"^2.0.0","rollup-plugin-natives":"^0.7.5","rollup-plugin-node-builtins":"^2.1.2","rollup-plugin-node-globals":"^1.4.0","rollup-plugin-peer-deps-external":"^2.2.4","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.1.6","socket.io-client":"^4.5.1","stream-browserify":"^3.0.0","ts-jest":"^29.0.3","ts-node":"^10.9.1",typescript:"^5.6.3"}
8,peerDependencies:{"cross-fetch":"^4.0.0",eciesjs:"*",eventemitter2:"^6.4.9","readable-stream":"^3.6.2","socket.io-client":"^4.5.1"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},lavamoat:{allowScripts:{"@lavamoat/preinstall-always-fail":!1,canvas:!0,"eciesjs>secp256k1":!1,"socket.io-client>engine.io-client>ws>bufferutil":!1,"socket.io-client>engine.io-client>ws>utf-8-validate":!1,bufferutil:!1,"utf-8-validate":!1}}};const sr="https://metamask-sdk.api.cx.metamask.io/",Bm=["websocket"],ar=6048e5,$m=3e3,Ue={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_SWITCHETHEREUMCHAIN:"wallet_switchEthereumChain",WALLET_ADDETHEREUMCHAIN:"wallet_addEthereumChain",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"},jm=[Ue.METAMASK_CONNECTSIGN,Ue.METAMASK_CONNECTWITH,Ue.METAMASK_OPEN,Ue.METAMASK_BATCH,Ue.PERSONAL_SIGN,Ue.WALLET_REQUESTPERMISSIONS,Ue.WALLET_REVOKEPERMISSIONS,Ue.WALLET_WATCHASSET,Ue.ETH_SENDTRANSACTION,Ue.ETH_SIGNTYPEDDATA,Ue.ETH_SIGNTYPEDDATA_V3,Ue.ETH_SIGNTYPEDDATA_V4,Ue.ETH_SIGNTRANSACTION,Ue.ETH_SIGN,Ue.PERSONAL_EC_RECOVER];function Jr(t){return jm.includes(t)}function Sh(t){const{context:e}=t;V.RemoteCommunication(`[RemoteCommunication: clean()] context=${e}`),t.channelConfig=void 0,t.ready=!1,t.originatorConnectStarted=!1}var je,te,oo,Se,Ae,Re,qn;(qn=je||(je={})).DISCONNECTED="disconnected",qn.WAITING="waiting",qn.TIMEOUT="timeout",qn.LINKED="linked",qn.PAUSED="paused",qn.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_w
8aiting",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 Km extends So.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&&(V.KeyExchange(`[KeyExchange: constructor()] otherPubKey=${n} set keysExchanged to true!`,i),this.keysExchanged=!0),this.myECIES=new as(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(V.KeyExchange(`[KeyExchange: onKeyExchangeMessage()] context=${this.context} keysExchanged=${this.keysExchanged} relayPersistence=${n}`,e),n)return void V.KeyExchange("[KeyExchange: onKeyExchangeMessage()] Ignoring key exchange message because relay persistence is activated");const{message:r}=e;this.keysExchanged&&V.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]),V.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=>{V.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]),V.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_SYNACK"),r.pubkey&&this.setOtherPublicKey(r.pubkey),this.communicationLayer.sendMessage({type:Se.KEY_HANDSHAKE_ACK}).catch(i=>{V.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&&(V.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 as(e)}clean(){V.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?V.KeyExchange("[KeyExchange: start()] Ignoring key exchange message because relay persistence is activated"):(V.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?(V.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(a=>{V.KeyExchange("[KeyExchange: start()] Error sending KEY_HANDSHAKE_SYN",a)})):V.KeyExchange(`[KeyExchange: start()] context=${this.context} -- key exchange already ${this.keysExchanged?"done":"in progress"} -- aborted.`,this.step):this.keysExchanged&&n!==!0?V.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(a=>{V.KeyExchange("[KeyExchange: start()] Error sending KEY_HANDSHAKE_SYNACK",a)}):(this.communicationLayer.sendMessage({type:Se.KEY_HANDSHAKE_START}).catch(a=>{V.KeyExchange("[KeyExchange: start()] Error sending KEY_HANDSHAKE_START",a)}),this.clean()))}
8setStep(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 as({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){V.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"})(Ae||(Ae={})),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"}(Re||(Re={}));const Ii=(t,e,n)=>Z(void 0,void 0,void 0,function*(){var r,i,o,a,s,c;const{remote:l,state:u}=t,{channelId:d,isOriginator:h}=u;if(e==="error_terminated")return V.SocketService(`handleJoinChannelResults: Channel ${d} terminated`),void t.emit(te.TERMINATE);if(!n)return void V.SocketService(`handleJoinChannelResults: No result for channel ${d}`);const{persistence:f,walletKey:g,rejected:m}=n;if(V.SocketService(`handleJoinChannelResults: Channel ${d} persistence=${f} walletKey=${g} rejected=${m}`),m)return V.SocketService(`handleJoinChannelResults: Channel ${d} rejected`),yield t.remote.disconnect({terminate:!0}),t.remote.emit(te.REJECTED,{channelId:d}),void t.remote.emitServiceStatusEvent();if(g&&!(!((r=l.state.channelConfig)===null||r===void 0)&&r.otherKey)){t.getKeyExchange().setOtherPublicKey(g),(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,S=Object.assign(Object.assign({},l.state.channelConfig),{channelId:(o=l.state.channelId)!==null&&o!==void 0?o:"",validUntil:Date.now()+ar,localKey:w==null?void 0:w.getKeyInfo().ecies.private,otherKey:g});t.sendMessage({type:Se.KEY_HANDSHAKE_ACK}).catch(_=>{}),(a=t.state.socket)===null||a===void 0||a.emit(Ae.PING,{id:d,clientType:h?"dapp":"wallet",context:"on_channel_reconnect",message:""}),yield p==null?void 0:p.persistChannelConfig(S),l.emitServiceStatusEvent(),l.setConnectionStatus(je.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),Qt(Object.assign(Object.assign({id:d??"",event:h?Re.CONNECTED:Re.CONNECTED_MOBILE},t.remote.state.originatorInfo),{sdkVersion:t.remote.state.sdkVersion,commLayer:t.state.communicationLayerPreference,commLayerVersion:Cn.version,walletVersion:(c=t.remote.state.walletInfo)===null||c===void 0?void 0:c.version}),u.communicationServerUrl).catch(w=>{}))}),rr=t=>new Promise(e=>{setTimeout(e,t)}),cl=(t,e,...n)=>Z(void 0,[t,e,...n],void 0,function*(r,i,o=200){let a;const s=Date.now();let c=!1;for(;!c;){if(c=Date.now()-s>3e5,a=i[r],a.elapsedTime!==void 0)return a;yield rr(o)}throw new Error(`RPC ${r}
8 timed out`)}),Zs=t=>Z(void 0,void 0,void 0,function*(){const{state:e}=t,{socket:n,channelId:r,context:i,isOriginator:o,isReconnecting:a}=e;if(a)return V.SocketService("[SocketService: reconnectSocket()] Reconnection already in progress, skipping",t),!1;if(!n)return V.SocketService("[SocketService: reconnectSocket()] socket is not defined",t),!1;if(!r)return!1;const{connected:s}=n;e.isReconnecting=!0,e.reconnectionAttempts=0,V.SocketService(`[SocketService: reconnectSocket()] connected=${s} trying to reconnect after socketio disconnection`,t);try{for(;3>e.reconnectionAttempts;){if(V.SocketService(`[SocketService: reconnectSocket()] Attempt ${e.reconnectionAttempts+1} of 3`,t),yield rr(200),n.connected)return V.SocketService("Socket already connected --- ping to retrieve messages"),n.emit(Ae.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((c,l)=>{n.emit(te.JOIN_CHANNEL,{channelId:r,context:`${i}connect_again`,clientType:o?"dapp":"wallet"},(u,d)=>Z(void 0,void 0,void 0,function*(){try{yield Ii(t,u,d),c()}catch(h){l(h)}}))}),yield rr(100),n.connected)return V.SocketService(`Reconnection successful on attempt ${e.reconnectionAttempts+1}`),!0}catch(c){V.SocketService(`Error during reconnection attempt ${e.reconnectionAttempts+1}:`,c)}e.reconnectionAttempts+=1,3>e.reconnectionAttempts&&(yield rr(200))}return V.SocketService("Failed to reconnect after 3 attempts"),!1}finally{e.isReconnecting=!1,e.reconnectionAttempts=0}});function Ch(t,e){return Z(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 V.SocketService(`[SocketService: encryptAndSendMessage()] context=${t.state.context}`,i),e.type===Ae.TERMINATE&&(t.state.manualDisconnect=!0),new Promise((o,a)=>{var s;(s=t.state.socket)===null||s===void 0||s.emit(te.MESSAGE,i,(c,l)=>{var u;c&&(V.SocketService(`[SocketService: encryptAndSendMessage()] error=${c}`),a(c)),V.SocketService("[encryptAndSendMessage] response",l),o((u=l==null?void 0:l.success)!==null&&u!==void 0&&u)})})})}var Qn;(function(t){t.RPC_CHECK="rpcCheck",t.SKIPPED_RPC="skippedRpc"})(Qn||(Qn={}));const kh=["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()),Um=[{event:te.CLIENTS_CONNECTED,handler:function(t,e){return n=>Z(this,void 0,void 0,function*(){var r,i,o,a,s,c,l,u,d,h,f;const g=(i=(r=t.remote.state.channelConfig)===null||r===void 0?void 0:r.relayPersistence)!==null&&i!==void 0&&i;if(V.SocketService(`[SocketService: handleClientsConnected()] context=${t.state.context} on 'clients_connected-${e}' relayPersistence=${g} 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:(a=t.state.keyExchange)===null||a===void 0?void 0:a.areKeysExchanged(),context:t.state.context}),t.state.resumed)t.state.isOriginator||(V.SocketService(`[SocketService: handleClientsConnected()] context=${t.state.context} 'clients_connected' / keysExchanged=${(s=t.state.keyExchange)===null||s===void 0?void 0:s.areKeysExchanged()} -- backward compatibility`),(c=t.state.keyExchange)===null||c===void 0||c.start({isOriginator:(l=t.state.isOriginator)!==null&&l!==void 0&&l})),t.state.resumed=!1;else if(t.state.clientsPaused)V.SocketService("[SocketService: handleClientsConnected()] 'clients_connected' skip sending originatorInfo on pause");else if(!t.state.isOriginator){const m=!g;V.SocketService(`[SocketService: handleClientsConnected()] context=${t.state.context} on 'clients_connected' / keysExchanged=${(u=t.state.keyExchange)===null||u===void 0?void 0:u.areKeysExchanged()} -- force=${m} -- backward compatibility`),V.SocketService(`[SocketService: handleClientsConnected()] context=${t.state.context} on 'clients_connected' / keysExchanged=${(d=t.state.keyExchange)===null||d===void 0?void 0:d.areKeysExchanged()} -- force=${m} -- backward compatibility`),(h=t.state.keyExchange)===null||h===void 0||h.start({isOriginator:(f=t.state.isOriginator)!==null&&f!==void 0&&f,force:m})}t.state.clientsConnected=!0,t.state.clientsPaused=!1})}},{event:te.CHANNEL_CREATED,handler:function(t,e){return n=>{V.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,V.SocketService(`[SocketService: handlesClientsDisconnected()] context=${t.state.context} on 'clients_disconnected-${e}'`),t.remote.state.relayPersistence?V.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=>Z(this,void 0,void 0,function*(){var r,i,o;V.SocketService(`[SocketService: handleChannelConfig()] update relayPersistence on 'config-${e}'`,n);const{persistence:a,walletKey:s}=n;t.state.isOriginator&&t.remote.state.channelConfig?(n.walletKey&&!t.remote.state.channelConfig.otherKey&&(V.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:Ae.PING}),yield(i=t.remote.state.storageManager)===null||i===void 0?void 0:i.persist
8ChannelConfig(t.remote.state.channelConfig)),a!==!0||t.remote.state.channelConfig.relayPersistence||(V.SocketService(`Setting relay persistence ${a}`),t.remote.state.channelConfig.relayPersistence=a,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,a,s,c,l,u,d,h,f,g,m,w,p,S,_,O;const{ackId:I,message:j,error:q}=n,F=(r=t.remote.state.relayPersistence)!==null&&r!==void 0&&r;if(V.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 V.SocketService(` 9 [SocketService handleMessage()] context=${t.state.context}::on 'message' error=${q}`),new Error(q);const U=typeof j=="string";if(!U&&(j==null?void 0:j.type)===Se.KEY_HANDSHAKE_START)return F?void 0:(V.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' received HANDSHAKE_START isOriginator=${t.state.isOriginator}`,j),void((o=t.state.keyExchange)===null||o===void 0||o.start({isOriginator:(a=t.state.isOriginator)!==null&&a!==void 0&&a,force:!0})));if(!U&&(!((s=j==null?void 0:j.type)===null||s===void 0)&&s.startsWith("key_handshake")))return F?void 0:(V.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' emit KEY_EXCHANGE`,j),void t.emit(oo.KEY_EXCHANGE,{message:j,context:t.state.context}));if(U&&!(!((c=t.state.keyExchange)===null||c===void 0)&&c.areKeysExchanged())){let $=!1;try{V.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' trying to decrypt message`),(l=t.state.keyExchange)===null||l===void 0||l.decryptMessage(j),$=!0}catch(L){V.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' error`,L)}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(L=>{}),void V.SocketService(`Message ignored because invalid key exchange status. step=${(f=t.state.keyExchange)===null||f===void 0?void 0:f.getKeyInfo().step}
9`,(g=t.state.keyExchange)===null||g===void 0?void 0:g.getKeyInfo(),j);V.SocketService("Invalid key exchange status detected --- updating it."),(u=t.state.keyExchange)===null||u===void 0||u.setKeysExchanged(!0)}else if(!U&&(j!=null&&j.type))return void t.emit(te.MESSAGE,j);if(!U)return void t.emit(te.MESSAGE,j);const K=(m=t.state.keyExchange)===null||m===void 0?void 0:m.decryptMessage(j),G=JSON.parse(K??"{}");if(I&&(I==null?void 0:I.length)>0&&(V.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' ackid=${I} channelId=${e}`),(w=t.state.socket)===null||w===void 0||w.emit(te.MESSAGE_ACK,{ackId:I,channelId:e,clientType:t.state.isOriginator?"dapp":"wallet"})),t.state.clientsPaused=(G==null?void 0:G.type)===Ae.PAUSE,t.state.isOriginator&&G.data){const $=G.data,L=t.state.rpcMethodTracker[$.id];if(L){const R=Date.now()-L.timestamp;V.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' received answer for id=${$.id} method=${L.method} responseTime=${R}`,G),t.remote.state.analytics&&kh.includes(L.method.toLowerCase())&&Qt(Object.assign(Object.assign({id:(p=t.remote.state.channelId)!==null&&p!==void 0?p:"",event:Re.SDK_RPC_REQUEST_DONE,sdkVersion:t.remote.state.sdkVersion,commLayerVersion:Cn.version},t.remote.state.originatorInfo),{walletVersion:(S=t.remote.state.walletInfo)===null||S===void 0?void 0:S.version,params:{method:L.method,from:"mobile"}}),t.remote.state.communicationServerUrl).catch(P=>{}),Jr(L.method)&&Me.analytics.track($.error?$.error.code===4001?"sdk_action_rejected":"sdk_action_failed":"sdk_action_succeeded",{action:L.method});const C=Object.assign(Object.assign({},L),{result:$.result,error:$.error?{code:(_=$.error)===null||_===void 0?void 0:_.code,message:(O=$.error)===null||O===void 0?void 0:O.message}:void 0,elapsedTime:R});t.state.rpcMethodTracker[$.id]=C,t.emit(te.RPC_UPDATE,C)}}t.emit(te.MESSAGE,{message:G})}}},{event:te.REJECTED,handler:function(t,e){return n=>Z(this,void 0,void 0,function*(){var r;t.state.isOriginator&&!t.remote.state.ready?(V.SocketService(`[SocketService: handleChannelRejected()] context=${t.state.context} channelId=${e} isOriginator=${t.state.isOriginator} ready=${t.remote.state.ready}`,t.remote.state.originatorInfo),Qt(Object.assign(Object.assign({id:e,event:Re.REJECTED},t.remote.state.originatorInfo),{sdkVersion:t.remote.state.sdkVersion,commLayer:t.state.communicationLayerPreference,commLayerVersion:Cn.version,walletVersion:(r=t.remote.state.walletInfo)===null||r===void 0?void 0:r.version}),t.remote.state.communicationServerUrl).catch(i=>{}),Me.analytics.track("sdk_connection_rejected",{transport_type:"websocket"}),yield t.remote.disconnect({terminate:!0}),t.remote.emit(te.REJECTED,{channelId:e}),t.remote.setConnectionStatus(je.DISCONNECTED)):V.SocketService(`[SocketService: handleChannelRejected()] SKIP -- channelId=${e} isOriginator=${t.state.isOriginator} ready=${t.remote.state.ready}`)})}}
9,{event:"clients_waiting_to_join",handler:function(t,e){return n=>{V.SocketService(`[SocketService: handleClientsWaitingToJoin()] context=${t.state.context} on 'clients_waiting_to_join-${e}'`,n),t.emit(te.CLIENTS_WAITING,n)}}}],Hm=[{event:te.KEY_INFO,handler:function(t){return e=>{V.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;V.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 a=t.getKeyExchange().getKeyInfo().ecies;i.localKey=a.private,i.otherKey=a.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){V.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=>{V.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} socket event=error`,i)}),n==null||n.io.on("reconnect",i=>{V.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} socket event=reconnect`,i),Zs(t).catch(o=>{})}),n==null||n.io.on("reconnect_error",i=>{V.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} socket event=reconnect_error`,i)}),n==null||n.io.on("reconnect_failed",()=>{V.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} socket event=reconnect_failed`)})),n==null||n.on("disconnect",i=>(V.SocketService(`[SocketService: setupChannelListener()] on 'disconnect' -- MetaMaskSDK socket disconnected '${i}' begin recovery...`),function(o){return a=>{V.SocketService(`[SocketService: handleDisconnect()] on 'disconnect' manualDisconnect=${o.state.manualDisconnect}`,a),o.state.manualDisconnect||(o.emit(te.SOCKET_DISCONNECTED),Zs(o).catch(s=>{}))}}(t)(i)))),Um.forEach(({event:i,handler:o})=>{n==null||n.on(`${i}-${e}`,o(t,e))}),Hm.forEach(({event:i,handler:o})=>{r==null||r.on(i,o(t))}),t.state.setupChannelListeners=!0}class Fm extends So.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:a,logging:s}=e;this.state.resumed=n,this.state.context=o,this.state.isOriginator=a.state.isOriginator,this.state.communicationLayerPreference=r,this.state.debug=(s==null?void 0:s.serviceLayer)===!0,this.remote=a,(s==null?void 0:s.serviceLayer)===!0&&Ye.enable("SocketService:Layer"),this.state.communicationServerUrl=i,this.state.hasPlaintext=this.state.communicationServerUrl!==sr&&(s==null?void 0:s.plaintext)===!0,V.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:Bm,withCredentials:!0},a=this.state.communicationServerUrl;V.SocketService(`[SocketService: initSocket()] Socket IO url: ${a}`),this.state.socket=Mi(a,o),function(c){if(typeof window<"u"&&typeof document<"u"&&(V.SocketService(`[SocketService: setupSocketFocusListener()] hasFocus=${document.hasFocus()}`,c),!c.state.focusListenerAdded)){const l=()=>{V.SocketService("Document has focus --- reconnecting socket"),Zs(c).catch(u=>{})};window.addEventListener("focus",l),c.state.focusListenerAdded=!0,c.state.removeFocusListener=()=>{window.removeEventListener("focus",l),c.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 Km(s)}resetKeys(){return V.SocketService("[SocketService: resetKeys()] Resetting keys."),void((e=this.state.keyExchange)===null||e===void 0||e.resetKeys());var e}createChannel(){return Z(this,void 0,void 0,function*(){return function(e){return Z(this,void 0,void 0,function*(){var n,r,i;if(V.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=gn();e.state.channelId=o,ll(e,o),yield new Promise((s,c)=>{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)=>Z(this,void 0,void 0,function*(){try{yield Ii(e,u,d),s()}catch(h){c(h)}}))});const a=(i=e.state.keyExchange)===null||i===void 0?void 0:i.getKeyInfo();return{channelId:o,pubKey:(a==null?void 0:a.ecies.public)||"",privKey:(a==null?void 0:a.ecies.private)||""}})}(this)})}
9connectToChannel({channelId:e,withKeyExchange:n=!1,authorized:r}){return function(i){return Z(this,arguments,void 0,function*({options:o,instance:a}){const{channelId:s,authorized:c,withKeyExchange:l}=o,{state:u,remote:d}=a,{isOriginator:h=!1,socket:f,keyExchange:g}=u,{channelConfig:m}=d.state;if(f!=null&&f.connected)throw new Error("socket already connected");if(h&&(m!=null&&m.relayPersistence)){const{localKey:w,otherKey:p}=m;w&&p&&(g==null||g.setRelayPersistence({localKey:w,otherKey:p}))}return Object.assign(u,{manualDisconnect:!1,withKeyExchange:l,isOriginator:h,channelId:s}),f==null||f.connect(),ll(a,s),!h&&c&&(g==null||g.setKeysExchanged(!0),Object.assign(d.state,{ready:!0,authorized:!0})),new Promise(w=>{var p;const S=(p=g==null?void 0:g.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:c&&!h?S:void 0},(_,O)=>Z(this,void 0,void 0,function*(){yield Ii(a,_,O),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 Z(this,void 0,void 0,function*(){return function(n,r){return Z(this,void 0,void 0,function*(){var i,o,a;if(!n.state.channelId)throw V.SocketService("handleSendMessage: no channelId - Create a channel first"),new Error("Create a channel first");
9if(V.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(c,l){var u;V.SocketService(`[SocketService: handleKeyHandshake()] context=${c.state.context}`,l),(u=c.state.socket)===null||u===void 0||u.emit(te.MESSAGE,{id:c.state.channelId,context:c.state.context,clientType:c.state.isOriginator?"dapp":"wallet",message:l})}(n,r),!0;(function(c,l){var u;if(!(!((u=c.state.keyExchange)===null||u===void 0)&&u.areKeysExchanged())&&!c.remote.state.relayPersistence)throw V.SocketService(`[SocketService: validateKeyExchange()] context=${c.state.context} ERROR keys not exchanged`,l),new Error("Keys not exchanged BBB")})(n,r),function(c,l){var u;const d=(u=l==null?void 0:l.method)!==null&&u!==void 0?u:"",h=l==null?void 0:l.id;c.state.isOriginator&&h&&(c.state.rpcMethodTracker[h]={id:h,timestamp:Date.now(),method:d},c.emit(te.RPC_UPDATE,c.state.rpcMethodTracker[h]))}(n,r);const s=yield Ch(n,r);return n.remote.state.analytics&&n.remote.state.isOriginator&&r.method&&kh.includes(r.method.toLowerCase())&&Qt({id:(a=n.remote.state.channelId)!==null&&a!==void 0?a:"",event:Re.SDK_RPC_REQUEST,params:{method:r.method,from:"mobile"}},n.remote.state.communicationServerUrl).catch(c=>{}),n.remote.state.isOriginator&&r.method&&Jr(r.method)&&Me.analytics.track("sdk_action_requested",{action:r.method}),function(c,l){return Z(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(c.state.isOriginator&&d)try{const f=cl(d,c.state.rpcMethodTracker,200).then(w=>({type:Qn.RPC_CHECK,result:w})),g=Z(this,void 0,void 0,function*(){const w=yield(S=>Z(void 0,[S],void 0,function*({rpcId:_,instance:O}){for(;O.state.lastRpcId===_||O.state.lastRpcId===void 0;)yield rr(200);return O.state.lastRpcId}))({instance:c,rpcId:d}),p=yield cl(w,c.state.rpcMethodTracker,200);return{type:Qn.SKIPPED_RPC,result:p}}),m=yield Promise.race([f,g]);if(m.type===Qn.RPC_CHECK){const w=m.result;V.SocketService(`[SocketService:handleRpcReplies()] id=${l.id} ${h} ( ${w.elapsedTime} ms)`,w.result)}else{if(m.type!==Qn.SKIPPED_RPC)throw new Error(`Error handling RPC replies for ${d}`);{const w=Object.assign(Object.assign({},c.state.rpcMethodTracker[d]),{error:new Error("SDK_CONNECTION_ISSUE")});c.emit(te.RPC_UPDATE,w);const p={data:Object.assign(Object.assign({},w),{jsonrpc:"2.0"}),name:"metamask-provider"};c.emit(te.MESSAGE,{message:p})}}}catch(f){throw f}})}(n,r).catch(c=>{}),s})}(this,e)})}ping(){return function(e){return Z(this,void 0,void 0,function*(){var n,r;V.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(Ae.PING,{id:e.state.channelId,context:"ping",clientType:e.remote.state.isOriginator?"dapp":"wallet",message:""})})}(this)}pause(){return function(e){return Z(this,void 0,void 0,function*(){var n,r;V.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:Ae.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 Z(this,void 0,void 0,function*(){const{state:n,remote:r}=e,{socket:i,channelId:o,context:a,keyExchange:s,isOriginator:c}=n,{isOriginator:l}=r.state;if(V.SocketService(`[SocketService: resume()] channelId=${o} context=${a} connected=${i==null?void 0:i.connected} manualDisconnect=${n.manualDisconnect} resumed=${n.resumed} keysExchanged=${s==null?void 0:s.areKeysExchanged()}`),!o)throw V.SocketService("[SocketService: resume()] channelId is not defined"),new Error("ChannelId is not defined");i!=null&&i.connected?(V.SocketService("[SocketService: resume()] already connected."),i.emit(Ae.PING,{id:o,clientType:l?"dapp":"wallet",context:"on_channel_c
9onfig",message:""}),r.hasRelayPersistence()||s!=null&&s.areKeysExchanged()||(c?yield e.sendMessage({type:Ae.READY}):s==null||s.start({isOriginator:!1}))):(i==null||i.connect(),V.SocketService(`[SocketService: resume()] after connecting socket --> connected=${i==null?void 0:i.connected}`),i==null||i.emit(te.JOIN_CHANNEL,{channelId:o,context:`${a}_resume`,clientType:l?"dapp":"wallet"},(u,d)=>Z(this,void 0,void 0,function*(){try{yield Ii(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,a,s,c;V.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,(a=n.state.socket)===null||a===void 0||a.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,(c=n.state.socket)===null||c===void 0||c.disconnect()}(this,e)}}var Dn,ze,ul;function zm(t){return()=>Z(this,void 0,void 0,function*(){var e,n,r;const{state:i}=t;if(i.authorized)return;yield Z(this,void 0,void 0,function*(){for(;!i.walletInfo;)yield rr(500)});const o="7.3".localeCompare(((e=i.walletInfo)===null||e===void 0?void 0:e.version)||"");if(V.RemoteCommunication(`[RemoteCommunication: handleAuthorizedEvent()] HACK 'authorized' version=${(n=i.walletInfo)===null||n===void 0?void 0:n.version} compareValue=${o}`),o!==1)return;const a=i.platformType===ze.MobileWeb||i.platformType===ze.ReactNative||i.platformType===ze.MetaMaskMobileWebview;V.RemoteCommunication(`[RemoteCommunication: handleAuthorizedEvent()] HACK 'authorized' platform=${i.platformType} secure=${a} channel=${i.channelId} walletVersion=${(r=i.walletInfo)===null||r===void 0?void 0:r.version}`),a&&(i.authorized=!0,t.emit(te.AUTHORIZED))})}function qm(t){return e=>{const{state:n}=t;V.RemoteCommunication(`[RemoteCommunication: handleChannelCreatedEvent()] context=${n.context} on 'channel_created' channelId=${e}`),t.emit(te.CHANNEL_CREATED,e)}}function Vm(t,e){return()=>{var n,r,i,o;const{state:a}=t;V.RemoteCommunication(`[RemoteCommunication: handleClientsConnectedEvent()] on 'clients_connected' channel=${a.channelId} keysExchanged=${(r=(n=a.communicationLayer)===null||n===void 0?void 0:n.getKeyInfo())===null||r===void 0?void 0:r.keysExchanged}`),a.analytics&&Qt(Object.assign(Object.assign({id:(i=a.channelId)!==null&&i!==void 0?i:"",event:a.reconnection?Re.RECONNECT:a.isOriginator?Re.REQUEST:Re.REQUEST_MOBILE},a.originatorInfo),{commLayer:e,sdkVersion:a.sdkVersion,walletVersion:(o=a.walletInfo)===null||o===void 0?void 0:o.version,commLayerVersion:Cn.version}),a.communicationServerUrl).catch(s=>{}),a.isOriginator&&!a.reconnection&&Me.analytics.track("sdk_connection_established",{transport_type:"websocket"}),a.clientsConnected=!0,a.originatorInfoSent=!1,t.emit(te.CLIENTS_CONNECTED)}}function Wm(t){return e=>{const{state:n}=t;V.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(je.DISCONNECTED)}}function Gm(t){return e=>{var n;const{state:r}=t;if(V.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] context=${r.context} on 'clients_waiting' numberUsers=${e} ready=${r.ready} autoStarted=${r.originatorConnectStarted}`),t.setConnectionStatus(je.WAITING),t.emit(te.CLIENTS_WAITING,e),r.originatorConnectStarted){V.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(()=>{V.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] setTimeout(${i}) terminate channelConfig`,r.autoConnectOptions),r.originatorConnectStarted=!1,r.ready||t.setConnectionStatus(je.TIMEOUT),clearTimeout(o)},i)}}}function Ym(t,e){return n=>{var r,i,o,a,s,c,l,u;const{state:d}=t;if(V.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:((a=d.channelConfig)===null||a===void 0?void 0:a.validUntil)||ar,localKey:d.communicationLayer.getKeyInfo().ecies.private,otherKey:d.communicationLayer.getKeyInfo().ecies.otherPubKey});
9(s=d.storageManager)===null||s===void 0||s.persistChannelConfig(h).catch(f=>{}),t.setConnectionStatus(je.LINKED)}(function(h,f){var g,m,w,p,S,_,O,I;const{state:j}=h;V.RemoteCommunication(`[RemoteCommunication: setLastActiveDate()] channel=${j.channelId}`,f);const q=Object.assign(Object.assign({},j.channelConfig),{channelId:(g=j.channelId)!==null&&g!==void 0?g:"",validUntil:(w=(m=j.channelConfig)===null||m===void 0?void 0:m.validUntil)!==null&&w!==void 0?w:0,relayPersistence:j.relayPersistence,localKey:(S=(p=j.communicationLayer)===null||p===void 0?void 0:p.state.keyExchange)===null||S===void 0?void 0:S.getKeyInfo().ecies.private,otherKey:(O=(_=j.communicationLayer)===null||_===void 0?void 0:_.state.keyExchange)===null||O===void 0?void 0:O.getKeyInfo().ecies.otherPubKey,lastActive:f.getTime()});(I=j.storageManager)===null||I===void 0||I.persistChannelConfig(q)})(t,new Date),d.analytics&&d.channelId&&Qt(Object.assign(Object.assign({id:d.channelId,event:n.isOriginator?Re.CONNECTED:Re.CONNECTED_MOBILE},d.originatorInfo),{sdkVersion:d.sdkVersion,commLayer:e,commLayerVersion:Cn.version,walletVersion:(c=d.walletInfo)===null||c===void 0?void 0:c.version}),d.communicationServerUrl).catch(h=>{}),d.isOriginator=n.isOriginator,n.isOriginator||((l=d.communicationLayer)===null||l===void 0||l.sendMessage({type:Ae.READY}),d.ready=!0,d.paused=!1),n.isOriginator&&!d.originatorInfoSent&&((u=d.communicationLayer)===null||u===void 0||u.sendMessage({type:Ae.ORIGINATOR_INFO,originatorInfo:d.originatorInfo,originator:d.originatorInfo}),d.originatorInfoSent=!0)}}function Zm(t){return e=>{let n=e;e.message&&(n=n.message),function(r,i){const{state:o}=i;if(V.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] context=${o.context} on 'message' typeof=${typeof r}`,r),i.state.ready=!0,o.isOriginator||r.type!==Ae.ORIGINATOR_INFO)if(o.isOriginator&&r.type===Ae.WALLET_INFO)(function(a,s){const{state:c}=a;c.walletInfo=s.walletInfo,c.paused=!1})(i,r);else{if(o.isOriginator&&r.type===Ae.WALLET_INIT)(function(a,s){return Z(this,void 0,void 0,function*(){var c,l,u;const{state:d}=a;if(d.isOriginator){const h=s.data||{};if(typeof h=="object"&&"accounts"in h&&"chainId"in h&&"walletKey"in h)try{const{channelConfig:f}=a.state;if(V.RemoteCommunication("WALLET_INIT: channelConfig",JSON.stringify(f,null,2)),f){const g=h.accounts,m=h.chainId,w=h.walletKey;let p,S=!1;"deeplinkProtocol"in h&&(S=!!h.deeplinkProtocol,a.state.deeplinkProtocolAvailable=S),"walletVersion"in h&&(p=h.walletVersion),yield(c=a.state.storageManager)===null||c===void 0?void 0:c.persist
9ChannelConfig(Object.assign(Object.assign({},f),{otherKey:w,walletVersion:p,deeplinkProtocolAvailable:S,relayPersistence:!0})),yield(l=a.state.storageManager)===null||l===void 0?void 0:l.persistAccounts(g),yield(u=a.state.storageManager)===null||u===void 0?void 0:u.persistChainId(m)}a.emit(te.WALLET_INIT,{accounts:h.accounts,chainId:h.chainId})}catch{}}})})(i,r).catch(a=>{V.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] error=${a}`)});else if(r.type===Ae.TERMINATE)(function(a){return Z(this,void 0,void 0,function*(){const{state:s}=a;s.isOriginator&&(yield Ah({options:{terminate:!0,sendMessage:!1},instance:a}),a.emit(te.TERMINATE))})})(i).catch(a=>{V.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] error=${a}`)});else if(r.type===Ae.PAUSE)(function(a){const{state:s}=a;s.paused=!0,a.setConnectionStatus(je.PAUSED)})(i);else if(r.type===Ae.READY&&o.isOriginator)(function(a){const{state:s}=a;a.setConnectionStatus(je.LINKED);const c=s.paused;s.paused=!1,a.emit(te.CLIENTS_READY,{isOriginator:s.isOriginator,walletInfo:s.walletInfo}),c&&(s.authorized=!0,a.emit(te.AUTHORIZED))})(i);else{if(r.type===Ae.OTP&&o.isOriginator)return void function(a,s){var c;const{state:l}=a;a.emit(te.OTP,s.otpAnswer),"6.6".localeCompare(((c=l.walletInfo)===null||c===void 0?void 0:c.version)||"")===1&&a.emit(te.SDK_RPC_CALL,{method:Ue.ETH_REQUESTACCOUNTS,params:[]})}(i,r);r.type===Ae.AUTHORIZED&&o.isOriginator&&function(a){const{state:s}=a;s.authorized=!0,a.emit(te.AUTHORIZED)}(i)}i.emit(te.MESSAGE,r)}else(function(a,s){var c;const{state:l}=a;(c=l.communicationLayer)===null||c===void 0||c.sendMessage({type:Ae.WALLET_INFO,walletInfo:l.walletInfo}
9),l.originatorInfo=s.originatorInfo||s.originator,a.emit(te.CLIENTS_READY,{isOriginator:l.isOriginator,originatorInfo:l.originatorInfo}),l.paused=!1})(i,r)}(n,t)}}function Jm(t){return()=>{const{state:e}=t;V.RemoteCommunication("[RemoteCommunication: handleSocketReconnectEvent()] on 'socket_reconnect' -- reset key exchange status / set ready to false"),e.ready=!1,e.authorized=!1,Sh(e),t.emitServiceStatusEvent({context:"socket_reconnect"})}}function Xm(t){return()=>{const{state:e}=t;V.RemoteCommunication("[RemoteCommunication: handleSocketDisconnectedEvent()] on 'socket_Disconnected' set ready to false"),e.ready=!1}}function Qm(t){return()=>Z(this,void 0,void 0,function*(){var e,n,r,i,o,a,s;const{state:c}=t;V.RemoteCommunication(`[RemoteCommunication: handleFullPersistenceEvent()] context=${c.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{c.channelConfig=Object.assign(Object.assign({},c.channelConfig),{localKey:(n=c.communicationLayer)===null||n===void 0?void 0:n.getKeyExchange().getKeyInfo().ecies.private,otherKey:(r=c.communicationLayer)===null||r===void 0?void 0:r.getKeyExchange().getOtherPublicKey(),channelId:(i=c.channelId)!==null&&i!==void 0?i:"",validUntil:(a=(o=c.channelConfig)===null||o===void 0?void 0:o.validUntil)!==null&&a!==void 0?a:ar,relayPersistence:!0}),yield(s=c.storageManager)===null||s===void 0?void 0:s.persistChannelConfig(c.channelConfig)}catch{}})}function dl({communicationLayerPreference:t,otherPublicKey:e,reconnect:n,ecies:r,communicationServerUrl:i=sr,instance:o}){var a,s,c,l,u,d,h,f,g,m,w;const{state:p}=o;if(V.RemoteCommunication("[initCommunicationLayer()] ",JSON.stringify(p,null,2)),t!==Dn.SOCKET)throw new Error("Invalid communication protocol");p.communicationLayer=new Fm({communicationLayerPreference:t,otherPublicKey:e,reconnect:n,transports:p.transports,communicationServerUrl:i,context:p.context,ecies:r,logging:p.logging,remote:o});let S=typeof document<"u"&&document.URL||"",_=typeof document<"u"&&document.title||"";!((a=p.dappMetadata)===null||a===void 0)&&a.url&&(S=p.dappMetadata.url),!((s=p.dappMetadata)===null||s===void 0)&&s.name&&(_=p.dappMetadata.name);const O=(d=(l=(c=p.dappMetadata)===null||c===void 0?void 0:c.name)!==null&&l!==void 0?l:(u=p.dappMetadata)===null||u===void 0?void 0:u.url)!==null&&d!==void 0?d:"N/A",I=typeof window<"u"&&window.location!==void 0&&(h=window.location.hostname)!==null&&h!==void 0?h:O,j={url:S,title:_,source:(f=p.dappMetadata)===null||f===void 0?void 0:f.source,dappId:I,anonId:p.anonId,icon:((g=p.dappMetadata)===null||g===void 0?void 0:g.iconUrl)||((m=p.dappMetadata)===null||m===void 0?void 0:m.base64Icon),platform:p.platformType,apiVersion:Cn.version,connector:(w=p.dappMetadata)===null||w===void 0?void 0:w.connector};p.originatorInfo=j;const q={[te.AUTHORIZED]:zm(o),[te.MESSAGE]:Zm(o),[te.CHANNEL_PERSISTENCE]:Qm(o),[te.CLIENTS_CONNECTED]:Vm(o,t),[te.KEYS_EXCHANGED]:Ym(o,t),[te.SOCKET_DISCONNECTED]:Xm(o),[te.SOCKET_RECONNECT]:Jm(o),[te.CLIENTS_DISCONNECTED]:Wm(o),[te.KEY_INFO]:()=>{},[te.CHANNEL_CREATED]:qm(o),[te.CLIENTS_WAITING]:Gm(o),[te.RPC_UPDATE]:F=>{o.emit(te.RPC_UPDATE,F)}};for(const[F,U]of Object.entries(q))try{p.communicationLayer.on(F,U)}catch{}}function Ah(t){return Z(this,arguments,void 0,function*({options:e,instance:n}){const{state:r}=n;return V.RemoteCommunication(`[RemoteCommunication: disconnect()] channel=${r.channelId}`,e),new Promise((i,o)=>{var a,s,c,l,u,d;e!=null&&e.terminate?(n.state.ready&&Qt({id:(a=n.state.channelId)!==null&&a!==void 0?a:"",event:Re.TERMINATED},n.state.communicationServerUrl).catch(h=>{}),r.ready=!1,r.paused=!1,(s=r.storageManager)===null||s===void 0||s.terminate((c=r.channelId)!==null&&c!==void 0?c:""),n.state.terminated=!0,e.sendMessage?!((l=r.communicationLayer)===null||l===void 0)&&l.getKeyInfo().keysExchanged&&n.state.communicationLayer&&Ch(n.state.communicationLayer,{type:Ae.TERMINATE}).then(()=>{i(!0)}).catch(h=>{o(h)}):i(!0),r.authorized=!1,r.relayPersistence=!1,r.channelId=gn(),e.channelId=r.channelId,r.channelConfig=void 0,r.originatorConnectStarted=!1,(u=r.communicationLayer)===null||u===void 0||u.disconnect(e),n.setConnectionStatus(je.TERMINATED)):((d=r.communicationLayer)===null||d===void 0||d.disconnect(e),n.setConnectionStatus(je.DISCONNECTED),i(!0))})})}(Dn||(Dn={})).SOCKET="socket",function(t){t.NonBrowser="nodejs",t.MetaMaskMobileWebview="in-app-browser",t.DesktopWeb="web-desktop",t.MobileWeb="web-mobile",t.ReactNative="react-native"}(ze||(ze={}));class eg extends So.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:sr,context:"",persist:!1,clientsConnected:!1,sessionDuration:ar,originatorConnectStarted:!1,debug:!1,_connectionStatus:je.DISCONNECTED},this._options=e;const{anonId:n,platformType:r,communicationLayerPreference:i,otherPublicKey:o,reconnect:a,walletInfo:s,dappMetadata:c,protocolVersion:l,transports:u,context:d,relayPersistence:h,ecies:f,analytics:g=!1,storage:m,sdkVersion:w,communicationServerUrl:p=sr,logging:S,autoConnect:_={timeout:$m}}=e;this.state.anonId=n,this.state.otherPublicKey=o,this.state.dappMetadata=c,this.state.walletInfo=s,this.state.transports=u,this.state.platformType=r,this.state.analytics=g,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(je.DISCONNECTED),m!=null&&m.duration&&(this.state.sessionDuration=ar),this.state.storageOptions=m,this.state.autoConnectOptions=_,this.state.debug=(S==null?void 0:S.remoteLayer)===!0,(S==null?void 0:S.remoteLayer)===!0&&Ye.enable("RemoteCommunication:Layer"),(S==null?void 0:S.serviceLayer)===!0&&Ye.enable("SocketService:Layer"),(S==null?void 0:S.eciesLayer)===!0&&Ye.enable("ECIES:Layer"),(S==null?void 0:S.keyExchangeLayer)===!0&&Ye.enable("KeyExchange:Layer"),this.state.logging=S,m!=null&&m.storageManager&&(this.state.storageManager=m.storageManager),V.RemoteCommunication(`[RemoteCommunication: constructor()] protocolVersion=${l} relayPersistence=${h} isOriginator=${this.state.isOriginator} communicationLayerPreference=${i} otherPublicKey=${o} reconnect=${a}`),this.state.isOriginator||dl({communicationLayerPreference:i,otherPublicKey:o,reconnect:a,ecies:f,communicationServerUrl:p,instance:this}),this.emitServiceStatusEvent({context:"constructor"})}initFromDappStorage(){return Z(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(je.LINKED),yield this.connectToChannel
9({channelId:n.channelId})))}dl({communicationLayerPreference:Dn.SOCKET,otherPublicKey:this.state.otherPublicKey,reconnect:this._options.reconnect,ecies:this._options.ecies,communicationServerUrl:this.state.communicationServerUrl,instance:this})})}originatorSessionConnect(){return Z(this,void 0,void 0,function*(){return yield function(e){return Z(this,void 0,void 0,function*(){var n;const{state:r}=e;if(!r.storageManager)return void V.RemoteCommunication("[RemoteCommunication: originatorSessionConnect()] no storage manager defined - skip");const i=yield r.storageManager.getPersistedChannelConfig({});if(V.RemoteCommunication(`[RemoteCommunication: originatorSessionConnect()] autoStarted=${r.originatorConnectStarted} channelConfig`,i),(n=r.communicationLayer)===null||n===void 0?void 0:n.isConnected())return V.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;V.RemoteCommunication("[RemoteCommunication: autoConnect()] Session has expired")}r.originatorConnectStarted=!1})}(this)})}generateChannelIdConnect(){return Z(this,void 0,void 0,function*(){return function(e){return Z(this,void 0,void 0,function*(){var n,r,i,o,a,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=(a=e.communicationLayer)===null||a===void 0?void 0:a.getKeyInfo())===null||s===void 0?void 0:s.ecies.public};V.RemoteCommunication("[RemoteCommunication: generateChannelId()]");const c=yield e.communicationLayer.createChannel();V.RemoteCommunication("[RemoteCommunication: generateChannelId()] channel created",c);const l=Object.assign(Object.assign({},e.channelConfig),{channelId:c.channelId,localKey:c.privKey,validUntil:Date.now()+e.sessionDuration});return e.channelId=c.channelId,e.channelConfig=l,{channelId:e.channelId,pubKey:c.pubKey,privKey:c.privKey}})}(this.state)})}clean(){return Sh(this.state)}connectToChannel({channelId:e,withKeyExchange:n,authorized:r}){return function(i){return Z(this,arguments,void 0,function*({channelId:o,withKeyExchange:a,authorized:s,state:c}){var l,u,d;if(!hc(o))throw V.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${c.context} invalid channel channelId=${o}`),new Error(`Invalid channel ${o}`);if(V.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${c.context} channelId=${o} withKeyExchange=${a}`),(l=c.communicationLayer)===null||l===void 0?void 0:l.isConnected())return void V.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${c.context} already connected - interrupt connection.`);c.channelId=o,yield(u=c.communicationLayer)===null||u===void 0?void 0:u.connectToChannel({channelId:o,authorized:s,withKeyExchange:a});const h=Object.assign(Object.assign({},c.channelConfig),{channelId:o,validUntil:Date.now()+c.sessionDuration});c.channelConfig=h,(d=c.storageManager)===null||d===void 0||d.persist
9ChannelConfig(h)})}({channelId:e,authorized:r,withKeyExchange:n,state:this.state})}sendMessage(e){return Z(this,void 0,void 0,function*(){const n=this.state.isOriginator&&e.method&&Jr(e.method);n&&Me.analytics.track("sdk_action_requested",{action:e.method});try{return yield function(r,i){return Z(this,void 0,void 0,function*(){var o,a;const{state:s}=r;V.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&&(!((a=s.communicationLayer)===null||a===void 0)&&a.isConnected())&&s.clientsConnected||(V.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${s.context} SKIP message waiting for MM mobile readiness.`),yield new Promise(c=>{r.once(te.CLIENTS_READY,c)}),V.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${s.context} AFTER SKIP / READY -- sending pending message`));try{return yield function(l,u){return Z(this,void 0,void 0,function*(){return new Promise(d=>{var h;const{state:f}=l;V.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(g=>{d(g)}).catch(g=>{d(!1)}):l.once(te.AUTHORIZED,()=>{var g;V.RemoteCommunication(`[RemoteCommunication: handleAuthorization()] context=${f.context} AFTER SKIP / AUTHORIZED -- sending pending message`),(g=f.communicationLayer)===null||g===void 0||g.sendMessage(u).then(m=>{d(m)}).catch(m=>{d(!1)})})})})}(r,i)}catch(c){throw c}})}(this,e)}catch(r){throw n&&Me.analytics.track("sdk_action_failed",{action:e.method}),r}})}testStorage(){return Z(this,void 0,void 0,function*(){return function(e){return Z(this,void 0,void 0,function*(){var n;const r=yield(n=e.storageManager)===null||n===void 0?void 0:n.getPersistedChannelConfig();V.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 Z(this,void 0,void 0,function*(){var e;V.RemoteCommunication(`[RemoteCommunication: ping()] channel=${this.state.channelId}`),yield(e=this.state.communicationLayer)===null||e===void 0?void 0:e.ping()})}testLogger(){V.RemoteCommunication(`testLogger() channel=${this.state.channelId}`),V.SocketService(`testLogger() channel=${this.state.channelId}`),V.Ecies(`testLogger() channel=${this.state.channelId}`),V.KeyExchange(`testLogger() channel=${this.state.channelId}`)}keyCheck(){var e;V.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();
9if(!r)throw new Error("KeyExchange is not initialized.");r.getOtherPublicKey()!==e&&r.setOtherPublicKey(e)}pause(){return Z(this,void 0,void 0,function*(){var e;V.RemoteCommunication(`[RemoteCommunication: pause()] channel=${this.state.channelId}`),yield(e=this.state.communicationLayer)===null||e===void 0?void 0:e.pause(),this.setConnectionStatus(je.PAUSED)})}getVersion(){return Cn.version}hasRelayPersistence(){var e;return(e=this.state.relayPersistence)!==null&&e!==void 0&&e}resume(){return Z(this,void 0,void 0,function*(){return function(e){return Z(this,void 0,void 0,function*(){var n;const{state:r}=e;V.RemoteCommunication(`[RemoteCommunication: resume()] channel=${r.channelId}`),yield(n=r.communicationLayer)===null||n===void 0?void 0:n.resume(),e.setConnectionStatus(je.LINKED)})}(this)})}encrypt(e){var n,r,i;const o=(n=this.state.communicationLayer)===null||n===void 0?void 0:n.getKeyExchange(),a=o==null?void 0:o.getOtherPublicKey();if(!a)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,a)}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 Z(this,arguments,void 0,function*({channelId:r,state:i}){var o,a,s;if(!hc(r))throw V.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${i.context} invalid channel channelId=${r}`),new Error(`Invalid channel ${r}`);if(i.isOriginator)return void V.RemoteCommunication(`[RemoteCommunication: reject()] context=${i.context} isOriginator=${i.isOriginator} channelId=${r}`);const{socket:c}=(a=(o=i.communicationLayer)===null||o===void 0?void 0:o.state)!==null&&a!==void 0?a:{};c!=null&&c.connected||(V.RemoteCommunication(`[RemoteCommunication: reject()] context=${i.context} socket already connected`),c==null||c.connect()),Qt(Object.assign(Object.assign({id:r,event:Re.REJECTED},i.originatorInfo),{sdkVersion:i.sdkVersion,commLayerVersion:Cn.version,walletVersion:(s=i.walletInfo)===null||s===void 0?void 0:s.version}),i.communicationServerUrl).catch(l=>{}),yield new Promise((l,u)=>{c==null||c.emit(te.REJECTED,{channelId:r},(d,h)=>{V.RemoteCommunication(`[RemoteCommunication: reject()] context=${i.context} socket=${c==null?void 0:c.id}`,{error:d,response:h}),d?u(d):l(h)})})})}({channelId:e,state:this.state})}disconnect(e){return Z(this,void 0,void 0,function*(){return Ah({options:e,instance:this})})}}(function(t){t.RENEW="renew",t.LINK="link"})(ul||(ul={}));var tg="ERC721",ng="ERC1155",Te={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. 10For 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. 11For 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. 12For 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. 13For 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. 14For 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. 15For 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. 16For 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. 17For 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. 18For 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. 19For 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. 20For 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. 21For 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 rg(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"&&[tg,ng].includes(((o=n.params)==null?void 0:o.type)||"")&&(t.warn(Te.warnings.rpc.walletWatchAssetNFTExperimental),e.walletWatchAssetNFTExperimental=!0):(t.warn(Te.warnings.rpc.ethGetEncryptionPublicKeyDeprecation),e.ethGetEncryptionPublicKeyDeprecation=!0):(t.warn(Te.warnings.rpc.ethDecryptDeprecation),e.ethDecryptDeprecation=!0),i()}}var xh=4294967295,hl=Math.floor(Math.random()*xh);function ig(){return(t,e,n,r)=>{const i=t.id,o=hl=(hl+1)%xh;t.id=o,e.id=o,n(a=>{t.id=i,e.id=i,a()})}}var $a=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},vn=(t,e,n)=>($a(t,e,"read from private field"),n?n.call(t):e.get(t)),_t=(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)},vi=(t,e,n,r)=>($a(t,e,"write to private field"),e.set(t,n),n),Ve=(t,e,n)=>($a(t,e,"access private method"),n),fn={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 og extends TypeError{constructor(e,n){let r;const{message:i,explanation:o,...a}=e,{path:s}=e,c=s.length===0?i:`At path: ${s.join(".")} -- ${i}`;
21super(o??c),o!=null&&(this.cause=c),Object.assign(this,a),this.name=this.constructor.name,this.failures=()=>r??(r=[e,...n()])}}function Xt(t){return typeof t=="object"&&t!=null}function Kt(t){return typeof t=="symbol"?t.toString():typeof t=="string"?JSON.stringify(t):`${t}`}function sg(t,e,n,r){if(t===!0)return;t===!1?t={}:typeof t=="string"&&(t={message:t});const{path:i,branch:o}=e,{type:a}=n,{refinement:s,message:c=`Expected a value of type \`${a}\`${s?` with refinement \`${s}\``:""}, but received: \`${Kt(r)}\``}=t;return{value:r,type:a,refinement:s,key:i[i.length-1],path:i,branch:o,...t,message:c}}function*ml(t,e,n,r){(function(i){return Xt(i)&&typeof i[Symbol.iterator]=="function"})(t)||(t=[t]);for(const i of t){const o=sg(i,e,n,r);o&&(yield o)}}function*ja(t,e,n={}){const{path:r=[],branch:i=[t],coerce:o=!1,mask:a=!1}=n,s={path:r,branch:i};if(o&&(t=e.coercer(t,s),a&&e.type!=="type"&&Xt(e.schema)&&Xt(t)&&!Array.isArray(t)))for(const l in t)e.schema[l]===void 0&&delete t[l];let c="valid";for(const l of e.validator(t,s))l.explanation=n.message,c="not_valid",yield[l,void 0];for(let[l,u,d]of e.entries(t,s)){const h=ja(u,d,{path:l===void 0?r:[...r,l],branch:l===void 0?i:[...i,u],coerce:o,mask:a,message:n.message});for(const f of h)f[0]?(c=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):Xt(t)&&(u!==void 0||l in t)&&(t[l]=u))}
21if(c!=="not_valid")for(const l of e.refiner(t,s))l.explanation=n.message,c="not_refined",yield[l,void 0];c==="valid"&&(yield[void 0,t])}class kt{constructor(e){const{type:n,schema:r,validator:i,refiner:o,coercer:a=c=>c,entries:s=function*(){}}=e;this.type=n,this.schema=r,this.entries=s,this.coercer=a,this.validator=i?(c,l)=>ml(i(c,l),l,this,c):()=>[],this.refiner=o?(c,l)=>ml(o(c,l),l,this,c):()=>[]}assert(e,n){return Th(e,this,n)}create(e,n){return Mh(e,this,n)}is(e){return dr(e,this)}mask(e,n){return function(r,i,o){const a=$r(r,i,{coerce:!0,mask:!0,message:o});if(a[0])throw a[0];return a[1]}(e,this,n)}validate(e,n={}){return $r(e,this,n)}}function Th(t,e,n){const r=$r(t,e,{message:n});if(r[0])throw r[0]}function Mh(t,e,n){const r=$r(t,e,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}function dr(t,e){return!$r(t,e)[0]}function $r(t,e,n={}){const r=ja(t,e,n),i=function(o){const{done:a,value:s}=o.next();return a?void 0:s}(r);return i[0]?[new og(i[0],function*(){for(const a of r)a[0]&&(yield a[0])}),void 0]:[void 0,i[1]]}function kn(t,e){return new kt({type:t,schema:null,validator:e})}function gl(t){let e;return new kt({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 Rh(t){return new kt({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: ${Kt(e)}`})}function Oh(t){const e=Kt(t),n=typeof t;return new kt({type:"literal",schema:n==="string"||n==="number"||n==="boolean"?t:null,validator:r=>r===t||`Expected the literal \`${e}\`, but received: ${Kt(r)}`})}function Ph(){return kn("number",t=>typeof t=="number"&&!isNaN(t)||`Expected a number, but received: ${Kt(t)}`)}function Ih(t){const e=t?Object.keys(t):[],n=kn("never",()=>!1);return new kt({type:"object",schema:t||null,*entries(r){if(t&&Xt(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=>Xt(r)||`Expected an object, but received: ${Kt(r)}`,coercer:r=>Xt(r)?{...r}:r})}function yl(t){return new kt({...t,validator:(e,n)=>e===void 0||t.validator(e,n),refiner:(e,n)=>e===void 0||t.refiner(e,n)})}function Nh(t,e){return new kt({type:"record",schema:null,*entries(n){if(Xt(n))for(const r in n){const i=n[r];yield[r,r,t],yield[r,i,e]}},validator:n=>Xt(n)||`Expected an object, but received: ${Kt(n)}`})}function An(){return kn("string",t=>typeof t=="string"||`Expected a string, but received: ${Kt(t)}`)}function Mo(t){const e=t.map(n=>n.type).join(" | ");return new kt({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[...a]=ja(n,o,r),[s]=a;if(!s[0])return[];for(const[c]of a)c&&i.push(c)}return[`Expected the value to satisfy a union of \`${e}\`, but received: ${Kt(n)}`,...i]}})}function ag(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 cg(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 lg=class extends Error{constructor(t){super(t.message),this.code="ERR_ASSERTION"}};function Lh(){throw new Error("setTimeout has not been defined")}function Dh(){throw new Error("clearTimeout has not been defined")}var an=Lh,cn=Dh;function Bh(t){if(an===setTimeout)return setTimeout(t,0);if((an===Lh||!an)&&setTimeout)return an=setTimeout,setTimeout(t,0);try{return an(t,0)}catch{try{return an.call(null,t,0)}catch{return an.call(this,t,0)}}}typeof Ze.setTimeout=="function"&&(an=setTimeout),typeof Ze.clearTimeout=="function"&&(cn=clearTimeout);var In,Jt=[],ir=!1,Ni=-1;function ug(){ir&&In&&(ir=!1,In.length?Jt=In.concat(Jt):Ni=-1,Jt.length&&$h())}function $h(){if(!ir){var t=Bh(ug);ir=!0;for(var e=Jt.length;e;){for(In=Jt,Jt=[];++Ni<e;)In&&In[Ni].run();Ni=-1,e=Jt.length}In=null,ir=!1,function(n){if(cn===clearTimeout)return clearTimeout(n);if((cn===Dh||!cn)&&clearTimeout)return cn=clearTimeout,clearTimeout(n);try{return cn(n)}catch{try{return cn.call(null,n)}catch{return cn.call(this,n)}}}(t)}}function jh(t,e){this.fun=t,this.array=e}jh.prototype.run=function(){this.fun.apply(null,this.array)};function $n(){}var dg=$n,hg=$n,fg=$n,pg=$n,mg=$n,gg=$n,yg=$n,Wn=Ze.performance||{},vg=Wn.now||Wn.mozNow||Wn.msNow||Wn.oNow||Wn.webkitNow||function(){return new Date().getTime()},bg=new Date,we={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];Jt.push(new jh(t,e)),Jt.length!==1||ir||Bh($h)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:dg,addListener:hg,once:fg,off:pg,removeListener:mg,removeAllListeners:gg,emit:yg,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*vg.call(Wn),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-bg)/1e3}},jr=t=>Ih(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 kt({...t,type:`optional ${t.type}`,validator:(e,n)=>!vl(n)||t.validator(e,n),refiner:(e,n)=>!vl(n)||t.refiner(e,n)})}var bi,bl,wl,co=Mo([Oh(null),kn("boolean",t=>typeof t=="boolean"),kn("finite number",t=>dr(t,Ph())&&Number.isFinite(t)),An(),Rh(gl(()=>co)),Nh(An(),gl(()=>co))]),Kr=(bi=co,bl=kn("any",()=>!0),wl=t=>(function(e,n,r="Assertion failed",i=lg){try{Th(e,n)}catch(o){throw cg(i,`${r}: ${ag(o)}.`)}}(t,co),JSON.parse(JSON.stringify(t,(e,n)=>{if(e!=="__proto__"&&e!=="constructor")return n}))),new kt({...bi,coercer:(t,e)=>dr(t,bl)?bi.coercer(wl(t,e),e):bi.coercer(t,e)}));function Js(t){try{return function(e){Mh(e,Kr)}(t),!0}catch{return!1}}var Ar=Oh("2.0"),Li=function(t){return new kt({...t,validator:(e,n)=>e===null||t.validator(e,n),refiner:(e,n)=>e===null||t.refiner(e,n)})}(Mo([Ph(),An()])),Xs=jr({code:kn("integer",t=>
21typeof t=="number"&&!isNaN(t)&&Number.isInteger(t)||`Expected an integer, but received: ${Kt(t)}`),message:An(),data:ao(Kr),stack:ao(An())}),Kh=Mo([Nh(An(),Kr),Rh(Kr)]),wg=jr({id:Li,jsonrpc:Ar,method:An(),params:ao(Kh)}),Eg=jr({jsonrpc:Ar,method:An(),params:ao(Kh)});function El(t){return dr(t,wg)}function _l(t){return dr(t,Xs)}Ih({id:Li,jsonrpc:Ar,result:yl(kn("unknown",()=>!0)),error:yl(Xs)}),Mo([jr({id:Li,jsonrpc:Ar,result:Kr}),jr({id:Li,jsonrpc:Ar,error:Xs})]);var Sl=fn.internal,_g="Unspecified error message. This is a bug, please report it.",Sg={code:Sl,message:Uh(Sl)},Cg="Unspecified server error.";function Uh(t,e=_g){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 Cg}return e}function Cl(t,{fallbackError:e=Sg,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 a=Hh(i);return{...o,data:{cause:a}}}(t,e);return n||delete r.stack,r}function Hh(t){return Array.isArray(t)?t.map(e=>Js(e)?e:pl(e)?kl(e):null):pl(t)?kl(t):Js(t)?t:null}function kl(t){return Object.getOwnPropertyNames(t).reduce((e,n)=>{const r=t[n];return Js(r)&&(e[n]=r),e},{})}var Fh=_r;_r.default=_r,_r.stable=Al,_r.stableStringify=Al;var lo="[...]",zh="[Circular]",Bn=[],Nn=[];function qh(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function _r(t,e,n,r){var i;r===void 0&&(r=qh()),Qs(t,"",0,[],void 0,0,r);try{i=Nn.length===0?JSON.stringify(t,e,n):JSON.stringify(t,Vh(e),n)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;Bn.length!==0;){var o=Bn.pop();o.length===4?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return i}function or(t,e,n,r){var i=Object.getOwnPropertyDescriptor(r,n);i.get!==void 0?i.configurable?(Object.defineProperty(r,n,{value:t}),Bn.push([r,n,e,i])):Nn.push([e,n,t]):(r[n]=t,Bn.push([r,n,e]))}function Qs(t,e,n,r,i,o,a){var s;if(o+=1,typeof t=="object"&&t!==null){for(s=0;s<r.length;s++)if(r[s]===t)return void or(zh,t,e,i);if(a.depthLimit!==void 0&&o>a.depthLimit||a.edgesLimit!==void 0&&n+1>a.edgesLimit)return void or(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,a);else{var c=Object.keys(t);for(s=0;s<c.length;s++){var l=c[s];Qs(t[l],l,s,r,t,o,a)}}r.pop()}}function kg(t,e){return t<e?-1:t>e?1:0}function Al(t,e,n,r){r===void 0&&(r=qh());var i,o=ea(t,"",0,[],void 0,0,r)||t;try{i=Nn.length===0?JSON.stringify(o,e,n):JSON.stringify(o,Vh(e),n)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;Bn.length!==0;){var a=Bn.pop();a.length===4?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}}return i}function ea(t,e,n,r,i,o,a){var s;if(o+=1,typeof t=="object"&&t!==null){for(s=0;s<r.length;s++)if(r[s]===t)return void or(zh,t,e,i);try{if(typeof t.toJSON=="function")return}catch{return}if(a.depthLimit!==void 0&&o>a.depthLimit||a.edgesLimit!==void 0&&n+1>a.edgesLimit)return void or(lo,t,e,i);if(r.push(t),Array.isArray(t))for(s=0;s<t.length;s++)ea(t[s],s,s,r,t,o,a);else{var c={},l=Object.keys(t).sort(kg);for(s=0;s<l.length;s++){var u=l[s];ea(t[u],u,s,r,t,o,a),c[u]=t[u]}if(i===void 0)return c;Bn.push([i,e,t]),i[e]=c}r.pop()}}function Vh(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 Ag=xo(Fh),qt=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=Hh(this.data.cause))),this.stack&&(t.stack=this.stack),t}toString(){return Ag(this.serialize(),xg,2)}};function xg(t,e){if(e!=="[Circular]")return e}var xr=t=>Tg(fn.invalidRequest,t);function Tg(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:a}=i;
21if(o&&typeof o!="string")throw new Error("Must specify string message.");return[o??void 0,a]}}return[]}(e);return new qt(t,n??Uh(t),r)}var Wh={};function ln(){}function _e(){_e.init.call(this)}function Gh(t){return t._maxListeners===void 0?_e.defaultMaxListeners:t._maxListeners}function xl(t,e,n,r){var i,o,a;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),a=o[e]):(o=t._events=new ln,t._eventsCount=0),a){if(typeof a=="function"?a=o[e]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),!a.warned&&(i=Gh(t))&&i>0&&a.length>i){a.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+e+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=t,s.type=e,s.count=a.length,function(c){typeof console.warn=="function"?console.warn(c):console.log(c)}(s)}}else a=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 vr(t,e){for(var n=new Array(e);e--;)n[e]=t[e];return n}ln.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 ln,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 Gh(this)},_e.prototype.emit=function(t){var e,n,r,i,o,a,s,c=t==="error";if(a=this._events)c=c&&a.error==null;else if(!c)return!1;if(s=this.domain,c){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=a[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 g=d.length,m=vr(d,g),w=0;w<g;++w)m[w].call(f)})(n,u,this);break;case 2:(function(d,h,f,g){if(h)d.call(f,g);else for(var m=d.length,w=vr(d,m),p=0;p<m;++p)w[p].call(f,g)})(n,u,this,arguments[1]);break;case 3:(function(d,h,f,g,m){if(h)d.call(f,g,m);else for(var w=d.length,p=vr(d,w),S=0;S<w;++S)p[S].call(f,g,m)})(n,u,this,arguments[1],arguments[2]);break;case 4:(function(d,h,f,g,m,w){if(h)d.call(f,g,m,w);else for(var p=d.length,S=vr(d,p),_=0;_<p;++_)S[_].call(f,g,m,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,g){if(h)d.apply(f,g);else for(var m=d.length,w=vr(d,m),p=0;p<m;++p)w[p].apply(f,g)})(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,a;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 ln:(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){a=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 ln,this;delete r[t]}else(function(s,c){for(var l=c,u=l+1,d=s.length;u<d;l+=1,u+=1)s[l]=s[u];s.pop()})(n,i);
21r.removeListener&&this.emit("removeListener",t,a||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 ln,this._eventsCount=0):n[t]&&(--this._eventsCount==0?this._events=new ln: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 ln,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),a=0;a<o.length;++a)o[a]=i[a].listener||i[a];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 Ka=Yr(Object.freeze({__proto__:null,EventEmitter:_e,default:_e}));Object.defineProperty(Wh,"__esModule",{value:!0});const Mg=Ka;function Rl(t,e,n){try{Reflect.apply(t,e,n)}catch(r){setTimeout(()=>{throw r})}}let Rg=class extends Mg.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 a=new Error("Unhandled error."+(o?` (${o.message})`:""));throw a.context=o,a}const i=r[t];if(i===void 0)return!1;if(typeof i=="function")Rl(i,this,e);else{const o=i.length,a=function(s){const c=s.length,l=new Array(c);for(let u=0;u<c;u+=1)l[u]=s[u];return l}(i);for(let s=0;s<o;s+=1)Rl(a[s],this,e)}return!0}};var uo,pn,er,Sr,Di,Bi,ta,$i,na,cs,Ol,ji,ra,ls,Pl,Tr,ho,us,Il,Yh=Wh.default=Rg,wt=class Ki extends Yh{constructor({notificationHandler:e}={}){super(),_t(this,Sr),_t(this,Bi),_t(this,$i),_t(this,uo,!1),_t(this,pn,void 0),_t(this,er,void 0),vi(this,pn,[]),vi(this,er,e)}destroy(){vn(this,pn).forEach(e=>{"destroy"in e&&typeof e.destroy=="function"&&e.destroy()}),vi(this,pn,[]),vi(this,uo,!0)}push(e){Ve(this,Sr,Di).call(this),vn(this,pn).push(e)}handle(e,n){if(Ve(this,Sr,Di).call(this),n&&typeof n!="function")throw new Error('"callback" must be a function if provided.');return Array.isArray(e)?n?Ve(this,Bi,ta).call(this,e,n):Ve(this,Bi,ta).call(this,e):n?Ve(this,$i,na).call(this,e,n):this._promiseHandle(e)}asMiddleware(){return Ve(this,Sr,Di).call(this),async(e,n,r,i)=>{var o,a;try{const[s,c,l]=await Ve(o=Ki,ji,ra).call(o,e,n,vn(this,pn));return c?(await Ve(a=Ki,Tr,ho).call(a,l),i(s)):r(async u=>{var d;try{await Ve(d=Ki,Tr,ho).call(d,l)}catch(h){return u(h)}return u()})}catch(s){return i(s)}}}async _promiseHandle(e){return new Promise((n,r)=>{Ve(this,$i,na).call(this,e,(i,o)=>{i&&o===void 0?r(i):n(o)}).catch(r)})}};uo=new WeakMap,pn=new WeakMap,er=new WeakMap,Sr=new WeakSet,Di=function(){if(vn(this,uo))throw new Error("This engine is destroyed and can no longer be used.")},Bi=new WeakSet,ta=async function(t,e){try{if(t.length===0){const r=[{id:null,jsonrpc:"2.0",error:new qt(fn.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}},$i=new WeakSet,na=async function(t,e){var n;if(!t||Array.isArray(t)||typeof t!="object"){const a=new qt(fn.invalidRequest,"Requests must be plain objects. Received: "+typeof t,{request:t});return e(a,{id:null,jsonrpc:"2.0",error:a})}if(typeof t.method!="string"){const a=new qt(fn.invalidRequest,"Must specify a string method. Received: "+typeof t.method,{request:t});return vn(this,er)&&!El(t)?e(null):e(a,{id:t.id??null,jsonrpc:"2.0",error:a})}if(vn(this,er)&&dr(t,Eg)&&!El(t)){try{await vn(this,er).call(this,t)}catch(a){return e(a)}return e(null)}let r=null;const i={...t},o={id:i.id,jsonrpc:i.jsonrpc};try{await Ve(n=wt,cs,Ol).call(n,i,o,vn(this,pn))}
21catch(a){r=a}return r&&(delete o.result,o.error||(o.error=Cl(r))),e(r,o)},cs=new WeakSet,Ol=async function(t,e,n){var r,i,o;const[a,s,c]=await Ve(r=wt,ji,ra).call(r,t,e,n);if(Ve(i=wt,us,Il).call(i,t,e,s),await Ve(o=wt,Tr,ho).call(o,c),a)throw a},ji=new WeakSet,ra=async function(t,e,n){var r;const i=[];let o=null,a=!1;for(const s of n)if([o,a]=await Ve(r=wt,ls,Pl).call(r,t,e,s,i),a)break;return[o,a,i.reverse()]},ls=new WeakSet,Pl=async function(t,e,n,r){return new Promise(i=>{const o=s=>{const c=s||e.error;c&&(e.error=Cl(c)),i([c,!0])},a=s=>{e.error?o(e.error):(s&&(typeof s!="function"&&o(new qt(fn.internal,`JsonRpcEngine: "next" return handlers must be functions. Received "${typeof s}" for request: 22${ds(t)}`,{request:t})),r.push(s)),i([null,!1]))};try{n(t,e,a,o)}catch(s){o(s)}})},Tr=new WeakSet,ho=async function(t){for(const e of t)await new Promise((n,r)=>{e(i=>i?r(i):n())})},us=new WeakSet,Il=function(t,e,n){if(!so(e,"result")&&!so(e,"error"))throw new qt(fn.internal,`JsonRpcEngine: Response has no error or result for request: 23${ds(t)}`,{request:t});if(!n)throw new qt(fn.internal,`JsonRpcEngine: Nothing ended request: 24${ds(t)}`,{request:t})},_t(wt,cs),_t(wt,ji),_t(wt,ls),_t(wt,Tr),_t(wt,us);var Og=wt;function ds(t){return JSON.stringify(t,null,2)}var Zh=Object.freeze(["eth_subscription"]),Pg=(t=console)=>[ig(),Ig(t),rg(t)];function Ig(t){return(e,n,r)=>{typeof e.method=="string"&&e.method||(n.error=xr({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 Ui=(t,e,n=!0)=>(r,i)=>{r||i.error?e(r||i.error):!n||Array.isArray(i)?t(i):t(i.result)},Jh=t=>!!t&&typeof t=="string"&&t.startsWith("0x"),Xh=()=>{};async function Nl(t,e){try{const n=await async function(){return{name:Ng(window),icon:await Lg(window)}}();t.handle({jsonrpc:"2.0",id:1,method:"metamask_sendDomainMetadata",params:n},Xh)}catch(n){e.error({message:Te.errors.sendSiteMetadata(),originalError:n})}}function Ng(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 Lg(t){const{document:e}=t,n=e.querySelectorAll('head > link[rel~="icon"]');for(const r of Array.from(n))if(r&&await Dg(r.href))return r.href;return null}async function Dg(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 Qh=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},Pt=(t,e,n)=>(Qh(t,e,"read from private field"),n?n.call(t):e.get(t)),ia=(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)},Vt=(t,e,n,r)=>(Qh(t,e,"write to private field"),e.set(t,n),n);function Ll(t,e,n){try{Reflect.apply(t,e,n)}catch(r){setTimeout(()=>{throw r})}}class Bg 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 a;if(n.length>0&&([a]=n),a instanceof Error)throw a;const s=new Error("Unhandled error."+(a?` (${a.message})`:""));throw s.context=a,s}const o=i[e];if(o===void 0)return!1;if(typeof o=="function")Ll(o,this,n);else{const a=o.length,s=function(c){const l=c.length,u=new Array(l);for(let d=0;d<l;d+=1)u[d]=c[d];return u}(o);for(let c=0;c<a;c+=1)Ll(s[c],this,n)}return!0}}var un,Mn,$g=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 a=o[i];if(!t(e[a],n[a]))return!1}return!0}return e!=e&&n!=n},jg=xo($g),ef=class tf extends Bg{constructor({logger:e=console,maxEventListeners:n=100,rpcMiddleware:r=[]}={}){super(),ia(this,un,void 0),ia(this,Mn,void 0),this._log=e,this.setMaxListeners(n),this._state={...tf._defaultState},Vt(this,Mn,null),Vt(this,un,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 Og;r.forEach(o=>i.push(o)),this._rpcEngine=i}get chainId(){return Pt(this,un)}get selectedAddress(){return Pt(this,Mn)}isConnected(){return this._state.isConnected}async request(e){if(!e||typeof e!="object"||Array.isArray(e))throw xr({message:Te.errors.invalidRequestArgs(),data:e});const{method:n,params:r}=e;
24if(typeof n!="string"||n.length===0)throw xr({message:Te.errors.invalidRequestMethod(),data:e});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw xr({message:Te.errors.invalidRequestParams(),data:e});const i=r==null?{method:n}:{method:n,params:r};return new Promise((o,a)=>{this._rpcRequest(i,Ui(o,a))})}_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(Te.info.connected(e)))}_handleDisconnect(e,n){if(this._state.isConnected||!this._state.isPermanentlyDisconnected&&!e){let r;this._state.isConnected=!1,e?(r=new qt(1013,n??Te.errors.disconnected()),this._log.debug(r)):(r=new qt(1011,n??Te.errors.permanentlyDisconnected()),this._log.error(r),Vt(this,un,null),this._state.accounts=null,Vt(this,Mn,null),this._state.isUnlocked=!1,this._state.isPermanentlyDisconnected=!0),this.emit("disconnect",r)}}_handleChainChanged({chainId:e}={}){Jh(e)?(this._handleConnect(e),e!==Pt(this,un)&&(Vt(this,un,e),this._state.initialized&&this.emit("chainChanged",Pt(this,un)))):this._log.error(Te.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(!jg(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,Pt(this,Mn)!==r[0]&&Vt(this,Mn,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.")}};un=new WeakMap,Mn=new WeakMap,ef._defaultState={accounts:null,isConnected:!1,isUnlocked:!1,initialized:!1,isPermanentlyDisconnected:!1};var Ua,Kg=ef,oa={exports:{}},nf=Ka.EventEmitter,Ha=Yr(tm);Ua=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 rf=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},Ug=/%[sdj%]/g;function Ro(t){if(!Ur(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(Bt(arguments[n]));return e.join(" ")}n=1;for(var r=arguments,i=r.length,o=String(t).replace(Ug,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}}),a=r[n];n<i;a=r[++n])Xr(a)||!jn(a)?o+=" "+a:o+=" "+Bt(a);return o}function Fa(t,e){if(Nt(Ze.process))return function(){return Fa(t,e).apply(this,arguments)};if(we.noDeprecation===!0)return t;var n=!1;return function(){if(!n){if(we.throwDeprecation)throw new Error(e);we.traceDeprecation?console.trace(e):console.error(e),n=!0}return t.apply(this,arguments)}}var hs,wi={};function of(t){return Nt(hs)&&(hs=we.env.NODE_DEBUG||""),t=t.toUpperCase(),!wi[t]&&(new RegExp("\\b"+t+"\\b","i").test(hs)?wi[t]=function(){var e=Ro.apply(null,arguments);console.error("%s %d: %s",t,0,e)}:wi[t]=function(){}),wi[t]}function Bt(t,e){var n={seen:[],stylize:Fg};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),Oo(e)?n.showHidden=e:e&&Wa(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=Hg),fo(n,t,n.depth)}function Hg(t,e){var n=Bt.styles[e];return n?"\x1B["+Bt.colors[n][0]+"m"+t+"\x1B["+Bt.colors[n][1]+"m":t}function Fg(t,e){return t}function fo(t,e,n){if(t.customInspect&&e&&Or(e.inspect)&&e.inspect!==Bt&&(!e.constructor||e.constructor.prototype!==e)){var r=e.inspect(n,t);return Ur(r)||(r=fo(t,r,n)),r}var i=function(h,f){if(Nt(f))return h.stylize("undefined","undefined");if(Ur(f)){var g="'"+JSON.stringify(f).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return h.stylize(g,"string")}if(qa(f))return h.stylize(""+f,"number");if(Oo(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),a=function(h){var f={};return h.forEach(function(g,m){f[g]=!0}
24),f}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),Rr(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return fs(e);if(o.length===0){if(Or(e)){var s=e.name?": "+e.name:"";return t.stylize("[Function"+s+"]","special")}if(Mr(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(po(e))return t.stylize(Date.prototype.toString.call(e),"date");if(Rr(e))return fs(e)}var c,l="",u=!1,d=["{","}"];return za(e)&&(u=!0,d=["[","]"]),Or(e)&&(l=" [Function"+(e.name?": "+e.name:"")+"]"),Mr(e)&&(l=" "+RegExp.prototype.toString.call(e)),po(e)&&(l=" "+Date.prototype.toUTCString.call(e)),Rr(e)&&(l=" "+fs(e)),o.length!==0||u&&e.length!=0?n<0?Mr(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),c=u?function(h,f,g,m,w){for(var p=[],S=0,_=f.length;S<_;++S)df(f,String(S))?p.push(ps(h,f,g,m,String(S),!0)):p.push("");return w.forEach(function(O){O.match(/^\d+$/)||p.push(ps(h,f,g,m,O,!0))}),p}(t,e,n,a,o):o.map(function(h){return ps(t,e,n,a,h,u)}),t.seen.pop(),function(h,f,g){var m=h.reduce(function(w,p){return p.indexOf(` 25`),w+p.replace(/\u001b\[\d\d?m/g,"").length+1},0);return m>60?g[0]+(f===""?"":f+` 26 `)+" "+h.join(`, 27 `)+" "+g[1]:g[0]+f+" "+h.join(", ")+" "+g[1]}(c,l,d)):d[0]+l+d[1]}function fs(t){return"["+Error.prototype.toString.call(t)+"]"}function ps(t,e,n,r,i,o){var a,s,c;if((c=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?s=c.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):c.set&&(s=t.stylize("[Setter]","special")),df(r,i)||(a="["+i+"]"),s||(t.seen.indexOf(c.value)<0?(s=Xr(n)?fo(t,c.value,null):fo(t,c.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(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+s}function za(t){return Array.isArray(t)}function Oo(t){return typeof t=="boolean"}function Xr(t){return t===null}function sf(t){return t==null}function qa(t){return typeof t=="number"}function Ur(t){return typeof t=="string"}function af(t){return typeof t=="symbol"}function Nt(t){return t===void 0}function Mr(t){return jn(t)&&Va(t)==="[object RegExp]"}function jn(t){return typeof t=="object"&&t!==null}function po(t){return jn(t)&&Va(t)==="[object Date]"}function Rr(t){return jn(t)&&(Va(t)==="[object Error]"||t instanceof Error)}function Or(t){return typeof t=="function"}function cf(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||typeof t=="symbol"||t===void 0}function lf(t){return X.isBuffer(t)}function Va(t){return Object.prototype.toString.call(t)}function ms(t){return t<10?"0"+t.toString(10):t.toString(10)}Bt.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]},Bt.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var zg=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function uf(){var t,e;console.log("%s - %s",(t=new Date,e=[ms(t.getHours()),ms(t.getMinutes()),ms(t.getSeconds())].join(":"),[t.getDate(),zg[t.getMonth()],e].join(" ")),Ro.apply(null,arguments))}function Wa(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 df(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var Rn=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;function Ga(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');if(Rn&&t[Rn]){var e;if(typeof(e=t[Rn])!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,Rn,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var n,r,i=new Promise(function(s,c){n=s,r=c}),o=[],a=0;a<arguments.length;a++)o.push(arguments[a]);o.push(function(s,c){s?r(s):n(c)});try{t.apply(this,o)}catch(s){r(s)}return i}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Rn&&Object.defineProperty(e,Rn,{value:e,enumerable:!1,writable:!1,
33configurable:!0}),Object.defineProperties(e,rf(t))}function qg(t,e){if(!t){var n=new Error("Promise was rejected with a falsy value");n.reason=t,t=n}return e(t)}function hf(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,a=function(){return i.apply(o,arguments)};t.apply(this,n).then(function(s){we.nextTick(a.bind(null,null,s))},function(s){we.nextTick(qg.bind(null,s,a))})}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Object.defineProperties(e,rf(t)),e}Ga.custom=Rn;var gs,Dl,Vg={inherits:Ua,_extend:Wa,log:uf,isBuffer:lf,isPrimitive:cf,isFunction:Or,isError:Rr,isDate:po,isObject:jn,isRegExp:Mr,isUndefined:Nt,isSymbol:af,isString:Ur,isNumber:qa,isNullOrUndefined:sf,isNull:Xr,isBoolean:Oo,isArray:za,inspect:Bt,deprecate:Fa,format:Ro,debuglog:of,promisify:Ga,callbackify:hf},ff=Yr(Object.freeze({__proto__:null,_extend:Wa,callbackify:hf,debuglog:of,default:Vg,deprecate:Fa,format:Ro,inherits:Ua,inspect:Bt,isArray:za,isBoolean:Oo,isBuffer:lf,isDate:po,isError:Rr,isFunction:Or,isNull:Xr,isNullOrUndefined:sf,isNumber:qa,isObject:jn,isPrimitive:cf,isRegExp:Mr,isString:Ur,isSymbol:af,isUndefined:Nt,log:uf,promisify:Ga}));function Wg(){if(Dl)return gs;function t(c,l){var u=Object.keys(c);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(c);l&&(d=d.filter(function(h){return Object.getOwnPropertyDescriptor(c,h).enumerable})),u.push.apply(u,d)}return u}function e(c){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(c,d,u[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(c,Object.getOwnPropertyDescriptors(u)):t(Object(u)).forEach(function(d){Object.defineProperty(c,d,Object.getOwnPropertyDescriptor(u,d))})}return c}function n(c,l,u){return(l=i(l))in c?Object.defineProperty(c,l,{value:u,enumerable:!0,configurable:!0,writable:!0}):c[l]=u,c}function r(c,l,u){return l&&function(d,h){for(var f=0;f<h.length;f++){var g=h[f];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(d,i(g.key),g)}}(c.prototype,l),Object.defineProperty(c,"prototype",{writable:!1}),c}function i(c){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)}(c,"string");return typeof l=="symbol"?l:String(l)}Dl=1;var o=Ha.Buffer,a=ff.inspect,s=a&&a.custom||"inspect";return gs=function(){function c(){(function(l,u){if(!(l instanceof u))throw new TypeError("Cannot call a class as a function")})(this,c),this.head=null,this.tail=null,this.length=0}return r(c,[{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),g=this.head,m=0;g;)u=g.data,d=f,h=m,o.prototype.copy.call(u,d,h),m+=g.data.length,g=g.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,g=l>f.length?f.length:l;if(g===f.length?h+=f:h+=f.slice(0,l),(l-=g)===0){g===f.length?(++d,u.next?this.head=u.next:this.head=this.tail=null):(this.head=u,u.data=f.slice(g));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,g=l>f.length?f.length:l;if(f.copy(u,u.length-l,0,g),(l-=g)===0){g===f.length?(++h,d.next?this.head=d.next:this.head=this.tail=null):(this.head=d,d.data=f.slice(g));break}++h}return this.length-=h,u}},{key:s,value:function(l,u){return a(this,e(e({},u),{},{depth:0,customInspect:!1}))}}]),c}(),gs}function Bl(t,e){sa(t,e),Hi(t)}function Hi(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function sa(t,e){t.emit("error",e)}var pf={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,we.nextTick(sa,this,t)):we.nextTick(sa,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?we.nextTick(Hi,n):(n._writableState.errorEmitted=!0,we.nextTick(Bl,n,o)):we.nextTick(Bl,n,o):e?(we.nextTick(Hi,n),e(o)):we.nextTick(Hi,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)}},Kn={},mf={};function ut(t,e,n){n||(n=Error);var r=function(i){var o,a;function s(c,l,u){return i.call(this,function(d,h,f){return typeof e=="string"?e:e(d,h,f)}(c,l,u))||this}return a=i,(o=s).prototype=Object.create(a.prototype),o.prototype.constructor=o,o.__proto__=a,s}(n);r.prototype.name=n.name,r.prototype.code=t,mf[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))}ut("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invali
33d for option "'+t+'"'},TypeError),ut("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,c,l){return(l===void 0||l>s.length)&&(l=s.length),s.substring(l-c.length,l)===c}(t," argument"))o="The ".concat(t," ").concat(r," ").concat($l(e,"type"));else{var a=function(s,c,l){return typeof l!="number"&&(l=0),!(l+c.length>s.length)&&s.indexOf(c,l)!==-1}(t,".")?"property":"argument";o='The "'.concat(t,'" ').concat(a," ").concat(r," ").concat($l(e,"type"))}return o+=". Received type ".concat(typeof n)},TypeError),ut("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),ut("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"}),ut("ERR_STREAM_PREMATURE_CLOSE","Premature close"),ut("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"}),ut("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),ut("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),ut("ERR_STREAM_WRITE_AFTER_END","write after end"),ut("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),ut("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError),ut("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Kn.codes=mf;var Gg=Kn.codes.ERR_INVALID_OPT_VALUE,ys,jl,vs,Kl,gf={getHighWaterMark:function(t,e,n,r){var i=function(o,a,s){return o.highWaterMark!=null?o.highWaterMark:a?o[s]:null}(e,r,n);if(i!=null){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new Gg(r?n:"highWaterMark",i);return Math.floor(i)}return t.objectMode?16:16384}},Yg=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:Yg})),Zg=function(t,e){if(bs("noDeprecation"))return t;var n=!1;return function(){if(!n){if(bs("throwDeprecation"))throw new Error(e);bs("traceDeprecation")?console.trace(e):console.warn(e),n=!0}return t.apply(this,arguments)}};function bs(t){try{if(!vt.localStorage)return!1}catch{return!1}var e=vt.localStorage[t];return e!=null&&String(e).toLowerCase()==="true"}function yf(){if(jl)return ys;function t($){var L=this;this.next=null,this.entry=null,this.finish=function(){(function(R,C,P){var D=R.entry;for(R.entry=null;D;){var y=D.callback;C.pendingcb--,y(P),D=D.next}C.corkedRequestsFree.next=R})(L,$)}}var e;jl=1,ys=I,I.WritableState=O;var n={deprecate:Zg},r=nf,i=Ha.Buffer,o=(vt!==void 0?vt:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){},a,s=pf,c=gf.getHighWaterMark,l=Kn.codes,u=l.ERR_INVALID_ARG_TYPE,d=l.ERR_METHOD_NOT_IMPLEMENTED,h=l.ERR_MULTIPLE_CALLBACK,f=l.ERR_STREAM_CANNOT_PIPE,g=l.ERR_STREAM_DESTROYED,m=l.ERR_STREAM_NULL_VALUES,w=l.ERR_STREAM_WRITE_AFTER_END,p=l.ERR_UNKNOWN_ENCODING,S=s.errorOrDestroy;function _(){}function O($,L,R){e=e||cr(),$=$||{},typeof R!="boolean"&&(R=L instanceof e),this.objectMode=!!$.objectMode,R&&(this.objectMode=this.objectMode||!!$.writableObjectMode),this.highWaterMark=c(this,$,"writableHighWaterMark",R),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var C=$.decodeStrings===!1;this.decodeStrings=!C,this.defaultEncoding=$.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(P){(function(D,y){var E=D._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,M,N){--k.pendingcb,x?(we.nextTick(N,M),we.nextTick(G,v,k),v._writableState.errorEmitted=!0,S(v,M)):(N(M),v._writableState.errorEmitted=!0,S(v,M),G(v,k))})(D,E,A,y,T);else{var b=U(E)||D.destroyed;b||E.corked||E.bufferProcessing||!E.bufferedRequest||F(D,E),A?we.nextTick(q,D,E,b,T):q(D,E,b,T)}})(L,P)},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 I($){var L=this instanceof(e=e||cr());if(!L&&!a.call(I,this))return new I($);this._writableState=new O($,this,L),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 j($,L,R,C,P,D,y){L.writelen=C,L.writecb=y,L.writing=!0,L.sync=!0,L.destroyed?L.onwrite(new g("write")):R?$._writev(P,L.onwrite):$._write(P,D,L.onwrite),L.sync=!1}
33function q($,L,R,C){R||function(P,D){D.length===0&&D.needDrain&&(D.needDrain=!1,P.emit("drain"))}($,L),L.pendingcb--,C(),G($,L)}function F($,L){L.bufferProcessing=!0;var R=L.bufferedRequest;if($._writev&&R&&R.next){var C=L.bufferedRequestCount,P=new Array(C),D=L.corkedRequestsFree;D.entry=R;for(var y=0,E=!0;R;)P[y]=R,R.isBuf||(E=!1),R=R.next,y+=1;P.allBuffers=E,j($,L,!0,L.length,P,"",D.finish),L.pendingcb++,L.lastBufferedRequest=null,D.next?(L.corkedRequestsFree=D.next,D.next=null):L.corkedRequestsFree=new t(L),L.bufferedRequestCount=0}else{for(;R;){var A=R.chunk,T=R.encoding,b=R.callback;if(j($,L,!1,L.objectMode?1:A.length,A,T,b),R=R.next,L.bufferedRequestCount--,L.writing)break}R===null&&(L.lastBufferedRequest=null)}L.bufferedRequest=R,L.bufferProcessing=!1}function U($){return $.ending&&$.length===0&&$.bufferedRequest===null&&!$.finished&&!$.writing}function K($,L){$._final(function(R){L.pendingcb--,R&&S($,R),L.prefinished=!0,$.emit("prefinish"),G($,L)})}function G($,L){var R=U(L);if(R&&(function(P,D){D.prefinished||D.finalCalled||(typeof P._final!="function"||D.destroyed?(D.prefinished=!0,P.emit("prefinish")):(D.pendingcb++,D.finalCalled=!0,we.nextTick(K,P,D)))}($,L),L.pendingcb===0&&(L.finished=!0,$.emit("finish"),L.autoDestroy))){var C=$._readableState;(!C||C.autoDestroy&&C.endEmitted)&&$.destroy()}return R}return Qr(I,r),O.prototype.getBuffer=function(){for(var $=this.bufferedRequest,L=[];$;)L.push($),$=$.next;return L},function(){try{Object.defineProperty(O.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"?(a=Function.prototype[Symbol.hasInstance],Object.defineProperty(I,Symbol.hasInstance,{value:function($){return!!a.call(this,$)||this===I&&$&&$._writableState instanceof O}})):a=function($){return $ instanceof this},I.prototype.pipe=function(){S(this,new f)},I.prototype.write=function($,L,R){var C,P=this._writableState,D=!1,y=!P.objectMode&&(C=$,i.isBuffer(C)||C instanceof o);return y&&!i.isBuffer($)&&($=function(E){return i.from(E)}($)),typeof L=="function"&&(R=L,L=null),y?L="buffer":L||(L=P.defaultEncoding),typeof R!="function"&&(R=_),P.ending?function(E,A){var T=new w;S(E,T),we.nextTick(A,T)}(this,R):(y||function(E,A,T,b){var v;return T===null?v=new m:typeof T=="string"||A.objectMode||(v=new u("chunk",["string","Buffer"],T)),!v||(S(E,v),we.nextTick(b,v),!1)}(this,P,$,R))&&(P.pendingcb++,D=function(E,A,T,b,v,k){if(!T){var x=function(H,z,J){return H.objectMode||H.decodeStrings===!1||typeof z!="string"||(z=i.from(z,J)),z}(A,b,v);b!==x&&(T=!0,v="buffer",b=x)}var M=A.objectMode?1:b.length;A.length+=M;var N=A.length<A.highWaterMark;if(N||(A.needDrain=!0),A.writing||A.corked){var B=A.lastBufferedRequest;A.lastBufferedRequest={chunk:b,encoding:v,isBuf:T,callback:k,next:null},B?B.next=A.lastBufferedRequest:A.bufferedRequest=A.lastBufferedRequest,A.bufferedRequestCount+=1}else j(E,A,!1,M,b,v,k);return N}(this,P,y,$,L,R)),D},I.prototype.cork=function(){this._writableState.corked++},I.prototype.uncork=function(){var $=this._writableState;$.corked&&($.corked--,$.writing||$.corked||$.bufferProcessing||!$.bufferedRequest||F(this,$))},I.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(I.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(I.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),I.prototype._write=function($,L,R){R(new d("_write()"))},I.prototype._writev=null,I.prototype.end=function($,L,R){var C=this._writableState;return typeof $=="function"?(R=$,$=null,L=null):typeof L=="function"&&(R=L,L=null),$!=null&&this.write($,L),C.corked&&(C.corked=1,this.uncork()),C.ending||function(P,D,y){D.ending=!0,G(P,D),y&&(D.finished?we.nextTick(y):P.once("finish",y)),D.ended=!0,P.writable=!1}(this,C,R),this},Object.defineProperty(I.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(I.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function($){this._writableState&&(this._writableState.destroyed=$)}}),I.prototype.destroy=s.destroy,I.prototype._undestroy=s.undestroy,I.prototype._destroy=function($,L){L($)},ys}function cr(){if(Kl)return vs;Kl=1;var t=Object.keys||function(l){var u=[];for(var d in l)u.push(d);return u};vs=a;var e=vf(),n=yf();Qr(a,e);for(var r=t(n.prototype),i=0;i<r.length;i++){var o=r[i];a.prototype[o]||(a.prototype[o]=n.prototype[o])}function a(l){if(!(this instanceof a))return new a(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||we.nextTick(c,this)}function c(l){l.end()}return Object.defineProperty(a.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(a.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(a.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(a.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)}}),vs}var Jg=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 Fi(t){switch(this.encoding=(t||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!Jg(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=Qg;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=ey;break;default:return void(this.write=Xg)}this.charBuffer=new X(6),this.charReceived=0,this.charLength=0}function Xg(t){return t.toString(this.encoding)}function Qg(t){this.charReceived=t.length%2,this.charLength=this.charReceived?2:0}function ey(t){this.charReceived=t.length%3,this.charLength=this.charReceived?3:0}Fi.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"";
33if(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},Fi.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},Fi.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:Fi})),Hl=Kn.codes.ERR_STREAM_PREMATURE_CLOSE;function ty(){}var ws,Fl,zl,ql,Es,Vl,Ya=function t(e,n,r){if(typeof n=="function")return t(e,null,n);n||(n={}),r=function(g){var m=!1;return function(){if(!m){m=!0;for(var w=arguments.length,p=new Array(w),S=0;S<w;S++)p[S]=arguments[S];g.apply(this,p)}}}(r||ty);var i=n.readable||n.readable!==!1&&e.readable,o=n.writable||n.writable!==!1&&e.writable,a=function(){e.writable||c()},s=e._writableState&&e._writableState.finished,c=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(g){r.call(e,g)},h=function(){var g;return i&&!l?(e._readableState&&e._readableState.ended||(g=new Hl),r.call(e,g)):o&&!s?(e._writableState&&e._writableState.ended||(g=new Hl),r.call(e,g)):void 0},f=function(){e.req.on("finish",c)};return function(g){return g.setHeader&&typeof g.abort=="function"}(e)?(e.on("complete",c),e.on("abort",h),e.req?f():e.on("request",f)):o&&!e._writableState&&(e.on("end",a),e.on("close",a)),e.on("end",u),e.on("finish",c),n.error!==!1&&e.on("error",d),e.on("close",h),function(){e.removeListener("complete",c),e.removeListener("abort",h),e.removeListener("request",f),e.req&&e.req.removeListener("finish",c),e.removeListener("end",a),e.removeListener("close",a),e.removeListener("finish",c),e.removeListener("end",u),e.removeListener("error",d),e.removeListener("close",h)}};function ny(){if(Fl)return ws;var t;function e(m,w,p){return(w=function(S){var _=function(O,I){if(typeof O!="object"||O===null)return O;var j=O[Symbol.toPrimitive];if(j!==void 0){var q=j.call(O,I||"default");if(typeof q!="object")return q;throw new TypeError("@@toPrimitive must return a primitive value.")}return(I==="string"?String:Number)(O)}(S,"string");return typeof _=="symbol"?_:String(_)}(w))in m?Object.defineProperty(m,w,{value:p,enumerable:!0,configurable:!0,writable:!0}):m[w]=p,m}Fl=1;var n=Ya,r=Symbol("lastResolve"),i=Symbol("lastReject"),o=Symbol("error"),a=Symbol("ended"),s=Symbol("lastPromise"),c=Symbol("handlePromise"),l=Symbol("stream");function u(m,w){return{value:m,done:w}}function d(m){var w=m[r];if(w!==null){var p=m[l].read();p!==null&&(m[s]=null,m[r]=null,m[i]=null,w(u(p,!1)))}}function h(m){we.nextTick(d,m)}var f=Object.getPrototypeOf(function(){}),g=Object.setPrototypeOf((e(t={get stream(){return this[l]},next:function(){var m=this,w=this[o];if(w!==null)return Promise.reject(w);if(this[a])return Promise.resolve(u(void 0,!0));if(this[l].destroyed)return new Promise(function(O,I){we.nextTick(function(){m[o]?I(m[o]):O(u(void 0,!0))})});var p,S=this[s];if(S)p=new Promise(function(O,I){return function(j,q){O.then(function(){I[a]?j(u(void 0,!0)):I[c](j,q)},q)}}(S,this));else{var _=this[l].read();if(_!==null)return Promise.resolve(u(_,!1));p=new Promise(this[c])}return this[s]=p,p}},Symbol.asyncIterator,function(){return this}),e(t,"return",function(){var m=this;return new Promise(function(w,p){m[l].destroy(null,function(S){S?p(S):w(u(void 0,!0))})})}),t),f);return ws=function(m){var w,p=Object.create(g,(e(w={},l,{value:m,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,a,{value:m._readableState.endEmitted,writable:!0}),e(w,c,{value:function(S,_){var O=p[l].read();O?(p[s]=null,p[r]=null,p[i]=null,S(u(O,!1))):(p[r]=S,p[i]=_)},writable:!0}),w));return p[s]=null,n(m,function(S){if(S&&S.code!=="ERR_STREAM_PREMATURE_CLOSE"){var _=p[i];return _!==null&&(p[s]=null,p[r]=null,p[i]=null,_(S)),void(p[o]=S)}var O=p[r];O!==null&&(p[s]=null,p[r]=null,p[i]=null,O(u(void 0,!0))),p[a]=!0}),m.on("readable",h.bind(null,p)),p},ws}function vf(){if(Vl)return Es;var t;Vl=1,Es=I,I.ReadableState=O,Ka.EventEmitter;var e=function(b,v){return b.listeners(v).length},n=nf,r=Ha.Buffer,i=(vt!==void 0?vt:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){},o,a=ff;o=a&&a.debuglog?a.debuglog("stream"):function(){};var s,c,l,u=Wg(),d=pf,h=gf.getHighWaterMark,f=Kn.codes,g=f.ERR_INVALID_ARG_TYPE,m=f.E
33RR_STREAM_PUSH_AFTER_EOF,w=f.ERR_METHOD_NOT_IMPLEMENTED,p=f.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;Qr(I,n);var S=d.errorOrDestroy,_=["error","close","destroy","pause","resume"];function O(b,v,k){t=t||cr(),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 I(b){if(t=t||cr(),!(this instanceof I))return new I(b);var v=this instanceof t;this._readableState=new O(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 j(b,v,k,x,M){o("readableAddChunk",v);var N,B=b._readableState;if(v===null)B.reading=!1,function(H,z){if(o("onEofChunk"),!z.ended){if(z.decoder){var J=z.decoder.end();J&&J.length&&(z.buffer.push(J),z.length+=z.objectMode?1:J.length)}z.ended=!0,z.sync?K(H):(z.needReadable=!1,z.emittedReadable||(z.emittedReadable=!0,G(H)))}}(b,B);else if(M||(N=function(H,z){var J;Q=z,r.isBuffer(Q)||Q instanceof i||typeof z=="string"||z===void 0||H.objectMode||(J=new g("chunk",["string","Buffer","Uint8Array"],z));var Q;return J}(B,v)),N)S(b,N);else if(B.objectMode||v&&v.length>0)if(typeof v=="string"||B.objectMode||Object.getPrototypeOf(v)===r.prototype||(v=function(H){return r.from(H)}(v)),x)B.endEmitted?S(b,new p):q(b,B,v,!0);else if(B.ended)S(b,new m);else{if(B.destroyed)return!1;B.reading=!1,B.decoder&&!k?(v=B.decoder.write(v),B.objectMode||v.length!==0?q(b,B,v,!1):$(b,B)):q(b,B,v,!1)}else x||(B.reading=!1,$(b,B));return!B.ended&&(B.length<B.highWaterMark||B.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&&K(b)),$(b,v)}Object.defineProperty(I.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._readableState.destroyed},set:function(b){this._readableState&&(this._readableState.destroyed=b)}}),I.prototype.destroy=d.destroy,I.prototype._undestroy=d.undestroy,I.prototype._destroy=function(b,v){v(b)},I.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),j(this,b,v,!1,k)},I.prototype.unshift=function(b){return j(this,b,null,!0,!1)},I.prototype.isPaused=function(){return this._readableState.flowing===!1},I.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 U(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 K(b){var v=b._readableState;o("emitReadable",v.needReadable,v.emittedReadable),v.needReadable=!1,v.emittedReadable||(o("emitReadable",v.flowing),v.emittedReadable=!0,we.nextTick(G,b))}function G(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,D(b)}function $(b,v){v.readingMore||(v.readingMore=!0,we.nextTick(L,b,v))}function L(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 R(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 C(b){o("readable nexttick read 0"),b.read(0)}function P(b,v){o("resume",v.reading),v.reading||b.read(0),v.resumeScheduled=!1,b.emit("resume"),D(b),v.flowing&&!v.reading&&b.read(0)}function D(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
33);var k}function E(b){var v=b._readableState;o("endReadable",v.endEmitted),v.endEmitted||(v.ended=!0,we.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 I.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):K(this),null;if((b=U(b,v))===0&&v.ended)return v.length===0&&E(this),null;var x,M=v.needReadable;return o("need readable",M),(v.length===0||v.length-b<v.highWaterMark)&&o("length less than watermark",M=!0),v.ended||v.reading?o("reading or ended",M=!1):M&&(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=U(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},I.prototype._read=function(b){S(this,new w("_read()"))},I.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 M=(!v||v.end!==!1)&&b!==we.stdout&&b!==we.stderr?B:le;function N(re,ie){o("onunpipe"),re===k&&ie&&ie.hasUnpiped===!1&&(ie.hasUnpiped=!0,o("cleanup"),b.removeListener("close",ne),b.removeListener("finish",se),b.removeListener("drain",H),b.removeListener("error",Q),b.removeListener("unpipe",N),k.removeListener("end",B),k.removeListener("end",le),k.removeListener("data",J),z=!0,!x.awaitDrain||b._writableState&&!b._writableState.needDrain||H())}function B(){o("onend"),b.end()}x.endEmitted?we.nextTick(M):k.once("end",M),b.on("unpipe",N);var H=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,D(re))}}(k);b.on("drain",H);var z=!1;function J(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)&&!z&&(o("false write response, pause",x.awaitDrain),x.awaitDrain++),k.pause())}function Q(re){o("onerror",re),le(),b.removeListener("error",Q),e(b,"error")===0&&S(b,re)}function ne(){b.removeListener("finish",se),le()}function se(){o("onfinish"),b.removeListener("close",ne),le()}function le(){o("unpipe"),k.unpipe(b)}return k.on("data",J),function(re,ie,ce){if(typeof re.prependListener=="function")return re.prependListener(ie,ce);re._events&&re._events[ie]?Array.isArray(re._events[ie])?re._events[ie].unshift(ce):re._events[ie]=[ce,re._events[ie]]:re.on(ie,ce)}(b,"error",Q),b.once("close",ne),b.once("finish",se),b.emit("pipe",k),x.flowing||(o("pipe resume"),k.resume()),b},I.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,M=v.pipesCount;v.pipes=null,v.pipesCount=0,v.flowing=!1;for(var N=0;N<M;N++)x[N].emit("unpipe",this,{hasUnpiped:!1});return this}var B=T(v.pipes,b);return B===-1||(v.pipes.splice(B,1),v.pipesCount-=1,v.pipesCount===1&&(v.pipes=v.pipes[0]),b.emit("unpipe",this,k)),this},I.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?K(this):x.reading||we.nextTick(C,this))),k},I.prototype.addListener=I.prototype.on,I.prototype.removeListener=function(b,v){var k=n.prototype.removeListener.call(this,b,v);return b==="readable"&&we.nextTick(R,this),k},I.prototype.removeAllListeners=function(b){var v=n.prototype.removeAllListeners.apply(this,arguments);return b!=="readable"&&b!==void 0||we.nextTick(R,this),v},I.prototype.resume=function(){var b=this._readableState;return b.flowing||(o("resume"),b.flowing=!b.readableListening,function(v,k){k.resumeScheduled||(k.resumeScheduled=!0,we.nextTick(P,v,k))}(this,b)),b.paused=!1,this},I.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(o("pause"),this._readableState.flowing=!1,this.emit
33("pause")),this._readableState.paused=!0,this},I.prototype.wrap=function(b){var v=this,k=this._readableState,x=!1;for(var M in b.on("end",function(){if(o("wrapped end"),k.decoder&&!k.ended){var B=k.decoder.end();B&&B.length&&v.push(B)}v.push(null)}),b.on("data",function(B){o("wrapped data"),k.decoder&&(B=k.decoder.write(B)),k.objectMode&&B==null||(k.objectMode||B&&B.length)&&(v.push(B)||(x=!0,b.pause()))}),b)this[M]===void 0&&typeof b[M]=="function"&&(this[M]=function(B){return function(){return b[B].apply(b,arguments)}}(M));for(var N=0;N<_.length;N++)b.on(_[N],this.emit.bind(this,_[N]));return this._read=function(B){o("wrapped _read",B),x&&(x=!1,b.resume())},this},typeof Symbol=="function"&&(I.prototype[Symbol.asyncIterator]=function(){return c===void 0&&(c=ny()),c(this)}),Object.defineProperty(I.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(I.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(I.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(b){this._readableState&&(this._readableState.flowing=b)}}),I._fromList=y,Object.defineProperty(I.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),typeof Symbol=="function"&&(I.from=function(b,v){return l===void 0&&(l=ql?zl:(ql=1,zl=function(){throw new Error("Readable.from is not available in the browser")})),l(I,b,v)}),Es}var bf=Wt,Po=Kn.codes,ry=Po.ERR_METHOD_NOT_IMPLEMENTED,iy=Po.ERR_MULTIPLE_CALLBACK,oy=Po.ERR_TRANSFORM_ALREADY_TRANSFORMING,sy=Po.ERR_TRANSFORM_WITH_LENGTH_0,zi=cr();function ay(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(r===null)return this.emit("error",new iy);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 Wt(t){if(!(this instanceof Wt))return new Wt(t);zi.call(this,t),this._transformState={afterTransform:ay.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",cy)}function cy(){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 sy;if(t._transformState.transforming)throw new oy;return t.push(null)}Qr(Wt,zi),Wt.prototype.push=function(t,e){return this._transformState.needTransform=!1,zi.prototype.push.call(this,t,e)},Wt.prototype._transform=function(t,e,n){n(new ry("_transform()"))},Wt.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)}},Wt.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))},Wt.prototype._destroy=function(t,e){zi.prototype._destroy.call(this,t,function(n){e(n)})};var _s,ly=Hr,wf=bf;function Hr(t){if(!(this instanceof Hr))return new Hr(t);wf.call(this,t)}Qr(Hr,wf),Hr.prototype._transform=function(t,e,n){n(null,t)};var Ef=Kn.codes,uy=Ef.ERR_MISSING_ARGS,dy=Ef.ERR_STREAM_DESTROYED;function Gl(t){if(t)throw t}function Yl(t){t()}function hy(t,e){return t.pipe(e)}var fy=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r,i=function(a){return a.length?typeof a[a.length-1]!="function"?Gl:a.pop():Gl}(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new uy("streams");var o=e.map(function(a,s){var c=s<e.length-1;return function(l,u,d,h){h=function(m){var w=!1;return function(){w||(w=!0,m.apply(void 0,arguments))}}(h);var f=!1;l.on("close",function(){f=!0}),_s===void 0&&(_s=Ya),_s(l,{readable:u,writable:d},function(m){if(m)return h(m);f=!0,h()});var g=!1;return function(m){if(!f&&!g)return g=!0,function(w){return w.setHeader&&typeof w.abort=="function"}(l)?l.abort():typeof l.destroy=="function"?l.destroy():void h(m||new dy("pipe"))}}(a,c,s>
330,function(l){r||(r=l),l&&o.forEach(Yl),c||(o.forEach(Yl),i(r))})});return e.reduce(hy)};(function(t,e){(e=oa.exports=vf()).Stream=e,e.Readable=e,e.Writable=yf(),e.Duplex=cr(),e.Transform=bf,e.PassThrough=ly,e.finished=Ya,e.pipeline=fy})(0,oa.exports);var lr=oa.exports;function py(t={}){const e={},n=new lr.Duplex({objectMode:!0,read:()=>{},write:function(o,a,s){let c=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){c=l}s(c)}}),r=new Yh;return{events:r,middleware:(o,a,s,c)=>{e[o.id]={req:o,res:a,next:s,end:c},i(o)},stream:n};function i(o){n.push(o)}}var mo={},aa={exports:{}},my=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 a=e.apply(this,i),s=i[i.length-1];return typeof a=="function"&&a!==s&&Object.keys(s).forEach(function(c){a[c]=s[c]}),a}},Zl=my;function Ei(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}aa.exports=Zl(Ei),aa.exports.strict=Zl(Jl),Ei.proto=Ei(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return Ei(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return Jl(this)},configurable:!0})});var gy=aa.exports,go={};Object.defineProperty(go,"__esModule",{value:!0}),go.Substream=void 0;const yy=lr;class vy extends yy.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=vy;var by=vt&&vt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(mo,"__esModule",{value:!0}),mo.ObjectMultiplex=void 0;const Ss=lr,wy=by(gy),Ey=go,Xl=Symbol("IGNORE_SUBSTREAM");let _y=class extends Ss.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 Ey.Substream({parent:this,name:t});return this._substreams[t]=e,function(n,r){const i=(0,wy.default)(r);(0,Ss.finished)(n,{readable:!1},i),(0,Ss.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=_y;var Sy=xo(mo.ObjectMultiplex);const xt=t=>t!==null&&typeof t=="object"&&typeof t.pipe=="function";xt.writable=t=>xt(t)&&t.writable!==!1&&typeof t._write=="function"&&typeof t._writableState=="object",xt.readable=t=>xt(t)&&t.readable!==!1&&typeof t._read=="function"&&typeof t._readableState=="object",xt.duplex=t=>xt.writable(t)&&xt.readable(t),xt.transform=t=>xt.duplex(t)&&typeof t._transform=="function";var Tt,Cy=xt,ky=class extends Kg{constructor(t,{jsonRpcStreamName:e,logger:n=console,maxEventListeners:r=100,rpcMiddleware:i=[]}){if(super({logger:n,maxEventListeners:r,rpcMiddleware:i}),!Cy.duplex(t))throw new Error(Te.errors.invalidDuplexStream());this._handleStreamDisconnect=this._handleStreamDisconnect.bind(this);const o=new Sy;lr.pipeline(t,o,t,this._handleStreamDisconnect.bind(this,"MetaMask")),this._jsonRpcConnection=py({retryOn
33Message:"METAMASK_EXTENSION_CONNECT_CAN_RETRY"}),lr.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",a=>{const{method:s,params:c}=a;s==="metamask_accountsChanged"?this._handleAccountsChanged(c):s==="metamask_unlockStateChanged"?this._handleUnlockStateChanged(c):s==="metamask_chainChanged"?this._handleChainChanged(c):Zh.includes(s)?this.emit("message",{type:s,data:c}):s==="METAMASK_STREAM_FAILURE"&&t.destroy(new Error(Te.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}={}){Jh(t)&&(n=>!!n&&typeof n=="string")(e)?e==="loading"?this._handleDisconnect(!0):super._handleChainChanged({chainId:t}):this._log.error(Te.errors.invalidNetworkParams(),{chainId:t,networkVersion:e})}},Ay=class extends ky{constructor(t,{jsonRpcStreamName:e="metamask-provider",logger:n=console,maxEventListeners:r=100,shouldSendMetadata:i}={}){if(super(t,{jsonRpcStreamName:e,logger:n,maxEventListeners:r,rpcMiddleware:Pg(n)}),this._sentWarnings={chainId:!1,networkVersion:!1,selectedAddress:!1,enable:!1,experimentalMethods:!1,send:!1,events:{close:!1,data:!1,networkChanged:!1,notification:!1}},ia(this,Tt,void 0),this._initializeStateAsync(),Vt(this,Tt,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:a}=o;Zh.includes(a)&&(this.emit("data",o),this.emit("notification",o.params.result))}),i)if(document.readyState==="complete")Nl(this._rpcEngine,this._log);else{const o=()=>{Nl(this._rpcEngine,this._log),window.removeEventListener("DOMContentLoaded",o)};window.addEventListener("DOMContentLoaded",o)}}get chainId(){return this._sentWarnings.chainId||(this._log.warn(Te.warnings.chainIdDeprecation),this._sentWarnings.chainId=!0),super.chainId}get networkVersion(){return this._sentWarnings.networkVersion||(this._log.warn(Te.warnings.networkVersionDeprecation),this._sentWarnings.networkVersion=!0),Pt(this,Tt)}get selectedAddress(){return this._sentWarnings.selectedAddress||(this._log.warn(Te.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),Pt(this,Tt)&&!t&&Vt(this,Tt,null)}_warnOfDeprecation(t){var e;((e=this._sentWarnings)==null?void 0:e.events[t])===!1&&(this._log.warn(Te.warnings.events[t]),this._sentWarnings.events[t]=!0)}async enable(){return this._sentWarnings.enable||(this._log.warn(Te.warnings.enableDeprecation),this._sentWarnings.enable=!0),new Promise((t,e)=>{try{this._rpcRequest({method:"eth_requestAccounts",params:[]},Ui(t,e))}catch(n){e(n)}})}send(t,e){return this._sentWarnings.send||(this._log.warn(Te.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},Ui(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,Xh),e=!0;break;case"net_version":e=Pt(this,Tt)??null;break;default:throw new Error(Te.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 xr({message:"Batch requests must be made with an array of request objects.",data:t});
34return new Promise((e,n)=>{this._rpcRequest(t,Ui(e,n))})}},{get:(t,e,...n)=>(this._sentWarnings.experimentalMethods||(this._log.warn(Te.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!==Pt(this,Tt)&&(Vt(this,Tt,e),this._state.initialized&&this.emit("networkChanged",Pt(this,Tt)))}};Tt=new WeakMap;const W=Ye("MM_SDK");let Ql;W.color="#FFAC1C";var _f={},_n={};Object.defineProperty(_n,"__esModule",{value:!0}),_n.EthereumProviderError=_n.EthereumRpcError=void 0;const xy=Fh;class Sf 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 xy.default(this.serialize(),Ty,2)}}_n.EthereumRpcError=Sf;function Ty(t,e){if(e!=="[Circular]")return e}_n.EthereumProviderError=class extends Sf{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={},mn={};Object.defineProperty(mn,"__esModule",{value:!0}),mn.errorValues=mn.errorCodes=void 0,mn.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}},mn.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=mn,n=_n,r=e.errorCodes.rpc.internal,i="Unspecified error message. This is a bug, please report it.",o={code:r,message:a(r)};function a(d,h=i){if(Number.isInteger(d)){const f=d.toString();if(u(e.errorValues,f))return e.errorValues[f].message;if(c(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]||!!c(d)}function c(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=a,t.isValidCode=s,t.serializeError=function(d,{fallbackError:h=o,shouldIncludeStack:f=!1}={}){var g,m;if(!h||!Number.isInteger(h.code)||typeof h.message!="string")throw new Error("Mu
34st 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 S=d;w.code=S.code,S.message&&typeof S.message=="string"?(w.message=S.message,u(S,"data")&&(w.data=S.data)):(w.message=a(w.code),w.data={originalError:l(d)})}else{w.code=h.code;const S=(g=d)===null||g===void 0?void 0:g.message;w.message=S&&typeof S=="string"?S:h.message,w.data={originalError:l(d)}}const p=(m=d)===null||m===void 0?void 0:m.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 Ja=_n,Cf=Za,Ke=mn;function dt(t,e){const[n,r]=kf(e);return new Ja.EthereumRpcError(t,n||Cf.getMessageFromCode(t),r)}function br(t,e){const[n,r]=kf(e);return new Ja.EthereumProviderError(t,n||Cf.getMessageFromCode(t),r)}function kf(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:n}=t;
34if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,n]}}return[]}yo.ethErrors={rpc:{parse:t=>dt(Ke.errorCodes.rpc.parse,t),invalidRequest:t=>dt(Ke.errorCodes.rpc.invalidRequest,t),invalidParams:t=>dt(Ke.errorCodes.rpc.invalidParams,t),methodNotFound:t=>dt(Ke.errorCodes.rpc.methodNotFound,t),internal:t=>dt(Ke.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 dt(e,t)},invalidInput:t=>dt(Ke.errorCodes.rpc.invalidInput,t),resourceNotFound:t=>dt(Ke.errorCodes.rpc.resourceNotFound,t),resourceUnavailable:t=>dt(Ke.errorCodes.rpc.resourceUnavailable,t),transactionRejected:t=>dt(Ke.errorCodes.rpc.transactionRejected,t),methodNotSupported:t=>dt(Ke.errorCodes.rpc.methodNotSupported,t),limitExceeded:t=>dt(Ke.errorCodes.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>br(Ke.errorCodes.provider.userRejectedRequest,t),unauthorized:t=>br(Ke.errorCodes.provider.unauthorized,t),unsupportedMethod:t=>br(Ke.errorCodes.provider.unsupportedMethod,t),disconnected:t=>br(Ke.errorCodes.provider.disconnected,t),chainDisconnected:t=>br(Ke.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 Ja.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=_n;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=mn;Object.defineProperty(t,"errorCodes",{enumerable:!0,get:function(){return i.errorCodes}})}(_f);var Af={exports:{}};Af.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 a in r)n.d(o,a,(function(s){return r[s]}).bind(null,a));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(a,s){var c=s.match(a);return c&&c.length>0&&c[1]||""},o.getSecondMatch=function(a,s){var c=s.match(a);return c&&c.length>1&&c[2]||""},o.matchAndReturnConst=function(a,s,c){if(a.test(s))return c},o.getWindowsVersionName=function(a){switch(a){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(a){var s=a.split(".").splice(0,2).map(function(c){return parseInt(c,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";
34case 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(a){var s=a.split(".").splice(0,2).map(function(c){return parseInt(c,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(a){return a.split(".").length},o.compareVersions=function(a,s,c){c===void 0&&(c=!1);var l=o.getVersionPrecision(a),u=o.getVersionPrecision(s),d=Math.max(l,u),h=0,f=o.map([a,s],function(g){var m=d-o.getVersionPrecision(g),w=g+new Array(m+1).join(".0");return o.map(w.split("."),function(p){return new Array(20-p.length).join("0")+p}).reverse()});for(c&&(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(a,s){var c,l=[];if(Array.prototype.map)return Array.prototype.map.call(a,s);for(c=0;c<a.length;c+=1)l.push(s(a[c]));return l},o.find=function(a,s){var c,l;if(Array.prototype.find)return Array.prototype.find.call(a,s);for(c=0,l=a.length;c<l;c+=1){var u=a[c];if(s(u,c))return u}},o.assign=function(a){for(var s,c,l=a,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,[a].concat(d));var f=function(){var g=d[s];typeof g=="object"&&g!==null&&Object.keys(g).forEach(function(m){l[m]=g[m]})};for(s=0,c=d.length;s<c;s+=1)f();return a},o.getBrowserAlias=function(a){return r.BROWSER_ALIASES_MAP[a]},o.getBrowserTypeByAlias=function(a){return r.BROWSER_MAP[a]||""},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"}}
34,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 a(c,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(c,d.key,d)}}var s=function(){function c(){}var l,u,d;return c.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)},c.parse=function(h){return new i.default(h).getResult()},l=c,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)&&a(l.prototype,u),d&&a(l,d),c}();e.default=s,t.exports=e.default},91:function(t,e,n){e.__esModule=!0,e.default=void 0;var r=c(n(92)),i=c(n(93)),o=c(n(94)),a=c(n(95)),s=c(n(17));function c(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(g){if(typeof g.test=="function")return g.test(h);if(g.test instanceof Array)return g.test.some(function(m){return h.test(m)});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(g){if(typeof g.test=="function")return g.test(h);if(g.test instanceof Array)return g.test.some(function(m){return h.test(m)});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(g){if(typeof g.test=="function")return g.test(h);if(g.test instanceof Array)return g.test.some(function(m){return h.test(m)});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(a.default,function(g){if(typeof g.test=="function")return g.test(h);if(g.test instanceof Array)return g.test.some(function(m){return h.test(m)});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,g={},m=0,w={},p=0;if(Object.keys(h).forEach(function(U){var K=h[U];typeof K=="string"?(w[U]=K,p+=1):typeof K=="object"&&(g[U]=K,m+=1)}),m>0){var S=Object.keys(g),_=s.default.find(S,function(U){return f.isOS(U)});if(_){var O=this.satisfies(g[_]);if(O!==void 0)return O}var I=s.default.find(S,function(U){return f.isPlatform(U)});if(I){var j=this.satisfies(g[I]);if(j!==void 0)return j}}if(p>0){var q=Object.keys(w),F=s.default.find(q,function(U){return f.isBrowser(U,!0)});if(F!==void 0)return this.compareVersion(w[F])}},d.isBrowser=function(h,f){f===void 0&&(f=!1);var g=this.getBrowserName().toLowerCase(),m=h.toLowerCase(),w=s.default.getBrowserTypeByAlias(m);return f&&w&&(m=w.toLowerCase()),m===g},d.compareVersion=function(h){var f=[0],g=h,m=!1,w=this.getBrowserVersion();if(typeof w=="string")return h[0]===">"||h[0]==="<"?(g=h.substr(1),h[1]==="="?(m=!0,g=h.substr(2)):f=[],h[0]===">"?f.push(1):f.push(-1)):h[0]==="="?g=h.substr(1):h[0]==="~"&&(m=!0,g=h.substr(1)),f.indexOf(s.default.compareVersions(w,g,m))>-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(g){return f.is(g)})},u}();e.default=l,t.exports=e.default}
vendor: 13,045 bytes, line 34
34,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,a=[{test:[/googlebot/i],describe:function(s){var c={name:"Googlebot"},l=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,s)||i.default.getFirstMatch(o,s);return l&&(c.version=l),c}},{test:[/opera/i],describe:function(s){var c={name:"Opera"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(c.version=l),c}},{test:[/opr\/|opios/i],describe:function(s){var c={name:"Opera"},l=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,s)||i.default.getFirstMatch(o,s);return l&&(c.version=l),c}},{test:[/SamsungBrowser/i],describe:function(s){var c={name:"Samsung Internet for Android"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(c.version=l),c}},{test:[/Whale/i],describe:function(s){var c={name:"NAVER Whale Browser"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,s);return l&&(c.version=l),c}},{test:[/MZBrowser/i],describe:function(s){var c={name:"MZ Browser"},l=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(c.version=l),c}},{test:[/focus/i],describe:function(s){var c={name:"Focus"},l=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(c.version=l),c}},{test:[/swing/i],describe:function(s){var c={name:"Swing"},l=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(c.version=l),c}},{test:[/coast/i],describe:function(s){var c={name:"Opera Coast"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(c.version=l),c}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(s){var c={name:"Opera Touch"},l=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(c.version=l),c}},{test:[/yabrowser/i],describe:function(s){var c={name:"Yandex Browser"},l=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(c.version=l),c}},{test:[/ucbrowser/i],describe:function(s){var c={name:"UC Browser"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(c.version=l),c}},{test:[/Maxthon|mxios/i],describe:function(s){var c={name:"Maxthon"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(c.version=l),c}},{test:[/epiphany/i],describe:function(s){var c={name:"Epiphany"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(c.version=l),c}},{test:[/puffin/i],describe:function(s){var c={name:"Puffin"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(c.version=l),c}},{test:[/sleipnir/i],describe:function(s){var c={name:"Sleipnir"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(c.version=l),c}},{test:[/k-meleon/i],describe:function(s){var c={name:"K-Meleon"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(c.version=l),c}},{test:[/micromessenger/i],describe:function(s){var c={name:"WeChat"},l=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(c.version=l),c}},{test:[/qqbrowser/i],describe:function(s){var c={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&&(c.version=l),c}},{test:[/msie|trident/i],describe:function(s){var c={name:"Internet Explorer"},l=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,s);return l&&(c.version=l),c}},{test:[/\sedg\//i],describe:function(s){var c={name:"Microsoft Edge"},l=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,s);return l&&(c.version=l),c}},{test:[/edg([ea]|ios)/i],describe:function(s){var c={name:"Microsoft Edge"},l=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,s);return l&&(c.version=l),c}},{test:[/vivaldi/i],describe:function(s){var c={name:"Vivaldi"},l=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,s);return l&&(c.version=l),c}},{test:[/seamonkey/i],describe:function(s){var c={name:"SeaMonkey"},l=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,s);return l&&(c.version=l),c}},{test:[/sailfish/i],describe:function(s){var c={name:"Sailfish"},l=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,s);return l&&(c.version=l),c}},{test:[/silk/i],describe:function(s){var c={name:"Amazon Silk"},l=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,s);return l&&(c.version=l),c}},{test:[/phantom/i],describe:function(s){var c={name:"PhantomJS"},l=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,s);return l&&(c.version=l),c}},{test:[/slimerjs/i],describe:function(s){var c={name:"SlimerJS"},l=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,s);return l&&(c.version=l),c}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(s){var c={name:"BlackBerry"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,s);return l&&(c.version=l),c}},{test:[/(web|hpw)[o0]s/i],describe:function(s){var c={name:"WebOS Browser"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,s);return l&&(c.version=l),c}},{test:[/bada/i],describe:function(s){var c={name:"Bada"},l=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,s);return l&&(c.version=l),c}},{test:[/tizen/i],describe:function(s){var c={name:"Tizen"},l=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(c.version=l),c}},{test:[/qupzilla/i],describe:function(s){var c={name:"QupZilla"},l=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(c.version=l),c}},{test:[/firefox|iceweasel|fxios/i],describe:function(s){var c={name:"Firefox"},l=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(c.version=l),c}},{test:[/electron/i],describe:function(s){var c={name:"Electron"},l=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,s);return l&&(c.version=l),c}},{test:[/MiuiBrowser/i],describe:function(s){var c={name:"Miui"},l=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(c.version=l),c}},{test:[/chromium/i],describe:function(s){var c={name:"Chromium"},l=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(c.version=l),c}},{test:[/chrome|crios|crmo/i],describe:function(s){var c={name:"Chrome"},l=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,s);return l&&(c.version=l),c}},{test:[/GSA/i],describe:function(s){var c={name:"Google Search"},l=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,s);return l&&(c.version=l),c}},{test:function(s){var c=!s.test(/like android/i),l=s.test(/android/i);return c&&l},describe:function(s){var c={name:"Android Browser"},l=i.default.getFirstMatch(o,s);return l&&(c.version=l),c}},{test:[/playstation 4/i],describe:function(s){var c={name:"PlayStation 4"},l=i.default.getFirstMatch(o,s);return l&&(c.version=l),c}},{test:[/safari|applewebkit/i],describe:function(s){var c={name:"Safari"},l=i.default.getFirstMatch(o,s);return l&&(c.version=l),c}},{test:[/.*/i],describe:function(s){var c=s.search("\\(")!==-1?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(c,s),version:i.default.getSecondMatch(c,s)}}}];e.default=a,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),a=[{test:[/Roku\/DVP/],describe:function(s){var c=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,s);return{name:o.OS_MAP.Roku,version:c}}},{test:[/windows phone/i],describe:function(s){var c=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,s);return{name:o.OS_MAP.WindowsPhone,version:c}}},{test:[/windows /i],describe:function(s){var c=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,s),l=i.default.getWindowsVersionName(c);return{name:o.OS_MAP.Windows,version:c,versionName:l}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(s){var c={name:o.OS_MAP.iOS},l=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,s);return l&&(c.version=l),c}},{test:[/macintosh/i],describe:function(s){var c=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,s).replace(/[_\s]/g,"."),l=i.default.getMacOSVersionName(c),u={name:o.OS_MAP.MacOS,version:c};return l&&(u.versionName=l),u}},{test:[/(ipod|iphone|ipad)/i],describe:function(s){var c=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,s).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:c}}},{test:function(s){var c=!s.test(/like android/i),l=s.test(/android/i);return c&&l},describe:function(s){var c=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,s),l=i.default.getAndroidVersionName(c),u={name:o.OS_MAP.Android,version:c};return l&&(u.versionName=l),u}},{test:[/(web|hpw)[o0]s/i],describe:function(s){var c=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,s),l={name:o.OS_MAP.WebOS};return c&&c.length&&(l.version=c),l}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(s){var c=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:c}}},{test:[/bada/i],describe:function(s){var c=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,s);return{name:o.OS_MAP.Bada,version:c}}},{test:[/tizen/i],describe:function(s){var c=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,s);return{name:o.OS_MAP.Tizen,version:c}}},{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 c=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,s);return{name:o.OS_MAP.PlayStation4,version:c}}}];e.default=a,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),a=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(s){var c=i.default.getFirstMatch(/(can-l01)/i,s)&&"Nova",l={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return c&&(l.model=c),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 c=s.test(/ipod|iphone/i),l=s.test(/like (ipod|iphone)/i);return c&&!l},describe:function(s){var c=i.default.getFirstMatch(/(ipod|iphone)/i,s);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:c}}},{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 c=Number(String(s.getOSVersion()).split(".")[0]);return s.getOSName(!0)==="android"&&c>=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=a,t.exports=e.default}
34,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),a=[{test:function(s){return s.getBrowserName(!0)==="microsoft edge"},describe:function(s){if(/\sedg\//i.test(s))return{name:o.ENGINE_MAP.Blink};var c=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,s);return{name:o.ENGINE_MAP.EdgeHTML,version:c}}},{test:[/trident/i],describe:function(s){var c={name:o.ENGINE_MAP.Trident},l=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,s);return l&&(c.version=l),c}},{test:function(s){return s.test(/presto/i)},describe:function(s){var c={name:o.ENGINE_MAP.Presto},l=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,s);return l&&(c.version=l),c}},{test:function(s){var c=s.test(/gecko/i),l=s.test(/like gecko/i);return c&&!l},describe:function(s){var c={name:o.ENGINE_MAP.Gecko},l=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,s);return l&&(c.version=l),c}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(s){var c={name:o.ENGINE_MAP.WebKit},l=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,s);return l&&(c.version=l),c}}];e.default=a,t.exports=e.default}});var xf=xo(Af.exports);const et={Initialized:"initialized",DisplayURI:"display_uri",ProviderUpdate:"provider_update",ConnectWithResponse:"connectWithResponse",ConnectionStatus:"connection_status",ServiceStatus:"service_status"};class Ct{constructor({shouldSetOnWindow:e,connectionStream:n,shouldSendMetadata:r=!1,shouldShimWeb3:i,sdkInstance:o}){const a=new My({connectionStream:n,shouldSendMetadata:r,shouldSetOnWindow:e,shouldShimWeb3:i,autoRequestAccounts:!1}),s=new Proxy(a,{deleteProperty:()=>!0});if(this.provider=s,this.sdkInstance=o,e&&typeof window<"u")try{c=a,window.ethereum=c,window.dispatchEvent(new Event("ethereum#initialized"))}catch(l){W("[Ethereum] Unable to set global provider - window.ethereum may be read-only",l)}var c;if(i&&typeof window<"u")try{(function(l,u=console){let d=!1,h=!1;if(!window.web3){const f="__isMetaMaskShim__";let g={currentProvider:l};Object.defineProperty(g,f,{value:!0,enumerable:!0,configurable:!1,writable:!1}),g=new Proxy(g,{get:(m,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(S=>{u.debug("MetaMask: Failed to log web3 shim usage.",S)})):(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(m,w,...p)),set:(...m)=>(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(...m))}),Object.defineProperty(window,"web3",{value:g,enumerable:!1,configurable:!0,writable:!0})}})(this.provider)}catch(l){W("[Ethereum] Unable to shim web3 - window.web3 may be read-only",l)}this.provider.on("display_uri",l=>{this.sdkInstance.emit(et.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(et.Initialized,l),W("[Ethereum: constructor()] provider initialized",l)})}static init(e){var n;return W("[Ethereum: init()] Initializing Ethereum service"),this.instance=new Ct(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 Fr{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,a,s){const{state:c}=i;W(`[PlatfformManager: openDeeplink()] universalLink --> ${o}`),W(`[PlatfformManager: openDeeplink()] deepLink --> ${a}`);try{if(c.preferredOpenLink)return void c.preferredOpenLink(c.useDeeplink?a:o,s);if(W(`[PlatfformManager: openDeeplink()] open link now useDeepLink=${c.useDeeplink} link=${c.useDeeplink?a:o}`),c.useDeeplink)typeof window<"u"&&(window.location.href=a);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=Ct.getProvider()||
34(window==null?void 0:window.ethereum);return W(`[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=xf.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===ze.MobileWeb}static isNotBrowser(){var e;return typeof window>"u"||!(window!=null&&window.navigator)||Ze!==void 0&&((e=Ze==null?void 0:Ze.navigator)===null||e===void 0?void 0:e.product)==="ReactNative"||(navigator==null?void 0:navigator.product)==="ReactNative"}isNotBrowser(){return Fr.isNotBrowser()}static isBrowser(){return!this.isNotBrowser()}isBrowser(){return Fr.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()?ze.ReactNative:e.isNotBrowser()?ze.NonBrowser:e.isMetaMaskMobileWebView()?ze.MetaMaskMobileWebview:e.isMobile()?ze.MobileWeb:ze.DesktopWeb}(this)}}const Tf=t=>Z(void 0,void 0,void 0,function*(){if(Fr.isBrowser()){const{StorageManagerWeb:n}=yield Promise.resolve().then(function(){return rv});return new n(t)}const e={persistChannelConfig:()=>Z(void 0,void 0,void 0,function*(){}),getPersistedChannelConfig:()=>Z(void 0,void 0,void 0,function*(){}),persistAccounts:()=>Z(void 0,void 0,void 0,function*(){}),getCachedAccounts:()=>Z(void 0,void 0,void 0,function*(){return[]}),persistChainId:()=>Z(void 0,void 0,void 0,function*(){}),getCachedChainId:()=>Z(void 0,void 0,void 0,function*(){}),terminate:()=>Z(void 0,void 0,void 0,function*(){})};return Promise.resolve(e)});
34class My extends Ay{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:""},W(`[SDKProvider: constructor()] autoRequestAccounts=${r}`),this.state.autoRequestAccounts=r}forceInitializeState(){return Z(this,void 0,void 0,function*(){return W(`[SDKProvider: forceInitializeState()] autoRequestAccounts=${this.state.autoRequestAccounts}`),this._initializeStateAsync()})}_setConnected(){W("[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())||"":(W("[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;W(`[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",_f.ethErrors.provider.disconnected()),i.providerStateRequested=!1})({terminate:e,instance:this})}_initializeStateAsync(){return Z(this,void 0,void 0,function*(){return function(e){var n,r;return Z(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)W("[SDKProvider: initializeStateAsync()] initialization already in progress");else{let a;i.providerStateRequested=!0;let s=null,c=!1,l=!1;const u=yield Tf({enabled:!0});if(u){const d=yield u.getPersistedChannelConfig({});c=(n=d==null?void 0:d.relayPersistence)!==null&&n!==void 0&&n,a=yield u.getCachedChainId();const h=yield u.getCachedAccounts();h.length>0&&(s=h[0])}if(W(`[SDKProvider: initializeStateAsync()] relayPersistence=${c}`,{relayPersistence:c,cachedChainId:a,cachedSelectedAddress:s}),c)if(a&&s)o={accounts:[s],chainId:a,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{W("[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 W("[SDKProvider: _initializeState()]",e),function(n,r,i){return W("[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:a}){W(`[SDKProvider: handleChainChanged()] chainId=${i} networkVersion=${o}`);let s=o;o||(W("[SDKProvider: handleChainChanged()] forced network version to prevent provider error"),s="1"),i!==Ql&&(Me.analytics.track("sdk_used_chain",{caip_chain_id:`eip155:${parseInt(i??"0x1",16)}`}),Ql=i),r._state.isConnected=!0,r.emit("connect",{chainId:i}),a({chainId:i,networkVersion:s})}({instance:this,chainId:e,networkVersion:n,superHandleChainChanged:super._handleChainChanged.bind(this)})}}var zr,Un={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-
34prettier":"^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",qr="https://metamask.app.link/connect",Vr="metamask://connect",tu={NAME:"MetaMask",RDNS:["io.metamask","io.metamask.flask"]},Ry=/(?:^[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,ue={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"},Wr={[ue.ETH_REQUESTACCOUNTS]:!0,[ue.ETH_SENDTRANSACTION]:!0,[ue.ETH_SIGNTRANSACTION]:!0,[ue.ETH_SIGN]:!0,[ue.PERSONAL_SIGN]:!0,[ue.ETH_ACCOUNTS]:!1,[ue.ETH_CHAINID]:!1,[ue.PERSONAL_SIGN]:!0,[ue.ETH_SIGNTYPEDDATA]:!0,[ue.ETH_SIGNTYPEDDATA_V3]:!0,[ue.ETH_SIGNTYPEDDATA_V4]:!0,[ue.WALLET_REQUESTPERMISSIONS]:!0,[ue.WALLET_GETPERMISSIONS]:!0,[ue.WALLET_WATCHASSET]:!0,[ue.WALLET_ADDETHEREUMCHAIN]:!0,[ue.WALLET_SWITCHETHETHEREUMCHAIN]:!0,[ue.METAMASK_CONNECTSIGN]:!0,[ue.METAMASK_CONNECTWITH]:!0,[ue.PERSONAL_EC_RECOVER]:!0,[ue.METAMASK_BATCH]:!0,[ue.METAMASK_OPEN]:!0},Oy=Object.keys(Wr).filter(t=>Wr[t]===!0).map(t=>t.toLowerCase()),Mf=["eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sign"].map(t=>t.toLowerCase()),Cs=".sdk-comm",vo="providerType",ca=".MMSDK_cached_address",la=".MMSDK_cached_chainId",At={CHAIN_CHANGED:"chainChanged",ACCOUNTS_CHANGED:"accountsChanged",DISCONNECT:"disconnect",CONNECT:"connect",CONNECTED:"connected"},Py=1e6;var $t;(function(t){t.TERMINATE="terminate",t.EXTENSION="extension",t.INITIALIZED="initialized"})($t||($t={}));const Iy=typeof window<"u"&&window.localStorage;function Ny({instance:t,msg:e}){return Z(this,void 0,void 0,function*(){if(t._initialized||(W("[MetaMaskSDK: connectAndSign()] provider not ready -- wait for init()"),yield t.init()),W(`[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(a=>a.toString(16).padStart(2,"0")).join("")}else{if(typeof Ze!="object"||!("Buffer"in Ze))throw new Error("Unable to convert string to hex: No available method.");i=Ze.Buffer.from(r,"utf8").toString("hex")}return`0x${i}`}(e);return t.activeProvider.request({method:ue.METAMASK_CONNECTWITH,params:[{method:ue.PERSONAL_SIGN,params:[n]}]})})}function nu(t){var e,n;return Z(this,void 0,void 0,function*(){W("[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"});W(`[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(et.ProviderUpd
34ate,$t.EXTENSION),t.options.enableAnalytics&&((n=t.analytics)===null||n===void 0||n.send({event:Re.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 Ze!="object"||!("Buffer"in Ze))throw new Error("Unable to base64 encode: No available method.");e=Ze.Buffer.from(t,"utf8").toString("base64")}return e}function Ly(t,e,n,r){var i,o,a,s,c,l,u,d,h,f,g,m,w,p,S,_,O,I,j,q;return Z(this,void 0,void 0,function*(){const F=(i=t.state.remote)===null||i===void 0?void 0:i.isReady(),U=(o=t.state.remote)===null||o===void 0?void 0:o.isConnected(),K=(a=t.state.remote)===null||a===void 0?void 0:a.isPaused(),G=Ct.getProvider(),$=(s=t.state.remote)===null||s===void 0?void 0:s.getChannelId(),L=(c=t.state.remote)===null||c===void 0?void 0:c.isAuthorized(),{deeplinkProtocol:R}=t.state,{method:C,data:P,triggeredInstaller:D}=(T=>{var b,v,k,x;let M;X.isBuffer(T)?(M=T.toJSON(),M._isBuffer=!0):M=T;const N=(b=M==null?void 0:M.data)===null||b===void 0?void 0:b.method;let B=!1;return typeof((v=M==null?void 0:M.data)===null||v===void 0?void 0:v.params)=="object"&&((x=(k=M==null?void 0:M.data)===null||k===void 0?void 0:k.params)===null||x===void 0?void 0:x.__triggeredInstaller)===!0&&(B=!0,M.data.params=M.data.params.wrappedParams),{method:N,data:M,triggeredInstaller:B}})(e);if(W(`[RCPMS: write()] method='${C}' isRemoteReady=${F} channelId=${$} isSocketConnected=${U} isRemotePaused=${K} providerConnected=${G.isConnected()}`,e),!$)return C!==ue.METAMASK_GETPROVIDERSTATE&&W(`[RCPMS: write()] ${C} --> channelId is undefined`),r(new Error("disconnected"));W(`[RCPMS: write()] remote.isPaused()=${(l=t.state.remote)===null||l===void 0?void 0:l.isPaused()} authorized=${L} ready=${F} socketConnected=${U}`,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=(g=(f=t.state.remote)===null||f===void 0?void 0:f.hasDeeplinkProtocol())!==null&&g!==void 0&&g&&E&&L;try{if(!D){const v=JSON.stringify(P==null?void 0:P.data);if(v.length>Py)return r(new Error(`Message size ${v.length} exceeds maximum allowed size of 1000000 bytes`));(m=t.state.remote)===null||m===void 0||m.sendMessage(P==null?void 0:P.data).then(()=>{W(`[RCPMS: _write()] ${C} sent successfully`)}).catch(k=>{W("[RCPMS: _write()] error sending message",k)})}if(!y)return W(`[RCPMS: _write()] unsecure platform for method ${C} -- return callback`),r();if(D)return W("[RCPMS: _write()] prevent deeplink -- installation completed separately."),r();const T=(S=(p=(w=t.state.remote)===null||w===void 0?void 0:w.getKeyInfo())===null||p===void 0?void 0:p.ecies.public)!==null&&S!==void 0?S:"";let b=encodeURI(`channelId=${$}&pubkey=${T}&comm=socket&t=d&v=2`);if(A){const v=JSON.stringify(P==null?void 0:P.data),k=(_=t.state.remote)===null||_===void 0?void 0:_.encrypt(v);if(!k)return W("[RCPMS: _write()] error encrypting message"),r(new Error("RemoteCommunicationPostMessageStream - disconnected"));b+=`&scheme=${R}&rpc=${bo(k)}`}if(!(!((O=t.state.platformManager)===null||O===void 0)&&O.isMetaMaskInstalled()))return W("[RCPMS: _write()] prevent deeplink until installation is completed."),r();Wr[C]?(W(`[RCPMS: _write()] redirect link for '${C}' socketConnected=${U} connect?${b}`),(I=t.state.platformManager)===null||I===void 0||I.openDeeplink(`${qr}?${b}`,`${Vr}?${b}`,"_self")):!((j=t.state.remote)===null||j===void 0)&&j.isPaused()?(W(`[RCPMS: _write()] MM is PAUSED! deeplink with connect! targetMethod=${C}
34`),(q=t.state.platformManager)===null||q===void 0||q.openDeeplink(`${qr}?redirect=true&${b}`,`${Vr}?redirect=true&${b}`,"_self")):W(`[RCPMS: _write()] method ${C} doesn't need redirect.`)}catch(T){return W("[RCPMS: _write()] error sending message",T),r(new Error("RemoteCommunicationPostMessageStream - disconnected"))}return r()})}class Dy extends lr.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 Z(this,void 0,void 0,function*(){return Ly(this,e,0,r)})}_read(){}_onMessage(e){return function(n,r){try{if(W("[RCPMS: onMessage()] message",r),!r||typeof r!="object"||typeof(r==null?void 0:r.data)!="object")return;if(!(r!=null&&r.name))return void W("[RCPMS: onMessage()] ignore message without name",r);if((r==null?void 0:r.name)!==zr.PROVIDER)return void W(`[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){W(`[RCPMS: onMessage()] ignore message error err=${i}`)}}(this,e)}start(){}}let ru=1;const Rf=t=>new Promise(e=>{setTimeout(()=>{e(!0)},t)}),By=({checkInstallationOnAllCalls:t=!1,communicationLayerPreference:e,injectProvider:n,shouldShimWeb3:r,platformManager:i,installer:o,sdk:a,remoteConnection:s,debug:c})=>Z(void 0,void 0,void 0,function*(){var l,u;const d=(({name:K,remoteConnection:G})=>{if(!G||!(G!=null&&G.getConnector()))throw new Error("Missing remote connection parameter");return new Dy({name:K,remote:G==null?void 0:G.getConnector(),deeplinkProtocol:G==null?void 0:G.state.deeplinkProtocol,platformManager:G==null?void 0:G.getPlatformManager()})})({name:zr.INPAGE,target:zr.CONTENT_SCRIPT,platformManager:i,communicationLayerPreference:e,remoteConnection:s}),h=i.getPlatformType(),f=a.options.dappMetadata,g=`Sdk/Javascript SdkVersion/${Un.version} Platform/${h} dApp/${(l=f.url)!==null&&l!==void 0?l:f.name} dAppTitle/${f.name}`;let m=null,w=null;const p=(u=a.options.storage)===null||u===void 0?void 0:u.storageManager;if(p){try{const K=yield p.getCachedAccounts();K.length>0&&(m=K[0])}catch(K){console.error(`[initializeMobileProvider] failed to get cached addresses: ${K}`)}try{const K=yield p.getCachedChainId();K&&(w=K)}catch(K){console.error(`[initializeMobileProvider] failed to parse cached chainId: ${K}`)}}W(`[initializeMobileProvider] cachedAccountAddress: ${m}, cachedChainId: ${w}`);const S=!(!n||h===ze.NonBrowser||h===ze.ReactNative),_=Ct.init({shouldSetOnWindow:S,connectionStream:d,shouldShimWeb3:r,sdkInstance:a});let O=!1;const I=K=>{O=K},j=()=>O,q=(K,G,$,L)=>Z(void 0,void 0,void 0,function*(){var R,C,P,D,y,E,A,T,b;const v=Ct.getProvider();if(O){v.emit("display_uri",(s==null?void 0:s.state.qrcodeLink)||""),s==null||s.showActiveModal();let Q=j();for(;Q;){const ne=j(),se=s==null?void 0:s.isAuthorized();Q=ne&&!se,W(`[initializeMobileProvider: sendRequest()] waiting for initialization to complete - initializing: ${ne} authorized: ${se}`),yield Rf(1e3)}return W("[initializeMobileProvider: sendRequest()] initial method completed -- prevent installation and call provider"),$(...G)}const k=i.isMetaMaskInstalled(),x=s==null?void 0:s.isConnected();let M=null,N=null,B=null;if(M=(R=v.getSelectedAddress())!==null&&R!==void 0?R:m,B=v.getChainId()||w,M&&p&&M!==m&&p.persistAccounts([M]).catch(Q=>{console.error(`[initializeMobileProvider] failed to persist account: ${Q}`)}),B&&(w=B,p&&p.persistChainId(B).catch(Q=>{console.error(`[initializeMobileProvider] failed to persist chainId: ${Q}`)})),W("[initializeMobileProvider: sendRequest()]",{selectedAddress:M,chainId:B}),L&&W(`[initializeMobileProvider: sendRequest()] method=${K} ongoing=${O} selectedAddress=${M} isInstalled=${k} checkInstallationOnAllCalls=${t} socketConnected=${x}`),M&&K.toLowerCase()===ue.ETH_ACCOUNTS.toLowerCase())return[M];if(B&&K.toLowerCase()===ue.ETH_CHAINID.toLowerCase())return B;const H=[ue.ETH_REQUESTACCOUNTS,ue.WALLET_REQUESTPERMISSIONS,ue.METAMASK_CONNECTSIGN,ue.METAMASK_CONNECTWITH],z=!Wr[K],J=(C=a.options.readonlyRPCMap)===null||C===void 0?void 0:C[B];if(J&&z)try{const Q=(P=G==null?void 0:G[0])===null||P===void 0?void 0:P.params,ne=yield(({rpcEndpoint:se,method:le,sdkInfo:re,params:ie})=>Z(void 0,void 0,void 0,function*(){const ce=JSON.stringify({jsonrpc:"2.0",method:le,params:ie,id:(ru+=1,ru)}),ae={Accept:"application/json","Content-Type":"application/json"};let ye;se.includes("infura")&&(ae["Metamask-Sdk-Info"]=re);try{ye=yield Pu(se,{method:"POST",headers:ae,body:ce})}catch(Ee){throw Ee instanceof Error?new Error(`Failed to fetch from RPC: ${Ee.message}`):new Error(`Failed to fetch from RPC: ${Ee}`)}if(!ye.ok)throw new Error(`Server responded with a status of ${ye.status}`);return(yield ye.json()).result}))({rpcEndpoint:J,sdkInfo:g,method:K,params:Q||[]});return L&&W(`initializeProvider::ReadOnlyRPCResponse ${ne}`),ne}
34catch(Q){console.warn(`[initializeMobileProvider: sendRequest()] method=${K} readOnlyRPCRequest failed:`,Q)}if((!k||k&&!x)&&K!==ue.METAMASK_GETPROVIDERSTATE){const Q=((D=G==null?void 0:G[0])===null||D===void 0?void 0:D.params)||[];if(H.indexOf(K)!==-1||t){I(!0);const ne=K===ue.METAMASK_CONNECTWITH,se=`${Date.now()}`;try{yield o.start({wait:!1,connectWith:ne?{method:K,id:se,params:Q}:void 0}),yield new Promise((le,re)=>{s!=null&&s.isAuthorized()&&(W("[initializeMobileProvider: sendRequest()] already authorized"),le(!0)),s==null||s.getConnector().once(te.AUTHORIZED,()=>{le(!0)}),a.once(te.PROVIDER_UPDATE,ie=>{W(`[initializeMobileProvider: sendRequest()] PROVIDER_UPDATE --- remote provider request interupted type=${ie}`),ie===$t.EXTENSION?re(te.PROVIDER_UPDATE):re(new Error("Connection Terminated"))})})}catch(le){if($t.EXTENSION===le){if(W(`[initializeMobileProvider: sendRequest()] extension provider detect: re-create ${K} on the active provider`),K.toLowerCase()===ue.METAMASK_CONNECTSIGN.toLowerCase()){const re=yield(y=a.getProvider())===null||y===void 0?void 0:y.request({method:ue.ETH_REQUESTACCOUNTS,params:[]});if(!re.length)throw new Error("SDK state invalid -- undefined accounts");const ie=yield(E=a.getProvider())===null||E===void 0?void 0:E.request({method:ue.PERSONAL_SIGN,params:[Q[0],re[0]]});return a.emit(et.ConnectWithResponse,ie),ie}if(K.toLowerCase()===ue.METAMASK_CONNECTWITH.toLowerCase()){const[re]=Q,ie=yield(({method:ce,sdk:ae,params:ye})=>Z(void 0,void 0,void 0,function*(){var Ee,de,ge,ve;if(!ae.isExtensionActive())throw new Error("SDK state invalid -- extension is not active");W("[MetaMaskProvider: extensionConnectWithOverwrite()] Overwriting request method",ce,ye);const Pe=yield(Ee=ae.getProvider())===null||Ee===void 0?void 0:Ee.request({method:ue.ETH_REQUESTACCOUNTS,params:[]});if(!Pe.length)throw new Error("SDK state invalid -- undefined accounts");if((ce==null?void 0:ce.toLowerCase())===ue.PERSONAL_SIGN.toLowerCase()){const lt={method:ce,params:[ye[0],Pe[0]]};return yield(de=ae.getProvider())===null||de===void 0?void 0:de.request(lt)}if((ce==null?void 0:ce.toLowerCase())===ue.ETH_SENDTRANSACTION.toLowerCase()){const lt={method:ce,params:[Object.assign(Object.assign({},ye[0]),{from:Pe[0]})]};return yield(ge=ae.getProvider())===null||ge===void 0?void 0:ge.request(lt)}return Mf.includes(ce.toLowerCase())?(console.warn(`MetaMaskSDK connectWith method=${ce} -- not handled by the extension -- call separately`),Pe):yield(ve=ae.getProvider())===null||ve===void 0?void 0:ve.request({method:ce,params:ye})}))({method:re.method,sdk:a,params:re.params});return a.emit(et.ConnectWithResponse,ie),ie}return W(`[initializeMobileProvider: sendRequest()] sending '${K}' on active provider`,Q),yield(A=a.getProvider())===null||A===void 0?void 0:A.request({method:K,params:Q})}throw le===te.REJECTED?(s==null||s.closeModal(),(T=a.getProvider())===null||T===void 0||T.handleDisconnect({terminate:!1}),Object.assign(new Error("User rejected connection"),{code:4001})):(W(`[initializeMobileProvider: sendRequest()] failed to start installer: ${le}`),le)}finally{I(!1)}if(K===ue.ETH_REQUESTACCOUNTS)return N=yield new Promise(le=>{const re=setInterval(()=>{const{accounts:ie}=v.getState();ie&&(clearInterval(re),le(ie))},100)}),W(`[initializeMobileProvider: sendRequest()] selectedAddress: ${M} --- SKIP rpc call`),N;if(K===ue.METAMASK_CONNECTWITH)try{let le=0;const re=5,ie=({resolve:Ee,reject:de})=>{le+=1;const ge=s==null?void 0:s.getConnector().getRPCMethodTracker(),ve=ge==null?void 0:ge[se];return W(`TRACKER: update method ${se}`,ve),ve!=null&&ve.result?(W("[initializeMobileProvider: sendRequest()] found result",ve.result),a.emit(et.ConnectWithResponse,ve.result),void Ee(ve.result)):ve!=null&&ve.error?(W("[initializeMobileProvider: sendRequest()] found error",ve.error),void de(ve.error)):le>=re?(W("[initializeMobileProvider: sendRequest()] max message count reached without result"),void de(new Error("Max message count reached without result"))):void W("[initializeMobileProvider: sendRequest()] not found yet, need to wait for next update")};let ce,ae;const ye=yield new Promise((Ee,de)=>{const ge=s==null?void 0:s.getConnector().getRPCMethodTracker();W(`TRACKER: method ${se}`,ge),ge!=null&&ge[se].result?(W("[initializeMobileProvider: sendRequest()] found result",ge==null?void 0:ge[se].result),Ee(ge==null?void 0:ge[se].result)):ge!=null&&ge[se].error&&(W("[initializeMobileProvider: sendRequest()] found error",ge==null?void 0:ge[se].error),de(ge==null?void 0:ge[se].error)),ae=()=>ie({resolve:Ee,reject:de}),ce=s==null?void 0:s.getConnector().on(te.RPC_UPDATE,ae)});return ae&&(ce==null||ce.off(te.RPC_UPDATE,ae)),W("TRACKER: result",ye),ye}catch(le){throw W("[initializeMobileProvider: sendRequest()] error:",le),le}return G[0]&&typeof G[0]=="object"&&(G[0].params={__triggeredInstaller:!0,wrappedParams:G[0].params}),$(...G)}if(i.isSecure()&&Wr[K])return $(...G);if(a.isExtensionActive())return W(`[initializeMobileProvider: sendRequest()] EXTENSION active - redirect request '${K}' to it`,G,Q),yield(b=a.getProvider())===null||b===void 0?void 0:b.request({method:K,params:Q});throw W(`[initializeMobileProvider: sendRequest()] method=${K} --- skip --- not connected/installed`),new Error("MetaMask is not connected/installed, please call eth_requestAccounts to connect first.")}try{const Q=yield $(...G);if(W(`[initializeMobileProvider: sendRequest()] method=${K} rpcResponse`,Q),K===ue.WALLET_REQUESTPERMISSIONS){const ne=Q.reduce((se,le)=>{var re;if(le.parentCapability==="eth_accounts"){const ie=(re=le.caveats.find(ce=>ce.type==="restrictReturnedAccounts"))===null||re===void 0?void 0:re.value;ie&&se.push(...ie)}return se},[]);W("[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=(...K)=>Z(void 0,void 0,void 0,function*(){return q(K==null?void 0:K[0].method,K,F,c)});const{send:U}=_;return _.send=(...K)=>Z(void 0,void 0,void 0,function*(){return q(K==null?void 0:K[0],K,U,c)}),W("[initializeMobileProvider: sendRequest()] metamaskStream.start()"),d.start(),_});function $y(t){var e,n,r,i;return Z(this,void 0,void 0,function*(){const{options:o}=t,a={communicationLayerPreference:(e=o.communicationLayerPreference)!==null&&e!==void 0?e:Dn.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 By(a);t.activeProvider=s,function(c){var l,u,d,h;(u=(l=c.remoteConnection)===null||l===void 0?void 0:l.getConnector())===null||u===void 0||u.on(et.ConnectionStatus,f=>{c.emit(et.ConnectionStatus,f)}),(h=(d=c.remoteConnection)===null||d===void 0?void 0:d.getConnector())===null||h===void 0||h.on(et.ServiceStatus,f=>{c.emit(et.ServiceStatus,f)})}(t)})}const jy="sdk";class Ky{constructor({serverUrl:e,enabled:n,originatorInfo:r}){this.serverURL=sr,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:jy,event:e,sdkVersion:Un.version},this.originatorInfo),{params:n});W(`[Analytics: send()] event: ${e}`,r),Qt(r,this.serverURL).catch(i=>{W(`[Analytics: send()] error: ${i}`)})}}const Uy=()=>
34{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},Hy=163400;function iu(t){var e,n,r;const{dappMetadata:i}=t,o=function({url:u,name:d}){var h;const f=u+d,g=bo(f);if(!localStorage)return"";let m=(h=localStorage.getItem(g))!==null&&h!==void 0?h:"";if(!m){m=gn();try{localStorage.setItem(g,m)}catch{return""}}return m}({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"}),a=(r=t.platformManager)===null||r===void 0?void 0:r.getPlatformType(),s=a===ze.DesktopWeb,c=a===ze.MetaMaskMobileWebview;let l="N/A";return s?l="extension":c&&(l="mobile"),{id:o,from:l}}const _i=(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?Me.analytics.track("sdk_action_rejected",{action:t}):Me.analytics.track("sdk_action_failed",{action:t})}else Me.analytics.track("sdk_action_succeeded",{action:t})},ua=({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,a;return Z(this,void 0,void 0,function*(){W("[wrapExtensionProvider()] Overwriting request method",i);const{method:s,params:c}=i,l=Oy.includes(s.toLowerCase()),{id:u,from:d}=iu(e);if(l&&((o=e.analytics)===null||o===void 0||o.send({event:Re.SDK_RPC_REQUEST,params:{method:s,from:d,id:u}})),Jr(s)&&Me.analytics.track("sdk_action_requested",{action:s}),s===ue.METAMASK_BATCH&&Array.isArray(c))return(({target:g,args:m,trackEvent:w,sdkInstance:p})=>Z(void 0,void 0,void 0,function*(){var S,_;if(m.method!=="metamask_batch")throw new Error("Invalid usage");const O=[],I=(S=m==null?void 0:m.params)!==null&&S!==void 0?S:[];for(const F of I){const U=yield g==null?void 0:g.request({method:F.method,params:F.params});O.push(U)}const{id:j,from:q}=iu(p);w&&((_=p.analytics)===null||_===void 0||_.send({event:Re.SDK_RPC_REQUEST_DONE,params:{method:m.method,from:q,id:j}}));for(const F of O)_i(m.method,F,null);return O}))({target:n,args:i,trackEvent:l,sdkInstance:e});if(s.toLowerCase()===ue.METAMASK_CONNECTSIGN.toLowerCase()&&Array.isArray(c))return(({target:g,params:m})=>Z(void 0,void 0,void 0,function*(){let w,p=null;try{const S=yield g.request({method:ue.ETH_REQUESTACCOUNTS,params:[]});if(!S.length)throw new Error("SDK state invalid -- undefined accounts");return w=yield g.request({method:ue.PERSONAL_SIGN,params:[m[0],S[0]]}),w}catch(S){throw p=S,S}finally{_i(ue.PERSONAL_SIGN,w,p)}}))({target:n,params:c});if(s.toLowerCase()===ue.METAMASK_CONNECTWITH.toLowerCase()&&Array.isArray(c))return(({target:g,params:m})=>Z(void 0,void 0,void 0,function*(){const[w]=m,p=w.method,S=w.params;let _,O=null;try{const I=yield g.request({method:ue.ETH_REQUESTACCOUNTS,params:[]});if(!Array.isArray(I)||!I.length)throw new Error("SDK state invalid -- undefined accounts");return(p==null?void 0:p.toLowerCase())===ue.PERSONAL_SIGN.toLowerCase()?(_=yield g.request({method:p,params:[S[0],I[0]]}),_):(p==null?void 0:p.toLowerCase())===ue.ETH_SENDTRANSACTION.toLowerCase()?(_=yield g.request({method:p,params:[Object.assign(Object.assign({},S[0]),{from:I[0]})]}),_):Mf.includes(p.toLowerCase())?(console.warn(`MetaMaskSDK connectWith method=${p} -- not handled by the extension -- call separately`),_=I,_):(_=yield g.request({method:p,params:S}),_)}catch(I){throw O=I,I}finally{_i(p,_,O)}}))({target:n,params:c});let h,f=null;try{return h=yield n.request(i),h}catch(g){throw f=g,g}finally{l&&((a=e.analytics)===null||a===void 0||a.send({event:Re.SDK_RPC_REQUEST_DONE,params:{method:s,from:d,id:u}})),_i(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 Fy({mustBeMetaMask:t,sdkInstance:e}){return Z(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,a=>{const s=a,{detail:{info:c,provider:l}={}}=s,{name:u,rdns:d,uuid:h}=c??{};Ry.test(h)&&u.startsWith(tu.NAME)&&tu.RDNS.includes(d)&&(clearTimeout(o),r(l))}),window.dispatchEvent(new Event(wo.Request))});return ua({provider:n,sdkInstance:e})}catch{if(!t&&window.ethereum)return ua({provider:window.ethereum,sdkInstance:e});throw new Error("Provider not found")}})}(function(t){t.Announce="eip6963:announceProvider",t.Request="eip6963:requestProvider"})(wo||(wo={}));const zy=t=>Z(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}),qy=t=>Z(void 0,void 0,void 0,function*(){const{options:e}=t,{readonlyRPCMap:n}=e;if(n)try{W("[MetaMaskSDK: setupReadOnlyRPCProviders()] Setting up Readonly RPC Providers",n),t.setReadOnlyRPCCalls(!0)}catch{throw new Error("Invalid Infura Settings")}});
34function Vy(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(l){try{c(r.next(l))}catch(u){o(u)}}function s(l){try{c(r.throw(l))}catch(u){o(u)}}function c(l){var u;l.done?i(l.value):(u=l.value,u instanceof n?u:new n(function(d){d(u)})).then(a,s)}c((r=r.apply(t,[])).next())})}function Wy(t,e){var n,r,i,o,a={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(c){return function(l){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;a;)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 a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(i=a.trys,!((i=i.length>0&&i[i.length-1])||u[0]!==6&&u[0]!==2)){a=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){a.label=u[1];break}if(u[0]===6&&a.label<i[1]){a.label=i[1],i=u;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(u);break}i[2]&&a.ops.pop(),a.trys.pop();continue}u=e.call(t,a)}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}}([c,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"},Si="REGISTRATION_IN_PROGRESS",du="FORWARDER_ID",Gy=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,a=o===void 0?t.FORWARDER_MODE.INJECT:o;this.forwarderOrigin=i,this.forwarderMode=a,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),a===t.FORWARDER_MODE.INJECT&&sessionStorage.getItem(Si)==="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 Vy(this,0,void 0,function(){return Wy(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(Si,"true"),this._openDownloadPage(),this._openForwarder()},t.prototype.stopOnboarding=function(){sessionStorage.getItem(Si)==="true"&&(this.forwarderMode===t.FORWARDER_MODE.INJECT&&(console.debug("Removing forwarder"),t._removeForwarder()),sessionStorage.setItem(Si,"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=xf.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 Yy(t,{wait:e=!1}){return Z(this,void 0,void 0,function*(){return W(`[MetamaskInstaller: startInstaller()] wait=${e}`),e&&(yield Rf(1e3)),yield t.checkInstallation()})}class Zy{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 Z(this,void 0,void 0,function*(){W("[MetamaskInstaller: startDesktopOnboarding() starting desktop onboarding"),window.ethereum&&(window.ethereum=void 0),new Gy().startOnboarding()})}()}redirectToProperInstall(){return Z(this,void 0,void 0,function*(){return function(e){var n,r;return Z(this,void 0,void 0,function*(){const{state:i}=e,o=(n=i.platformManager)===null||n===void 0?void 0:n.getPlatformType();if(W(`[MetamaskInstaller: redirectToProperInstall()] platform=${o}`),o===ze.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(a){throw i.isInstalling=!1,a}return!0})}(this)})}checkInstallation(){return Z(this,void 0,void 0,function*(){return function(e){var n;return Z(this,void 0,void 0,function*(){const{state:r}=e,i=(n=r.platformManager)===null||n===void 0?void 0:n.isMetaMaskInstalled();return W(`[MetamaskInstaller: checkInstallation()] isInstalled=${i}`),!!i||(yield e.redirectToProperInstall())})}(this)})}start({wait:e=!1,connectWith:n}){return Z(this,void 0,void 0,function*(){this.state.connectWith=n,W(`[MetaMaskInstaller: start()] w
34ait=${e}`,n),yield Yy(this,{wait:e})})}}class Of{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 Z(this,void 0,void 0,function*(){if(!this.defined[e]){this.defined[e]=!0;try{const n=yield Promise.resolve().then(function(){return Rv});console.log("loader",n),n.defineCustomElements()}catch(n){console.error(`Failed to load ${e} modal:`,n)}}})}renderInstallModal(e){var n;return Z(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 Z(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 Z(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 Jy=({link:t,debug:e,installer:n,terminate:r,connectWithExtension:i,preferDesktop:o,onAnalyticsEvent:a})=>{let s=null,c=null;W("[UI: InstallModal-web: sdkWebInstallModal()] ################## Installing Modal #################"),W(`[UI: InstallModal-web: sdkWebInstallModal()] link=${t}`),W(`[UI: InstallModal-web: sdkWebInstallModal()] npx uri-scheme open "${t}" --ios`),W(`[UI: InstallModal-web: sdkWebInstallModal()] npx uri-scheme open "${t}" --android`),W(`[UI: InstallModal-web: sdkWebInstallModal()] adb shell am start -a android.intent.action.VIEW -d "${t}"`);const l=u=>{var d;W("[UI: InstallModal-web: sdkWebInstallModal()] installModal-web unmounting install modal -- shouldTerminate:",u,c),c!=null&&c.parentNode&&((d=c.parentNode)===null||d===void 0||d.removeChild(c)),c=null,s=null,u===!0&&(r==null||r())};return{mount:u=>{if(W("[UI: InstallModal-web: sdkWebInstallModal()] installModal-web mounting install modal",c),c)return c.style.display="block",void(s==null||s.updateQRCode(u));s=new Of({debug:e,sdkVersion:Un.version}),c=document.createElement("div"),document.body.appendChild(c),window.extension?s.renderSelectModal({parentElement:c,connectWithExtension:()=>{l(),i==null||i()},onClose:l,link:t,preferDesktop:o!=null&&o}).catch(d=>{console.error(d)}):s.renderInstallModal({parentElement:c,preferDesktop:o!=null&&o,link:t,metaMaskInstaller:n,onClose:l,onAnalyticsEvent:a}).catch(d=>{console.error("[UI: InstallModal-web: sdkWebInstallModal()]",d)})},unmount:l}},Xy=({onDisconnect:t,debug:e})=>{let n=null,r=null;const i=()=>{W("[UI: pendingModal-web: sdkWebPendingModal()] pendingModal-web unmount",n),n!=null&&n.parentNode&&n.parentNode.removeChild(n),n=null,r=null},o=s=>{W("[UI: pendingModal-web: sdkWebPendingModal()] pendingModal-web updateOTPValue",s),r&&r.updateOTPValue(s)},a=({displayOTP:s}={displayOTP:!0})=>{W("[UI: pendingModal-web: sdkWebPendingModal()] pendingModal-web mount",n),n?n.style.display="block":(r=new Of({debug:e,sdkVersion:Un.version}),n=document.createElement("div"),document.body.appendChild(n),r.renderPendingModal({parentElement:n,onClose:i,onDisconnect:t,updateOTPValue:o,displayOTP:s}).catch(c=>{console.error("[UI: pendingModal-web: sdkWebPendingModal()]",c)}))};return a(),{mount:a,unmount:i,updateOTPValue:o}};function Pf(t,e){var n,r,i,o;t.connector||(W("[RemoteConnection: initializeConnector()] initialize connector"),t.connector=new eg({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:Un.version,context:"dapp",ecies:e.ecies,storage:e.storage,logging:e.logging}),e.timer&&(W("[RemoteConnection: initializeConnector()] reset background timer",e.timer),(r=(n=e.timer)===null||n===void 0?void 0:n.stopBackgroun
34dTimer)===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 da(t){t.listeners.forEach(({event:e,handler:n})=>{var r;(r=t.connector)===null||r===void 0||r.off(e,n)}),t.listeners=[]}function Qy(t,e,n){return Z(this,void 0,void 0,function*(){const r=setTimeout(()=>{Me.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"));W("[RemoteConnection: connectWithModalInstaller()]",{state:t,options:e,linkParams:n});const a=`${t.useDeeplink?Vr:qr}?${n}`;(function(s,c,l){var u,d,h,f;s.installModal=(d=(u=c.modals).install)===null||d===void 0?void 0:d.call(u,{link:l,preferDesktop:s.preferDesktop,installer:c.getMetaMaskInstaller(),terminate:()=>{W("[RemoteConnection: showInstallModal() => terminate()] terminate connection"),c.sdk.terminate().catch(g=>{console.warn("[MMSDK] failed to terminate connection",g)})},debug:s.developerMode,connectWithExtension:()=>{var g;return(g=c.connectWithExtensionProvider)===null||g===void 0||g.call(c),!1},onAnalyticsEvent:({event:g,params:m})=>{var w,p,S;const _=Object.assign(Object.assign({},m),{sdkVersion:c.sdk.getVersion(),dappId:(w=c.dappMetadata)===null||w===void 0?void 0:w.name,source:c._source,url:(p=c.dappMetadata)===null||p===void 0?void 0:p.url});(S=s.analytics)===null||S===void 0||S.send({event:g,params:_})}}),(f=(h=s.installModal)===null||h===void 0?void 0:h.mount)===null||f===void 0||f.call(h,l)})(t,e,a),e.sdk.once(te.PROVIDER_UPDATE,s=>Z(this,void 0,void 0,function*(){if(W("[RemoteConnection: connectWithModalInstaller()] once provider_update -- resolving startConnection promise"),s===$t.TERMINATE){const c={code:4001,message:"User rejected the request."};return clearTimeout(r),void o(c)}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,()=>Z(this,void 0,void 0,function*(){W("[RemoteConnection: connectWithModalInstaller()] once clients_ready -- resolving startConnection promise"),clearTimeout(r),i()}))})})}function If(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&&(da(t),n(te.WALLET_INIT,({accounts:r,chainId:i})=>Z(this,void 0,void 0,function*(){W(`[RemoteConnection: setupListeners() => EventType.WALLET_INIT] 'wallet_init' accounts=${r} chainId=${i}`);const o=Ct.getProvider();o._setConnected();const a={accounts:r,chainId:i,isUnlocked:!1};o._initializeState(a),o.emit("chainChanged",i),o.emit("accountsChanged",r)})),n(te.AUTHORIZED,()=>Z(this,void 0,void 0,function*(){var r,i,o,a;try{W("[RemoteConnection: setupListeners() => EventType.AUTHORIZED] 'authorized' closing modals",t.pendingModal,t.installModal);const s=Ct.getProvider();s._setConnected(),(i=(r=t.pendingModal)===null||r===void 0?void 0:r.unmount)===null||i===void 0||i.call(r),(a=(o=t.installModal)===null||o===void 0?void 0:o.unmount)===null||a===void 0||a.call(o,!1),t.otpAnswer=void 0,t.authorized=!0,W("[RemoteConnection: setupListeners() => EventType.AUTHORIZED] 'authorized' provider.state",s.getState()),yield s.forceInitializeState()}catch{}})),n(te.TERMINATE,()=>{var r,i,o,a,s;(i=(r=t.pendingModal)===null||r===void 0?void 0:r.unmount)===null||i===void 0||i.call(r),(a=(o=t.installModal)===null||o===void 0?void 0:o.unmount)===null||a===void 0||a.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,Ct.getProvider().handleDisconnect({terminate:!0}),da(t),W("[RemoteConnection: setupListeners()] All listeners cleaned up")}))}function ev(t,e,{initialCheck:n,connectWith:r}={}){var i,o,a,s,c,l,u,d,h,f,g,m,w,p,S,_,O,I,j;return Z(this,void 0,void 0,function*(){try{if(Pf(t,e),!t.connector)throw new Error("no connector defined");If(t);const q=Ct.getProvider();t.authorized=!1,q.emit("connecting");const F=yield(i=t.connector)===null||i===void 0?void 0:i.originatorSessionConnect();W(`[RemoteConnection: startConnection()] after originatorSessionConnect initialCheck=${n}`,F);let U=(o=F==null?void 0:F.channelId)!==null&&o!==void 0?o:"",K=(s=(a=t.connector.getKeyInfo())===null||a===void 0?void 0:a.ecies.public)!==null&&s!==void 0?s:"",G=(l=(c=t.connector.getKeyInfo())===null||c===void 0?void 0:c.ecies.private)!==null&&l!==void 0?l:"";if(n&&!F)return Promise.resolve();if(!F&&!n){const x=yield t.connector.generateChannelIdConnect();U=(u=x.channelId)!==null&&u!==void 0?u:"",K=(d=x.pubKey)!==null&&d!==void 0?d:"",G=(h=x.privKey)!==null&&h!==void 0?h:"";const M=Date.now();(f=t.connector.state.storageManager)===null||f===void 0||f.persistChannelConfig({channelId:U,localKey:G,lastActive:M,validUntil:M+ar})}if(n&&(F!=null&&F.channelId))return!((g=t.connector)===null||g===void 0)&&g.isConnected()||(W(`[RemoteConnection: startConnection()] reconnecting to channel initialCheck=${n}`,F),yield(m=t.connector)===null||m===void 0?void 0:m.connectToChannel
34({channelId:U})),Promise.resolve();F&&!(!((w=t.connector)===null||w===void 0)&&w.isConnected())&&(W("[RemoteConnection: startConnection()] reconnecting to channel",F),yield(p=t.connector)===null||p===void 0?void 0:p.connectToChannel({channelId:U}));const $=!((S=t.platformManager)===null||S===void 0)&&S.isSecure()?"":"&t=q",L=Un.version,{iconUrl:R,name:C,url:P,scheme:D}=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:C!==void 0?E=C:P!==void 0&&(E=P);const A={url:P??"",title:C??"",icon:R,scheme:D??"",apiVersion:L,dappId:E||P||"N/A",anonId:e.anonId,platform:y??"",source:(O=e._source)!==null&&O!==void 0?O:""},T=bo(JSON.stringify(A));let b=`channelId=${U}&v=2&comm=${(I=t.communicationLayerPreference)!==null&&I!==void 0?I:""}&pubkey=${K}${$}&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?Vr:qr}?${b}`;if(t.qrcodeLink=k,t.developerMode&&W(`[RemoteConnection: startConnection()] qrcodeLink=${v}`),q.emit("display_uri",k),Me.analytics.track("sdk_connection_initiated",{transport_type:"websocket"}),(j=t.platformManager)===null||j===void 0?void 0:j.isSecure()){const x=setTimeout(()=>{Me.analytics.track("sdk_connection_failed",{transport_type:"websocket"})},6e4);return yield function(M,N){var B,H;return Z(this,void 0,void 0,function*(){const z=`${qr}?${N}`,J=`${Vr}?${N}`;(H=(B=M.platformManager)===null||B===void 0?void 0:B.openDeeplink)===null||H===void 0||H.call(B,z,J,"_self")})}(t,v),new Promise((M,N)=>{var B,H,z;if(!((B=t.connector)===null||B===void 0)&&B.isAuthorized())return clearTimeout(x),void M();(H=t.connector)===null||H===void 0||H.once(te.AUTHORIZED,()=>{clearTimeout(x),M()}),(z=t.connector)===null||z===void 0||z.once(te.REJECTED,()=>{clearTimeout(x),N(te.REJECTED)})})}return Qy(t,e,v)}catch(q){throw console.error("[startConnection] error",q),q}})}class tv{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=Jy),e.modals.otp||(e.modals.otp=Xy)}startConnection(e){return Z(this,void 0,void 0,function*(){return ev(this.state,this.options,e)})}initRemoteCommunication({sdkInstance:e}){var n,r,i;return Z(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 a={privateKey:o==null?void 0:o.localKey};this.options.ecies=a}Pf(this.state,this.options),yield(i=this.getConnector())===null||i===void 0?void 0:i.initFromDappStorage(),If(this.state,this.options)})}showActiveModal(){return function(e){var n,r,i,o;e.authorized?W("[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()}
34getKeyInfo(){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;W("[RemoteConnection: disconnect()]",e),e!=null&&e.terminate&&(Ct.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){W("[RemoteConnection: cleanupConnector()] cleaning up connector"),o.connector&&(da(o),o.connector.disconnect({terminate:!0}).catch(a=>{W("[RemoteConnection: cleanupConnector()] error disconnecting connector",a)}))}(this.state)}}function nv(t){var e,n,r,i,o,a,s,c,l,u,d;return Z(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:Dn.SOCKET,h.enableDebug!==void 0&&(Ye.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=(a=h.extensionOnly)===null||a===void 0||a,h.useDeeplink=(s=h.useDeeplink)===null||s===void 0||s,h.storage=(c=h.storage)!==null&&c!==void 0?c:{enabled:!0},h.headless){Ye("[MetaMaskSDK: performSDKInitialization()] headless mode enabled");const S=()=>{},_={install:()=>({mount:S,unmount:S})},O={installer:S};h.modals=_,h.ui=O}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,W("[MetaMaskSDK: performSDKInitialization()] options",t.options);const g=Object.assign({},h.logging);f&&(g.sdk=!0,g.eciesLayer=!0,g.keyExchangeLayer=!0,g.remoteLayer=!0,g.serviceLayer=!0,g.plaintext=!0),yield function(S){var _;return Z(this,void 0,void 0,function*(){const{options:O}=S;S.platformManager=new Fr({useDeepLink:(_=O.useDeeplink)!==null&&_!==void 0&&_,preferredOpenLink:O.openDeeplink,debug:S.debug})})}(t),yield function(S){var _,O,I,j,q;return Z(this,void 0,void 0,function*(){const{options:F}=S,U=(_=S.platformManager)===null||_===void 0?void 0:_.getPlatformType();S.analytics=new Ky({serverUrl:(O=F.communicationServerUrl)!==null&&O!==void 0?O:sr,enabled:F.enableAnalytics,originatorInfo:{url:(I=F.dappMetadata.url)!==null&&I!==void 0?I:"",title:(j=F.dappMetadata.name)!==null&&j!==void 0?j:"",dappId:S.getDappId(),platform:U??"",source:(q=F._source)!==null&&q!==void 0?q:"",anonId:""}})})}(t),yield function(S){var _,O,I;return Z(this,void 0,void 0,function*(){if(!S.options.enableAnalytics||!(!((_=S.platformManager)===null||_===void 0)&&_.isBrowser())&&!(!((O=S.platformManager)===null||O===void 0)&&O.isReactNative()))return;const j=S.getVersion(),q=S.getDappId(),F=yield S.getAnonId(),U=(I=S.platformManager)===null||I===void 0?void 0:I.getPlatformType(),K=S.options._source;Me.analytics.setGlobalProperty("sdk_version",j),Me.analytics.setGlobalProperty("dapp_id",q),Me.analytics.setGlobalProperty("anon_id",F),Me.analytics.setGlobalProperty("platform",U),Me.analytics.setGlobalProperty("integration_type",K),Me.analytics.enable(),Me.analytics.track("sdk_initialized",{})})}(t),yield function(S){var _;return Z(this,void 0,void 0,function*(){const{options:O}=S;((_=O.storage)===null||_===void 0?void 0:_.enabled)!==!0||O.storage.storageManager||(O.storage.storageManager=yield Tf(O.storage))})}(t),yield function(S){return Z(this,void 0,void 0,function*(){const{options:_}=S,O=/^(http|https):\/\/[^\s]*$/;if(_.dappMetadata){_.dappMetadata.iconUrl&&!O.test(_.dappMetadata.iconUrl)&&(console.warn("Invalid dappMetadata.iconUrl: URL must start with http:// or https://"),_.dappMetadata.iconUrl=void 0),_.dappMetadata.base64Icon&&_.dappMetadata.base64Icon.length>Hy&&(console.warn("Invalid dappMetadata.base64Icon: Base64-encoded icon string length must be less than 163400 characters"),_.dappMetadata.base64Icon=void 0),_.dappMetadata.url&&!O.test(_.dappMetadata.url)&&console.warn("Invalid dappMetadata.url: URL must start with http:// or https://");const I=Uy();if(I&&!_.dappMetadata.iconUrl&&!_.dappMetadata.base64Icon){const j=`${window.location.protocol}//${window.location.host}${I}`;_.dappMetadata.iconUrl=j}}S.dappMetadata=_.dappMetadata})}(t),yield zy(t),yield qy(t);const{metamaskBrowserExtension:m,preferExtension:w,shouldReturn:p}=yield function(S){var _,O,I,j;return Z(this,void 0,void 0,function*(){const{options:q}=S;let F,U=!1,K=!1;if(typeof window<"u"&&window.ethereum&&!(!((_=S.platformManager)===null||_===void 0)&&_.isMetaMaskMobileWebView())){U=localStorage.getItem(vo)==="extension";try{F=yield Fy({mustBeMetaMask:!0,sdkInstance:S}),window.extension=F,F.on(At.CHAIN_CHANGED,G=>{W(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE chainChanged chainId=${G}`),S.sdkProvider&&S.getMobileProvider().emit(At.CHAIN_CHANGED,G)}),F.on(At.ACCOUNTS_CHANGED,G=>Z(this,void 0,void 0,function*(){var $;W(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE accountsChanged accounts=${G}`);const L=!!S.sdkProvider,R=!!S.extensionActive;if(L&&S.getMobileProvider().emit(At.ACCOUNTS_CHANGED,G),R&&(G==null?void 0:G.length)===0&&(yield($=S.getProvider())===null||$===void 0?void 0:$.request({method:ue.WALLET_GETPE
34RMISSIONS,params:[]})).length===0)try{yield S.terminate()}catch(C){W("[MetaMaskSDK: setupExtensionPreferences()] error terminating on permissions revoked",C)}})),F.on(At.DISCONNECT,G=>{W(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE disconnect error=${G}`),S.sdkProvider&&S.getMobileProvider().emit(At.DISCONNECT,G)}),F.on(At.CONNECT,G=>{W(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE connect args=${G}`),S.sdkProvider&&S.getMobileProvider().emit(At.CONNECT,G)}),F.on(At.CONNECTED,G=>{W("[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE connected",G),S.sdkProvider&&S.getMobileProvider().emit(At.CONNECTED,G)})}catch{window.extension=void 0}}else!((O=S.platformManager)===null||O===void 0)&&O.isMetaMaskMobileWebView()&&((I=S.analytics)===null||I===void 0||I.send({event:Re.SDK_USE_INAPP_BROWSER}),S.activeProvider=ua({provider:window.ethereum,sdkInstance:S}),S._initialized=!0,K=!0);return F&&q.extensionOnly&&(W("[MetaMaskSDK: setupExtensionPreferences()] EXTENSION ONLY --- prevent sdk initialization"),(j=S.analytics)===null||j===void 0||j.send({event:Re.SDK_USE_EXTENSION}),S.activeProvider=F,S.extensionActive=!0,S.extension=F,S._initialized=!0,K=!0),{preferExtension:U,shouldReturn:K,metamaskBrowserExtension:F}})}(t);if(p)W("[MetaMaskSDK: performSDKInitialization()] shouldReturn=true --- prevent sdk initialization");else{yield function(S,_){var O,I,j,q,F;return Z(this,void 0,void 0,function*(){const{options:U}=S,K=Object.assign({},U.logging);S.remoteConnection=new tv({anonId:yield S.getAnonId(),preferDesktop:(O=U.preferDesktop)!==null&&O!==void 0&&O,communicationLayerPreference:(I=U.communicationLayerPreference)!==null&&I!==void 0?I:Dn.SOCKET,analytics:S.analytics,dappMetadata:U.dappMetadata,_source:U._source,enableAnalytics:(j=U.enableAnalytics)===null||j===void 0||j,timer:U.timer,sdk:S,platformManager:S.platformManager,transports:U.transports,communicationServerUrl:U.communicationServerUrl,storage:(q=U.storage)!==null&&q!==void 0?q:{enabled:!0},getMetaMaskInstaller:()=>{if(!S.installer)throw new Error("Invalid SDK status -- installer not initialized");return S.installer},logging:K,connectWithExtensionProvider:_===void 0?void 0:()=>nu(S),modals:Object.assign(Object.assign({},U.modals),{onPendingModalDisconnect:S.terminate.bind(S)})}),yield S.remoteConnection.initRemoteCommunication({sdkInstance:S}),S.installer=new Zy({remote:S.remoteConnection,preferDesktop:(F=U.preferDesktop)!==null&&F!==void 0&&F,platformManager:S.platformManager,debug:S.debug})})}(t,m),yield $y(t),yield function(S,_){var O,I;return Z(this,void 0,void 0,function*(){const{options:j}=S;_?(W("[MetaMaskSDK: handleAutoAndExtensionConnections()] preferExtension is detected -- connect with it."),(O=S.analytics)===null||O===void 0||O.send({event:Re.SDK_EXTENSION_UTILIZED}),nu(S).catch(q=>{console.warn("Can't connect with MetaMask extension...",q),localStorage.removeItem(vo)})):j.checkInstallationImmediately&&(!((I=S.platformManager)===null||I===void 0)&&I.isDesktopWeb()?(W("[MetaMaskSDK: handleAutoAndExtensionConnections()] checkInstallationImmediately"),S.connect().catch(q=>{W(`[MetaMaskSDK: handleAutoAndExtensionConnections()] checkInstallationImmediately --- IGNORED --- error on autoconnect _err=${q}`)})):console.warn("[handleAutoAndExtensionConnections()] checkInstallationImmediately --- IGNORED --- only for web desktop")),S._initialized=!0})}(t,w);try{yield(d=t.remoteConnection)===null||d===void 0?void 0:d.startConnection({initialCheck:!0})}catch(S){console.error("[MetaMaskSDK: setupRemoteConnectionAndInstaller()] Error while checking installation",S)}t.emit(et.ProviderUpdate,$t.INITIALIZED)}})}class Wv extends U0{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",Ye.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)&&Ye.enable("MM_SDK"),W("[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(()=>{W("[MetaMaskSDK: constructor()]: initialized successfully."),typeof window<"u"&&(window.mmsdk=this)}).catch(a=>{console.error("[MetaMaskSDK: constructor()] error during initialization",a)})}init(){return Z(this,void 0,void 0,function*(){return function(e){var n;return Z(this,void 0,void 0,function*(){if(typeof window<"u"&&(!((n=window.mmsdk)===null||n===void 0)&&n.isInitialized()))return W("[MetaMaskSDK: initializeMetaMaskSDK()] already initialized"),Promise.resolve(window.mmsdk);if(e._initialized)return W("[MetaMaskSDK: initializeMetaMaskSDK()] already initialized"),e.sdkInitPromise;if(e.sdkInitPromise)return W("[MetaMaskSDK: initializeMetaMaskSDK()] already initializing"),e.sdkInitPromise;try{e.sdkInitPromise=nv(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 Z(this,void 0,void 0,function*(){return function(e){return Z(this,void 0,void 0,function*(){if(e._initialized||(W("[MetaMaskSDK: connect()] provider not ready -- wait for init()"),yield e.init()),W(`[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:ue.ETH_REQUESTACCOUNTS,params:[]})})}(this)})}connectAndSign({msg:e}){return Z(this,void 0,void 0,function*(){return Ny({instance:this,msg:e})})}connectWith(e){return Z(this,void 0,void 0,function*(){return function({instance:n,rpc:r}){return Z(this,void 0,void 0,function*(){if(n._initialized||(W("[MetaMaskSDK: connectWith()] provider not ready -- wait for init()"),yield n.init()),W(`[MetaMaskSDK: connectWith()] method: ${r.method} rpc=${r}`),!n.activeProvider)throw new Error("SDK state invalid -- undefined provider");return n.activeProvider.request({method:ue.METAMASK_CONNECTWITH,params:[r]})})}({instance:this,rpc:e})})}resume(){return function(e){var n,r,i;return Z(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 W("[MetaMaskSDK: resume()] channel is not ready -- starting connection"),void((i=e.remoteConnection)===null||i===void 0||i.startConnection());W("[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 Z(this,void 0,void 0,function*(){if(!(!((n=e.platformManager)===null||n===void 0)&&n.isMetaMaskMobileWebView())){if(Iy&&(window.localStorage.removeItem(vo),window.localStorage.removeItem(la),window.localStorage.removeItem(ca)),e.extensionActive){try{yield(r=e.activeProvider)===null||r===void 0?void 0:r.request({method:ue.WALLET_REVOKEPERMISSIONS,params:[{eth_accounts:{}}]})}catch(o){W("[MetaMaskSDK: terminate()] error revoking permissions",o)}
34return e.options.extensionOnly?(e.emit(et.ProviderUpdate,$t.TERMINATE),void W("[MetaMaskSDK: terminate()] extensionOnly --- prevent switching providers")):(e.activeProvider=e.sdkProvider,window.ethereum=e.activeProvider,e.extensionActive=!1,void e.emit(et.ProviderUpdate,$t.TERMINATE))}e.emit(et.ProviderUpdate,$t.TERMINATE),W(`[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 Un.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 Z(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():gn(),this._anonId=r,r})}getBrowserAnonId(){const e=this.ANON_ID_STORAGE_KEY;try{const n=localStorage.getItem(e);if(n)return n;const r=gn();return localStorage.setItem(e,r),r}catch(n){return console.error("[MetaMaskSDK: getBrowserAnonId()] LocalStorage access error:",n),gn()}}getReactNativeAnonId(){return Z(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=gn();return yield n.setItem(e,i),i}catch(n){return console.error("[MetaMaskSDK: getReactNativeAnonId()] Error accessing AsyncStorage:",n),gn()}})}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 rv=Object.freeze({__proto__:null,StorageManagerWeb:class{constructor({enabled:t}={enabled:!1}){this.enabled=!1,this.enabled=t}persistChannelConfig(t){return Z(this,void 0,void 0,function*(){const e=JSON.stringify(t);W(`[StorageManagerWeb: persistChannelConfig()] enabled=${this.enabled}`,t),localStorage.setItem(Cs,e)})}getPersistedChannelConfig(){return Z(this,void 0,void 0,function*(){let t;try{if(W(`[StorageManagerWeb: getPersistedChannelConfig()] enabled=${this.enabled}`),t=localStorage.getItem(Cs),W("[StorageManagerWeb: getPersistedChannelConfig()]",t),!t)return;const e=JSON.parse(t);return W("[StorageManagerWeb: getPersistedChannelConfig()] channelConfig",e),e}catch(e){return void console.error("[StorageManagerWeb: getPersistedChannelConfig()] Can't find existing channel config",e)}})}persistAccounts(t){return Z(this,void 0,void 0,function*(){W(`[StorageManagerWeb: persistAccounts()] enabled=${this.enabled}`,t);const e=JSON.stringify(t);localStorage.setItem(ca,e)})}getCachedAccounts(){return Z(this,void 0,void 0,function*(){try{const t=localStorage.getItem(ca);return t?JSON.parse(t):[]}catch(t){throw console.error("[StorageManagerWeb: getCachedAccounts()] Error reading cached accounts",t),t}})}persistChainId(t){return Z(this,void 0,void 0,function*(){W(`[StorageManagerWeb: persistChainId()] enabled=${this.enabled}`,t),localStorage.setItem(la,t)})}getCachedChainId(){return Z(this,void 0,void 0,function*(){try{const t=localStorage.getItem(la);return t??void 0}catch(t){throw console.error("[StorageManagerWeb: getCachedChainId()] Error reading cached chainId",t),t}})}terminate(){return Z(this,void 0,void 0,function*(){W(`[StorageManagerWeb: terminate()] enabled=${this.enabled}`),localStorage.removeItem(Cs)})}}});const iv="hydrated",ov=!1,sv=!1,av=!0;var cv=Object.defineProperty,Xa=new WeakMap,wn=t=>Xa.get(t),Qa=(t,e)=>Xa.set(e.$lazyInstance$=t,e),hu=(t,e)=>e in t,Ln=(t,e)=>(0,console.error)(t,e),ks=new Map,qi=new Map,Nf="slot-fb{display:contents}slot-fb[hidden]{display:none}",Io=typeof window<"u"?window:{},Lt=Io.document||{head:{}},$e={$flags$:0,$resourcesUrl$:"",jmp:t=>
34t(),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)},Lf=(()=>{try{return new CSSStyleSheet,typeof new CSSStyleSheet().replaceSync=="function"}catch{}return!1})(),ha=!1,fu=[],Df=[],lv=(t,e)=>n=>{t.push(n),ha||(ha=!0,4&$e.$flags$?ec(fa):$e.raf(fa))},pu=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(n){Ln(n)}t.length=0},fa=()=>{pu(fu),pu(Df),(ha=fu.length>0)&&$e.raf(fa)},ec=t=>(e=>Promise.resolve(e))().then(t),uv=lv(Df),mu={},tc=t=>(t=typeof t)=="object"||t==="function";function Bf(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)cv(t,n,{get:e[n],enumerable:!0})})({},{err:()=>$f,map:()=>dv,ok:()=>pa,unwrap:()=>hv,unwrapErr:()=>fv});var pa=t=>({isOk:!0,isErr:!1,value:t}),$f=t=>({isOk:!1,isErr:!0,value:t});function dv(t,e){if(t.isOk){const n=e(t.value);return n instanceof Promise?n.then(r=>pa(r)):pa(n)}if(t.isErr){const n=t.value;return $f(n)}throw"should never get here"}var Vi,nc,hv=t=>{if(t.isOk)return t.value;throw t.value},fv=t=>{if(t.isErr)return t.value;throw t.value},Y=(t,e,...n)=>{let r=null,i=!1,o=!1;const a=[],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"&&!tc(r))&&(r=String(r)),i&&o?a[a.length-1].$text$+=r:a.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,a,mv);const c=Eo(t,null);return c.$attrs$=e,a.length>0&&(c.$children$=a),c},Eo=(t,e)=>({$flags$:0,$tag$:t,$text$:e,$elm$:null,$children$:null,$attrs$:null}),pv={},mv={forEach:(t,e)=>t.map(gu).forEach(e),map:(t,e)=>t.map(gu).map(e).map(gv)},gu=t=>({vattrs:t.$attrs$,vchildren:t.$children$,vkey:t.$key$,vname:t.$name$,vtag:t.$tag$,vtext:t.$text$}),gv=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},No=t=>wn(t).$hostElement$,Sn=(t,e,n)=>{const r=No(t);return{emit:i=>
34jf(r,e,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:i})}},jf=(t,e,n)=>{const r=$e.ce(e,n);return t.dispatchEvent(r),r},yu=new WeakMap,yv=t=>{const e=t.$cmpMeta$,n=t.$hostElement$,r=e.$flags$;e.$tagName$;const i=((o,a,s)=>{var c;const l=Kf(a),u=qi.get(l);if(o=o.nodeType===11?o:Lt,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=Lt.createElement("style"),d.innerHTML=u;const f=(c=$e.$nonce$)!=null?c:Bf(Lt);if(f!=null&&d.setAttribute("nonce",f),!(1&a.$flags$))if(o.nodeName==="HEAD"){const g=o.querySelectorAll("link[rel=preconnect]"),m=g.length>0?g[g.length-1].nextSibling:o.querySelector("style");o.insertBefore(d,m)}else if("host"in o)if(Lf){const g=new CSSStyleSheet;g.replaceSync(u),o.adoptedStyleSheets=[g,...o.adoptedStyleSheets]}else{const g=o.querySelector("style");g?g.innerHTML=u+g.innerHTML:o.prepend(d)}else o.append(d);1&a.$flags$&&o.nodeName!=="HEAD"&&o.insertBefore(d,null)}4&a.$flags$&&(d.innerHTML+=Nf),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"))},Kf=(t,e)=>"sc-"+t.$tagName$,vu=(t,e,n,r,i,o)=>{if(n!==r){let a=hu(t,e),s=e.toLowerCase();if(e==="class"){const c=t.classList,l=bu(n),u=bu(r);c.remove(...l.filter(d=>d&&!u.includes(d))),c.add(...u.filter(d=>d&&!l.includes(d)))}else if(e==="style"){for(const c in n)r&&r[c]!=null||(c.includes("-")?t.style.removeProperty(c):t.style[c]="");for(const c in r)n&&r[c]===n[c]||(c.includes("-")?t.style.setProperty(c,r[c]):t.style[c]=r[c])}else if(a||e[0]!=="o"||e[1]!=="n"){const c=tc(r);if((a||c&&r!==null)&&!i)try{if(t.tagName.includes("-"))t[e]=r;else{const l=r??"";e==="list"?a=!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):(!a||4&o||i)&&!c&&(r=r===!0?"":r,t.setAttribute(e,r))}else if(e=e[2]==="-"?e.slice(3):hu(Io,s)?s.slice(2):s[2]+e.slice(3),n||r){const c=e.endsWith(Uf);e=e.replace(bv,""),n&&$e.rel(t,e,n,c),r&&$e.ael(t,e,r,c)}}},vv=/\s/,bu=t=>t?t.split(vv):[],Uf="Capture",bv=new RegExp(Uf+"$"),Hf=(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 a of wu(Object.keys(i)))a in o||vu(r,a,i[a],void 0,n,e.$flags$);for(const a of wu(Object.keys(o)))vu(r,a,i[a],o[a],n,e.$flags$)};function wu(t){return t.includes("ref")?[...t.filter(e=>e!=="ref"),"ref"]:t}var Ff=!1,gt=!1,rc=(t,e,n,r)=>{const i=e.$children$[n];let o,a,s=0;if(i.$text$!==null)o=i.$elm$=Lt.createTextNode(i.$text$);else{if(gt||(gt=i.$tag$==="svg"),o=i.$elm$=Lt.createElementNS(gt?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",!Ff&&sv&&2&i.$flags$?"slot-fb":i.$tag$),gt&&i.$tag$==="foreignObject"&&(gt=!1),Hf(null,i,gt),o.getRootNode().querySelector("body")&&ov&&(c=>c!=null)(Vi)&&o["s-si"]!==Vi&&o.classList.add(o["s-si"]=Vi),i.$children$)for(s=0;s<i.$children$.length;++s)a=rc(t,i,s),a&&o.appendChild(a);i.$tag$==="svg"?gt=!1:o.tagName==="foreignObject"&&(gt=!0)}return o["s-hn"]=nc,o},Eu=(t,e,n,r,i,o)=>{let a,s=t;for(s.shadowRoot&&s.tagName===nc&&(s=s.shadowRoot);i<=o;++i)r[i]&&(a=rc(null,n,i),a&&(r[i].$elm$=a,Wi(s,a,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()}}},Ci=(t,e,n=!1)=>t.$tag$===e.$tag$,Cr=(t,e,n=!1)=>{const r=e.$elm$=t.$elm$,i=t.$children$,o=e.$children$,a=e.$tag$,s=e.$text$;s===null?(Hf(t,e,gt=a==="svg"||a!=="foreignObject"&>),i!==null&&o!==null?((c,l,u,d,h=!1)=>{let f,g=0,m=0,w=l.length-1,p=l[0],S=l[w],_=d.length-1,O=d[0],I=d[_];for(;g<=w&&m<=_;)p==null?p=l[++g]:S==null?S=l[--w]:O==null?O=d[++m]:I==null?I=d[--_]:Ci(p,O,h)?(Cr(p,O,h),p=l[++g],O=d[++m]):Ci(S,I,h)?(Cr(S,I,h),S=l[--w],I=d[--_]):Ci(p,I,h)?(Cr(p,I,h),Wi(c,p.$elm$,S.$elm$.nextSibling),p=l[++g],I=d[--_]):Ci(S,O,h)?(Cr(S,O,h),Wi(c,S.$elm$,p.$elm$),S=l[--w],O=d[++m]):(f=rc(l&&l[m],u,m),O=d[++m],f&&Wi(p.$elm$.parentNode,f,p.$elm$));g>w?Eu(c,d[_+1]==null?null:d[_+1].$elm$,u,d,m,_):m>_&&_u(l,g,w)})(r,i,e,o,n):o!==null?(t.$text$!==null&&(r.textContent=""),Eu(r,null,e,o,0,o.length-1)):!n&&av&&i!==null&&_u(i,0,i.length-1),gt&&a==="svg"&&(gt=!1)):t.$text$!==s&&(r.data=s)},Wi=(t,e,n)=>t==null?void 0:t.insertBefore(e,n),wv=(t,e,n=!1)=>{const r=t.$hostElement$,i=t.$cmpMeta$,o=t.$vnode$||Eo(null,null),a=(s=e)&&s.$tag$===pv?e:Y(null,null,e);var s;if(nc=r.tagName,n&&a.$attrs$)for(const c of Object.keys(a.$attrs$))r.hasAttribute(c)&&!["key","ref","style","class"].includes(c)&&(a.$attrs$[c]=r[c]);a.$tag$=null,a.$flags$|=4,t.$vnode$=a,a.$elm$=o.$elm$=r.shadowRoot||r,Vi=r["s-sc"],Ff=(1&i.$flags$)!=0,Cr(o,a,n)},zf=(t,e)=>{e&&!t.$onRenderResolve$&&e["s-p"]&&e["s-p"].push(new Promise(n=>t.$onRenderResolve$=n))},ic=(t,e)=>(t.$flags$|=16,4&t.$flags$?void(t.$flags$|=512):(zf(t,t.$ancestorComponent$),uv(()=>Ev(t,e)))),Ev=(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()} />
34 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 _v(void 0,()=>Cv(t,r,e))},_v=(t,e)=>Sv(t)?t.then(e).catch(n=>{console.error(n),e()}):e(),Sv=t=>t instanceof Promise||t&&t.then&&typeof t.then=="function",Cv=async(t,e,n)=>{var r;const i=t.$hostElement$;t.$cmpMeta$.$tagName$;const o=i["s-rc"];n&&yv(t),t.$cmpMeta$.$tagName$,kv(t,e,i,n),o&&(o.map(a=>a()),i["s-rc"]=void 0);{const a=(r=i["s-p"])!=null?r:[],s=()=>Av(t);a.length===0?s():(Promise.all(a).then(s),t.$flags$|=4,a.length=0)}},kv=(t,e,n,r)=>{try{e=e.render(),t.$flags$&=-17,t.$flags$|=2,wv(t,e,r)}catch(i){Ln(i,t.$hostElement$)}return null},Av=t=>{t.$cmpMeta$.$tagName$;const e=t.$hostElement$,n=()=>{},r=t.$lazyInstance$,i=t.$ancestorComponent$;64&t.$flags$?n():(t.$flags$|=64,Vf(e),oc(r,"componentDidLoad"),t.$onReadyResolve$(e),i||qf()),t.$onRenderResolve$&&(t.$onRenderResolve$(),t.$onRenderResolve$=void 0),512&t.$flags$&&ec(()=>ic(t,!1)),t.$flags$&=-517},qf=t=>{Vf(Lt.documentElement),ec(()=>jf(Io,"appload",{detail:{namespace:"sdk-install-modal-web"}}))},oc=(t,e,n)=>{if(t&&t[e])try{return t[e](n)}catch(r){Ln(r)}},Vf=t=>{var e;return t.classList.add((e=iv)!=null?e:"hydrated")},xv=(t,e,n,r)=>{const i=wn(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$,a=i.$instanceValues$.get(e),s=i.$flags$,c=i.$lazyInstance$;var l,u;l=n,u=r.$members$[e][0],n=l==null||tc(l)?l:4&u?l!=="false"&&(l===""||!!l):1&u?String(l):l;const d=Number.isNaN(a)&&Number.isNaN(n);if((!(8&s)||a===void 0)&&n!==a&&!d&&(i.$instanceValues$.set(e,n),c)){if(r.$watchers$&&128&s){const h=r.$watchers$[e];h&&h.map(f=>{try{c[f](n,a,e)}catch(g){Ln(g,o)}})}(18&s)==2&&ic(i,!1)}},Wf=(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 a=Object.entries((r=e.$members$)!=null?r:{});if(a.map(([s,[c]])=>{(31&c||2&n&&32&c)&&Object.defineProperty(o,s,{get(){return l=s,wn(this).$instanceValues$.get(l);var l},set(l){xv(this,s,l,e)},configurable:!0,enumerable:!0})}),1&n){const s=new Map;o.attributeChangedCallback=function(c,l,u){$e.jmp(()=>{var d;const h=s.get(c);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=wn(this),g=f==null?void 0:f.$flags$;if(g&&!(8&g)&&128&g&&u!==l){const m=f.$lazyInstance$,w=(d=e.$watchers$)==null?void 0:d[c];w==null||w.forEach(p=>{m[p]!=null&&m[p].call(m,u,l,c)})}return}}this[h]=(u!==null||typeof this[h]!="boolean")&&u})},t.observedAttributes=Array.from(new Set([...Object.keys((i=e.$watchers$)!=null?i:{}),...a.filter(([c,l])=>15&l[0]).map(([c,l])=>{const u=l[1]||c;return s.set(u,c),u})]))}}return t},Tv=async(t,e,n,r)=>{let i;if(!(32&e.$flags$)){if(e.$flags$|=32,n.$lazyBundleId$){const s=((c,l,u)=>{const d=c.$tagName$.replace(/-/g,"_"),h=c.$lazyBundleId$;if(!h)return;const f=ks.get(h);if(f)return f[d];{const g=m=>(ks.set(h,m),m[d]);if(h==="mm-install-modal_3")return Promise.resolve().then(function(){return Fv}).then(g,Ln)}return a0(()=>import(`./${h}.entry.js`),[]).then(g=>(ks.set(h,g),g[d]),Ln)})(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,Wf(i,n,2),i.isProxied=!0),n.$tagName$,e.$flags$|=8;try{new i(e)}catch(c){Ln(c)}e.$flags$&=-9,e.$flags$|=128,ma(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 c=Kf(n);qi.has(c)||(n.$tagName$,((l,u,d)=>{let h=qi.get(l);Lf&&d?(h=h||new CSSStyleSheet,typeof h=="string"?h=u:h.replaceSync(u)):h=u,qi.set(l,h)})(c,s,!!(1&n.$flags$)))}}const o=e.$ancestorComponent$,a=()=>ic(e,!0);o&&o["s-rc"]?o["s-rc"].push(a):a()},ma=t=>{oc(t,"connectedCallback")},Su=t=>{oc(t,"disconnectedCallback")},Mv=(t,e={})=>{var n;const r=[],i=e.exclude||[],o=Io.customElements,a=Lt.head,s=a.querySelector("meta[charset]"),c=Lt.createElement("style"),l=[];let u,d=!0;Object.assign($e,e),$e.$resourcesUrl$=new URL(e.resourcesUrl||"./",Lt.baseURI).href;let h=!1;if(t.map(f=>{f[1].map(g=>{var m;const w={$flags$:g[0],$tagName$:g[1],$members$:g[2],$listeners$:g[3]};4&w.$flags$&&(h=!0),w.$members$=g[2],w.$watchers$=(m=g[4])!=null?m:{};const p=w.$tagName$,S=class extends HTMLElement{constructor(_){if(super(_),this.hasRegisteredEventListeners=!1,((O,I)=>{const j={$flags$:0,$hostElement$:O,$cmpMeta$:I,$instanceValues$:new Map};j.$onReadyPromise$=new Promise(q=>j.$onReadyResolve$=q),O["s-p"]=[],O["s-rc"]=[],Xa.set(O,j)})(_=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(){wn(this),this.hasRegisteredEventListeners||(this.hasRegisteredEventListeners=!0),u&&(clearTimeout(u),u=null),d?l.push(this):$e.jmp(()=>(_=>{if(!(1&$e.$flags$)){const O=wn(_),I=O.$cmpMeta$;if(I.$tagName$,1&O.$flags$)O!=null&&O.$lazyInstance$?ma(O.$lazyInstance$):O!=null&&O.$onReadyPromise$&&O.$onReadyPromise$.then(()=>ma(O.$lazyInstance$));else{O.$flags$|=1;{let j=_;for(;j=j.parentNode||j.host;)if(j["s-p"]){zf(O,O.$ancestorComponent$=j);break}}I.$members$&&Object.entries(I.$members$).map(([j,[q]])=>{if(31&q&&_.hasOwnProperty(j)){const F=_[j];delete _[j],_[j]=F}}),Tv(_,O,I)}}})(this))}disconnectedCallback(){$e.jmp(()=>(async _=>{if(!(1&$e.$flags$)){const O=wn(_);O!=null&&O.$lazyInstance$?Su(O.$lazyInstance$):O!=null&&O.$onReadyPromise$&&O.$onReadyPromise$.then(()=>Su(O.$lazyInstance$))}})(this))}componentOnReady(){return wn(this).$onReadyPromise$}};w.$lazyBundleId$=f[0],i.includes(p)||o.get(p)||(r.push(p),o.define(p,Wf(S,w,1)))})}),r.length>0&&(h&&(c.textContent+=Nf),c.textContent+=r.sort()+"{visibility:hidden}.hydrated{visibility:inherit}",c.innerHTML.length)){c.setAttribute("data-styles","");const f=(n=$e.$nonce$)!=null?n:Bf(Lt);f!=null&&c.setAttribute("nonce",f),a.insertBefore(c,s?s.nextSibling:a.firstChild)}d=!1,l.length?l.map(f=>f.connectedCallback()):$e.jmp(()=>u=setTimeout(qf,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 Rv=Object.freeze({__proto__:null,defineCustomElements:async(t,e)=>{if(typeof window<"u")return await void 0,Mv([["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=>$e.$nonce$=t});const Ov={fontFamily:"Roboto, sans-serif"},sc=({className:t},e)=>Y("div",{style:Ov,class:t},e),As=({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))),Pv=()=>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.5502
34C15.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"})),Iv=()=>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"})),Nv=()=>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"})),Lv=()=>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 ac({version:t}){return Y("div",{style:{textAlign:"center",color:"#BBC0C5",fontSize:"12"}},"SDK Version ",t?`v${t}`:"unknown")}const cc=()=>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"})),lc=()=>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
34-.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 Tn(t,e){return t.toString(2).padStart(e,"0")}function Cu(t,e){const n=t%e;return n>=0?n:e+n}function at(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 ot{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 a of n){const s=a.split("").map(c=>{if(c==="X")return!0;if(c===" ")return!1;if(c!=="?")throw new Error(`Bitmap.fromString: unknown symbol=${c}`)});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 ot({height:r,width:o},i)}constructor(e,n){const{height:r,width:i}=ot.size(e);this.data=n||Array.from({length:r},()=>at(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:a,width:s}=ot.size(n,this.size({x:i,y:o}));for(let c=0;c<a;c++)for(let l=0;l<s;l++)this.data[o+c][i+l]=typeof r=="function"?r({x:l,y:c},this.data[o+c][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=at(e,n),a=Array.from({length:e},()=>at(i,n));return new ot({height:r,width:i},[...a,...this.data.map(s=>[...o,...s,...o]),...a])}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 ot(ot.size(n,this.size(this.xy(e))));return this.rect(e,n,({x:i,y:o},a)=>r.data[o][i]=a),r}inverse(){const{height:e,width:n}=this;return new ot({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 ot({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 ot(this.size()).rect({x:0,y:0},this.size(),({x:e,y:n})=>this.data[n][e])}
35assertDrawn(){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 a=0;a<n;a++){const s=r[o][a],c=o+1>=e||r[o+1][a];s||c?!s&&c?i+="â":s&&!c?i+="â":s&&c&&(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,c)=>r.push(+(c===!0)));const i=126,o=[71,73,70,56,55,97,...n,246,0,0,255,255,255,...at(381,0),44,0,0,0,0,...n,0,7],a=Math.floor(r.length/i);for(let s=0;s<a;s++)o.push(127,128,...r.slice(i*s,i*(s+1)).map(c=>+c));return o.push(r.length%i+1,128,...r.slice(a*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 a=0;a<n;a++)for(let s=0;s<r;s++){const c=this.data[a][s]?0:255;i[o++]=c,i[o++]=c,i[o++]=c,e||(i[o++]=255)}return{height:n,width:r,data:i}}}const Tu=["low","medium","quartile","high"],Mu=["numeric","alphanumeric","byte","kanji","eci"],Dv=[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],Bv={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]},$v={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]},qe={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=qe.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 a=1;a<r;a++)o.push(e-(r-a)*i);return o.push(e),o},ECCode:{low:1,medium:0,quartile:3,high:2},formatMask:21522,formatBits(t,e){const n=qe.ECCode[t]<<3|e;let r=n;for(let i=0;i<10;i++)r=r<<1^1335*(r>>9);return(n<<10|r)^qe.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][qe.sizeType(t)],modeBits:{numeric:"0001",alphanumeric:"0010",byte:"0100",kanji:"1000",eci:"0111"},capacity(t,e){const n=Dv[t-1],r=Bv[e][t-1],i=$v[e][t-1],o=Math.floor(n/i)-r,a=i-n%i;return{words:r,numBlocks:i,shortBlocks:a,blockLen:o,capacity:8*(n-r*i),total:(r+o)*i+i-a}}},ga=[(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],oe={tables:(t=>{const e=at(256,0),n=at(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=>oe.tables.exp[t],log(t){if(t===0)throw new Error(`GF.log: wrong arg=${t}`);return oe.tables.log[t]%255},mul:(t,e)=>t===0||e===0?0:oe.tables.exp[(oe.tables.log[t]+oe.tables.log[e])%255],add:(t,e)=>t^e,pow:(t,e)=>oe.tables.exp[oe.tables.log[t]*e%255],inv(t){if(t===0)throw new Error(`GF.inverse: wrong arg=${t}`);return oe.tables.exp[255-oe.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=at(t+1,0);return n[0]=e,oe.polynomial(n)},degree:t=>t.length-1,coefficient:(t,e)=>t[oe.degree(t)-e],mulPoly(t,e){if(t[0]===0||e[0]===0)return[0];const n=at(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]=oe.add(n[r+i],oe.mul(t[r],e[i]));return oe.polynomial(n)},mulPolyScalar(t,e){if(e==0)return[0];if(e==1)return t;const n=at(t.length,0);for(let r=0;r<t.length;r++)n[r]=oe.mul(t[r],e);return oe.polynomial(n)},mulPolyMonomial(t,e,n){if(e<0)throw new Error("GF.mulPolyMonomial: wrong degree");if(n==0)return[0];const r=at(t.length+e,0);for(let i=0;i<t.length;i++)r[i]=oe.mul(t[i],n);return oe.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=at(r.length,0),o=r.length-n.length,a=r.slice(0,o);for(let s=0;s<a.length;s++)i[s]=a[s];for(let s=o;s<r.length;s++)i[s]=oe.add(n[s-o],r[s]);return oe.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]=oe.add(n[r+o],oe.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=oe.mulPoly(e,[1,oe.pow(2,n)]);return e},evalPoly(t,e){if(e==0)return oe.coefficient(t,0);let n=t[0];for(let r=1;r<t.length;r++)n=oe.add(oe.mul(e,n),t[r]);return n},euclidian(t,e,n){oe.degree(t)<oe.degree(e)&&([t,e]=[e,t]);let r=t,i=e,o=[0],a=[1];for(;2*oe.degree(i)>=n;){let l=r,u=o;if(r=i,o=a,r[0]===0)throw new Error("rLast[0] === 0");i=l;let d=[0];const h=oe.inv(r[0]);for(;oe.degree(i)>=oe.degree(r)&&i[0]!==0;){const f=oe.degree(i)-oe.degree(r),g=oe.mul(i[0],h);d=oe.addPoly(d,oe.monomial(f,g)),i=oe.addPoly(i,oe.mulPolyMonomial(r,f,g))}if(d=oe.mulPoly(d,o),a=oe.addPoly(d,u),oe.degree(i)>=oe.degree(r))throw new Error(`Division failed r: ${i}, rLast: ${r}`)}const s=oe.coefficient(a,0);if(s==0)throw new Error("sigmaTilde(0) was zero");const c=oe.inv(s);return[oe.mulPolyScalar(a,c),oe.mulPolyScalar(i,c)]}};function jv(t,e){const{words:n,shortBlocks:r,numBlocks:i,blockLen:o,total:a}=qe.capacity(t,e),s=(c=n,{encode(l){const u=oe.divisorPoly(c),d=Array.from(l);return d.push(...u.slice(0,-1).fill(0)),Uint8Array.from(oe.remainderPoly(d,u))},decode(l){const u=l.slice(),d=oe.polynomial(Array.from(l));let h=at(c,0),f=!1;for(let _=0;_<c;_++){const O=oe.evalPoly(d,oe.exp(_));h[h.length-1-_]=O,O!==0&&(f=!0)}if(!f)return u;h=oe.polynomial(h);const g=oe.monomial(c,1),[m,w]=oe.euclidian(g,h,c),p=at(oe.degree(m),0);let S=0;for(let _=1;_<256&&S<p.length;_++)oe.evalPoly(m,_)===0&&(p[S++]=oe.inv(_));if(S!==p.length)throw new Error("RS.decode: wrong errors number");for(let _=0;_<p.length;_++){const O=u.length-1-oe.log(p[_]);if(O<0)throw new Error("RS.decode: wrong error location");const I=oe.inv(p[_]);let j=1;for(let q=0;q<p.length;q++)_!==q&&(j=oe.mul(j,oe.add(1,oe.mul(p[q],I))));u[O]=oe.add(u[O],oe.mul(oe.evalPoly(w,I),oe.inv(j)))}return u}});var c;return{encode(l){const u=[],d=[];for(let m=0;m<i;m++){const w=o+(m<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),g=new Uint8Array(h.length+f.length);return g.set(h),g.set(f,h.length),g},decode(l){if(l.length!==a)throw new Error(`interleave.decode: len(data)=${l.length}, total=${a}`);const u=[];for(let f=0;f<i;f++){const g=f<r;u.push(new Uint8Array(n+o+(g?0:1)))}let d=0;for(let f=0;f<o;f++)for(let g=0;g<i;g++)u[g][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 g=0;g<i;g++){const m=g<r;u[g][f+(m?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=qe.alphabet.numeric.decode(n.split("")),h=d.length;for(let f=0;f<h-2;f+=3)i+=Tn(100*d[f]+10*d[f+1]+d[f+2],10);h%3==1?i+=Tn(d[h-1],4):h%3==2&&(i+=Tn(10*d[h-2]+d[h-1],7))}
38else if(r==="alphanumeric"){const d=qe.alphabet.alphanumerc.decode(n.split("")),h=d.length;for(let f=0;f<h-1;f+=2)i+=Tn(45*d[f]+d[f+1],11);h%2==1&&(i+=Tn(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=>Tn(h,8)).join("")}}const{capacity:a}=qe.capacity(t,e),s=Tn(o,qe.lengthBits(t,r));let c=qe.modeBits[r]+s+i;if(c.length>a)throw new Error("Capacity overflow");c+="0".repeat(Math.min(4,Math.max(0,a-c.length))),c.length%8&&(c+="0".repeat(8-c.length%8));const l="1110110000010001";for(let d=0;c.length!==a;d++)c+=l[d%16];const u=Uint8Array.from(c.match(/(.{8})/g).map(d=>+`0b${d}`));return jv(t,e).encode(u)}function Ou(t,e,n,r,i=!1){const o=function(c,l,u,d=!1){const h=qe.size.encode(c);let f=new ot(h+2);const g=new ot(3).rect(0,3,!0).border(1,!1).border(1,!0).border(1,!1);f=f.embed(0,g).embed({x:-g.width,y:0},g).embed({x:0,y:-g.height},g),f=f.rectSlice(1,h);const m=new ot(1).rect(0,1,!0).border(1,!1).border(1,!0),w=qe.alignmentPatterns(c);for(const p of w)for(const S of w)f.data[p][S]===void 0&&f.embed({x:S-2,y:p-2},m);f=f.hLine({x:0,y:6},1/0,({x:p},S)=>S===void 0?p%2==0:S).vLine({x:6,y:0},1/0,({y:p},S)=>S===void 0?p%2==0:S);{const p=qe.formatBits(l,u),S=_=>!d&&(p>>_&1)==1;for(let _=0;_<6;_++)f.data[_][8]=S(_);for(let _=6;_<8;_++)f.data[_+1][8]=S(_);for(let _=8;_<15;_++)f.data[h-15+_][8]=S(_);for(let _=0;_<8;_++)f.data[8][h-_-1]=S(_);for(let _=8;_<9;_++)f.data[8][15-_-1+1]=S(_);for(let _=9;_<15;_++)f.data[8][15-_-1]=S(_);f.data[h-8][8]=!d}if(c>=7){const p=qe.versionBits(c);for(let S=0;S<18;S+=1){const _=!d&&(p>>S&1)==1,O=Math.floor(S/3),I=S%3+h-8-3;f.data[O][I]=_,f.data[I][O]=_}}return f}(t,e,r,i);let a=0;const s=8*n.length;if(function(c,l,u){const d=c.height,h=ga[l];let f=-1,g=d-1;for(let m=d-1;m>0;m-=2){for(m==6&&(m=5);;g+=f){for(let w=0;w<2;w+=1){const p=m-w;c.data[g][p]===void 0&&u(p,g,h(p,g))}if(g+f<0||g+f>=d)break}f=-f}}(o,r,(c,l,u)=>{let d=!1;a<s&&(d=(n[a>>>3]>>(7-a&7)&1)!=0,a++),o.data[l][c]=d!==u}),a!==s)throw new Error("QR: bytes left after draw");return o}function Kv(t){const e=t.inverse(),n=f=>{let g=0;for(let m,w=0,p=1;w<f.length;w++)m===f[w]&&(p++,w!==f.length-1)||(p>=5&&(g+=p-5+3),m=f[w],p=1);return g};let r=0;t.data.forEach(f=>r+=n(f)),e.data.forEach(f=>r+=n(f));let i=0,o=t.data;const a=t.width-1,s=t.height-1;for(let f=0;f<a;f++)for(let g=0;g<s;g++){const m=f+1,w=g+1;o[f][g]===o[m][g]&&o[m][g]===o[f][w]&&o[m][g]===o[m][w]&&(i+=3)}const c=f=>{const g=[!0,!1,!0,!0,!0,!1,!0],m=[!1,!1,!1,!1],w=[...g,...m],p=[...m,...g];let S=0;for(let _=0;_<f.length;_++)Au(f,w,_)&&(S+=40),Au(f,p,_)&&(S+=40);return S};let l=0;for(const f of t.data)l+=c(f);for(const f of e.data)l+=c(f);let u=0;t.rectRead(0,1/0,(f,g)=>u+=g?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 Gf(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(!qe.alphabet.numeric.has(h)&&(d="alphanumeric",!qe.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)||!ga[u])throw new Error(`Invalid mask=${u}. Expected number [0..7]`)}(n.mask);let o,a=n.version,s=new Error("Unknown error");if(a!==void 0)(function(u){if(!Number.isSafeInteger(u)||u<1||u>40)throw new Error(`Invalid version=${u}. Expected number [1..40]`)})(a),o=Ru(a,r,t,i);else for(let u=1;u<=40;u++)try{o=Ru(u,r,t,i),a=u;break}catch(d){s=d}if(!a||!o)throw s;let c=function(u,d,h,f){if(f===void 0){const g=function(){let m,w=1/0;return{add(p,S){p>=w||(m=S,w=p)},get:()=>m,score:()=>w}}();for(let m=0;m<ga.length;m++)g.add(Kv(Ou(u,d,h,m,!0)),m);f=g.get()}if(f===void 0)throw new Error("Cannot find mask");return Ou(u,d,h,f)}(a,r,o,n.mask);c.assertDrawn();const l=n.border===void 0?2:n.border;if(!Number.isSafeInteger(l))throw new Error("Wrong border type="+typeof l);if(c=c.border(l,!1),n.scale!==void 0&&(c=c.scale(n.scale)),e==="raw")return c.data;if(e==="ascii")return c.toASCII();if(e==="svg")return c.toSVG();if(e==="gif")return c.toGIF();if(e==="term")return c.toTerm();throw new Error(`Unknown output: ${e}`)}const xs={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 uc{constructor(e){var n;this.translations=xs,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=xs}else this.translations=xs}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 Pr;(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"})(Pr||(Pr={}));const Yf=class{constructor(t){Qa(this,t),this.close=Sn(this,"close",7),this.startDesktopOnboarding=Sn(this,"startDesktopOnboarding",7),this.trackAnalytics=Sn(this,"trackA
38nalytics",7),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 uc}componentDidLoad(){this.trackAnalytics.emit({event:Pr.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:Pr.SDK_MODAL_BUTTON_CLICKED,params:{button_type:"install_extension",tab:"desktop"}}),this.startDesktopOnboarding.emit()}setTab(t,e=!1){e&&this.trackAnalytics.emit({event:Pr.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=Gf(this.link,"svg",{ecc:"medium",scale:2});return Y(sc,{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(cc,null)))),Y("div",{class:"logoContainer"},Y(lc,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(As,{Icon:Iv,text:t("INSTALL_MODAL.TRUSTED_BY_USERS")})),Y("div",{class:"item"},Y(As,{Icon:Pv,text:t("INSTALL_MODAL.LEADING_CRYPTO_WALLET")})),Y("div",{class:"item"},Y(As,{Icon:Nv,text:t("INSTALL_MODAL.CONTROL_DIGITAL_INTERACTIONS")})),Y("button",{class:"button",onClick:()=>this.onStartDesktopOnboardingHandler()},Y(Lv,null),Y("span",{class:"installExtensionText"},t("INSTALL_MODAL.INSTALL_META_MASK_EXTENSION"))))),Y(ac,{version:this.sdkVersion})))}get el(){return No(this)}static get watchers(){return{preferDesktop:["updatePreferDesktop"]}}};Yf.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 Zf=class{constructor(t){Qa(this,t),this.close=Sn(this,"close",7),this.disconnect=Sn(this,"disconnect",7),this.updateOTPValue=Sn(this,"updateOTPValue",7),this.displayOTP=void 0,this.sdkVersion=void 0,this.otpCode=void 0,this.translationsLoaded=!1,this.i18nInstance=new uc}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(sc,{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(cc,null)))),Y("div",{class:"logoContainer"},Y(lc,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(ac,{version:n})))}get el(){return No(this)}};Zf.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 Uv=()=>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"})),Hv=()=>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"})),Jf=class{constructor(t){Qa(this,t),this.close=Sn(this,"close",7),this.connectWithExtension=Sn(this,"connectWithExtension",7),this.link=void 0,this.sdkVersion=void 0,this.preferDesktop=void 0,this.tab=1,this.isDefaultTab=!0,this.translationsLoaded=!1,this.i18nInstance=new uc,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})}
374connectWithExtensionHandler(){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=Gf(this.link,"svg",{ecc:"medium",scale:2});return Y(sc,{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(cc,null)))),Y("div",{class:"logoContainer"},Y(lc,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(Hv,null)),Y("div",{class:"extensionLabel"},t("SELECT_MODAL.CRYPTO_TAKE_CONTROL_TEXT")),Y("button",{class:"button",onClick:()=>this.connectWithExtensionHandler()},Y(Uv,null),Y("span",{class:"installExtensionText"},t("CONNECT_WITH_EXTENSION"))))),Y(ac,{version:e})))}get el(){return No(this)}static get watchers(){return{preferDesktop:["updatePreferDesktop"]}}};Jf.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 Fv=Object.freeze({__proto__:null,mm_install_modal:Yf,mm_pending_modal:Zf,mm_select_modal:Jf});export{Dn as CommunicationLayerPreference,je as ConnectionStatus,sr as DEFAULT_SERVER_URL,te as EventType,Ae as MessageType,Wv as MetaMaskSDK,et as MetaMaskSDKEvent,$t as PROVIDER_UPDATE_TYPE,ze as PlatformType,My as SDKProvider,Wv as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.