PageSourceSearch

https://fhepayroll.netlify.app/assets/metamask-sdk-BeLw3A6p.js

js fhepayroll.netlify.app collected 2026-10-03 10:44:02 UTC 555,241 bytes, 536 lines download raw bytes

vendor: 10,603 bytes, lines 1-2
1import{m as Qr,n as pa,_ as Vf}from"./index-DUmKJXH-.js";var ei={exports:{}},sc;function Wf(){return sc||(sc=1,(function(t,e){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Qr<"u"&&Qr,r=(function(){function o(){this.fetch=!1,this.DOMException=n.DOMException}return o.prototype=n,new o})();(function(o){(function(c){var s=typeof o<"u"&&o||typeof self<"u"&&self||typeof Qr<"u"&&Qr||{},a={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&(function(){try{return new Blob,!0}catch{return!1}})(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function l(S){return S&&DataView.prototype.isPrototypeOf(S)}if(a.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(S){return S&&u.indexOf(Object.prototype.toString.call(S))>-1};function h(S){if(typeof S!="string"&&(S=String(S)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(S)||S==="")throw new TypeError('Invalid character in header field name: "'+S+'"');return S.toLowerCase()}function f(S){return typeof S!="string"&&(S=String(S)),S}function m(S){var I={next:function(){var j=S.shift();return{done:j===void 0,value:j}}};return a.iterable&&(I[Symbol.iterator]=function(){return I}),I}function g(S){this.map={},S instanceof g?S.forEach(function(I,j){this.append(j,I)},this):Array.isArray(S)?S.forEach(function(I){if(I.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+I.length);this.append(I[0],I[1])},this):S&&Object.getOwnPropertyNames(S).forEach(function(I){this.append(I,S[I])},this)}g.prototype.append=function(S,I){S=h(S),I=f(I);var j=this.map[S];this.map[S]=j?j+", "+I:I},g.prototype.delete=function(S){delete this.map[h(S)]},g.prototype.get=function(S){return S=h(S),this.has(S)?this.map[S]:null},g.prototype.has=function(S){return this.map.hasOwnProperty(h(S))},g.prototype.set=function(S,I){this.map[h(S)]=f(I)},g.prototype.forEach=function(S,I){for(var j in this.map)this.map.hasOwnProperty(j)&&S.call(I,this.map[j],j,this)},g.prototype.keys=function(){var S=[];return this.forEach(function(I,j){S.push(j)}),m(S)},g.prototype.values=function(){var S=[];return this.forEach(function(I){S.push(I)}),m(S)},g.prototype.entries=function(){var S=[];return this.forEach(function(I,j){S.push([j,I])}),m(S)},a.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function w(S){if(!S._noBody){if(S.bodyUsed)return Promise.reject(new TypeError("Already read"));S.bodyUsed=!0}}function p(S){return new Promise(function(I,j){S.onload=function(){I(S.result)},S.onerror=function(){j(S.error)}})}function C(S){var I=new FileReader,j=p(I);return I.readAsArrayBuffer(S),j}function _(S){var I=new FileReader,j=p(I),y=/charset=([A-Za-z0-9_-]+)/.exec(S.type),E=y?y[1]:"utf-8";return I.readAsText(S,E),j}function O(S){for(var I=new Uint8Array(S),j=new Array(I.length),y=0;y<I.length;y++)j[y]=String.fromCharCode(I[y]);return j.join("")}function L(S){if(S.slice)return S.slice(0);var I=new Uint8Array(S.byteLength);return I.set(new Uint8Array(S)),I.buffer}function U(){return this.bodyUsed=!1,this._initBody=function(S){this.bodyUsed=this.bodyUsed,this._bodyInit=S,S?typeof S=="string"?this._bodyText=S:a.blob&&Blob.prototype.isPrototypeOf(S)?this._bodyBlob=S:a.formData&&FormData.prototype.isPrototypeOf(S)?this._bodyFormData=S:a.searchParams&&URLSearchParams.prototype.isPrototypeOf(S)?this._bodyText=S.toString():a.arrayBuffer&&a.blob&&l(S)?(this._bodyArrayBuffer=L(S.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(S)||d(S))?this._bodyArrayBuffer=L(S):this._bodyText=S=Object.prototype.toString.call(S):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof S=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):a.searchParams&&URLSearchParams.prototype.isPrototypeOf(S)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a.blob&&(this.blob=function(){var S=w(this);if(S)return S;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var S=w(this);return S||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(a.blob)return this.blob().then(C);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var S=w(this);if(S)return S;if(this._bodyBlob)return _(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(O(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a.formData&&(this.formData=function(){return this.text().then(N)}),this.json=function(){return this.text().then(JSON.parse)},this}var q=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function F(S){var I=S.toUpperCase();return q.indexOf(I)>-1?I:S}function B(S,I){if(!(this instanceof B))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');I=I||{};var j=I.body;if(S instanceof B){if(S.bodyUsed)throw new TypeError("Already read");this.url=S.url,this.credentials=S.credentials,I.headers||(this.headers=new g(S.headers)),this.method=S.method,this.mode=S.mode,this.signal=S.signal,!j&&S._bodyInit!=null&&(j=S._bodyInit,S.bodyUsed=!0)}else this.url=String(S);if(this.credentials=I.credentials||this.credentials||"same-origin",(I.headers||!this.headers)&&(this.headers=new g(I.headers)),this.method=F(I.method||this.method||"GET"),this.mode=I.mode||this.mode||null,this.signal=I.signal||this.signal||(function(){if("AbortController"in s){var A=new AbortController;return A.signal}})(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&j)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(j),(this.method==="GET"||this.method==="HEAD")&&(I.cache==="no-store"||I.cache==="no-cache")){var y=/([?&])_=[^&]*/;if(y.test(this.url))this.url=this.url.replace(y,"$1_="+new Date().getTime());else{var E=/\?/;this.url+=(E.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}B.prototype.clone=function(){return new B(this,{body:this._bodyInit})};function N(S){var I=new FormData;return S.trim().split("&").forEach(function(j){if(j){var y=j.split("="),E=y.shift().replace(/\+/g," "),A=y.join("=").replace(/\+/g," ");I.append(decodeURIComponent(E),decodeURIComponent(A))}}),I}function H(S){var I=new g,j=S.replace(/\r?\n[\t ]+/g," ");return j.split("\r").map(function(y){return y.indexOf(`
2`)===0?y.substr(1,y.length):y}).forEach(function(y){var E=y.split(":"),A=E.shift().trim();if(A){var T=E.join(":").trim();try{I.append(A,T)}catch(b){console.warn("Response "+b.message)}}}),I}U.call(B.prototype);function $(S,I){if(!(this instanceof $))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(I||(I={}),this.type="default",this.status=I.status===void 0?200:I.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=I.statusText===void 0?"":""+I.statusText,this.headers=new g(I.headers),this.url=I.url||"",this._initBody(S)}U.call($.prototype),$.prototype.clone=function(){return new $(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new g(this.headers),url:this.url})},$.error=function(){var S=new $(null,{status:200,statusText:""});return S.ok=!1,S.status=0,S.type="error",S};var P=[301,302,303,307,308];$.redirect=function(S,I){if(P.indexOf(I)===-1)throw new RangeError("Invalid status code");return new $(null,{status:I,headers:{location:S}})},c.DOMException=s.DOMException;try{new c.DOMException}catch{c.DOMException=function(I,j){this.message=I,this.name=j;var y=Error(I);this.stack=y.stack},c.DOMException.prototype=Object.create(Error.prototype),c.DOMException.prototype.constructor=c.DOMException}function M(S,I){return new Promise(function(j,y){var E=new B(S,I);if(E.signal&&E.signal.aborted)return y(new c.DOMException("Aborted","AbortError"));var A=new XMLHttpRequest;function T(){A.abort()}A.onload=function(){var k={statusText:A.statusText,headers:H(A.getAllResponseHeaders()||"")};E.url.indexOf("file://")===0&&(A.status<200||A.status>599)?k.status=200:k.status=A.status,k.url="responseURL"in A?A.responseURL:k.headers.get("X-Request-URL");var x="response"in A?A.response:A.responseText;setTimeout(function(){j(new $(x,k))},0)},A.onerror=function(){setTimeout(function(){y(new TypeError("Network request failed"))},0)},A.ontimeout=function(){setTimeout(function(){y(new TypeError("Network request timed out"))},0)},A.onabort=function(){setTimeout(function(){y(new c.DOMException("Aborted","AbortError"))},0)};function b(k){try{return k===""&&s.location.href?s.location.href:k}catch{return k}}if(A.open(E.method,b(E.url),!0),E.credentials==="include"?A.withCredentials=!0:E.credentials==="omit"&&(A.withCredentials=!1),"responseType"in A&&(a.blob?A.responseType="blob":a.arrayBuffer&&(A.responseType="arraybuffer")),I&&typeof I.headers=="object"&&!(I.headers instanceof g||s.Headers&&I.headers instanceof s.Headers)){var v=[];Object.getOwnPropertyNames(I.headers).forEach(function(k){v.push(h(k)),A.setRequestHeader(k,f(I.headers[k]))}),E.headers.forEach(function(k,x){v.indexOf(x)===-1&&A.setRequestHeader(x,k)})}else E.headers.forEach(function(k,x){A.setRequestHeader(x,k)});E.signal&&(E.signal.addEventListener("abort",T),A.onreadystatechange=function(){A.readyState===4&&E.signal.removeEventListener("abort",T)}),A.send(typeof E._bodyInit>"u"?null:E._bodyInit)})}return M.polyfill=!0,s.fetch||(s.fetch=M,s.Headers=g,s.Request=B,s.Response=$),c.Headers=g,c.Request=B,c.Response=$,c.fetch=M,c})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=n.fetch?n:r;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e}
vendor: 4,161 bytes, line 2
2)(ei,ei.exports)),ei.exports}var Gf=Wf();const Ou=pa(Gf);var ti={exports:{}},Do,ac;function Yf(){if(ac)return Do;ac=1;var t=1e3,e=t*60,n=e*60,r=n*24,i=r*7,o=r*365.25;Do=function(u,d){d=d||{};var h=typeof u;if(h==="string"&&u.length>0)return c(u);if(h==="number"&&isFinite(u))return d.long?a(u):s(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function c(u){if(u=String(u),!(u.length>100)){var d=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(d){var h=parseFloat(d[1]),f=(d[2]||"ms").toLowerCase();switch(f){case"years":case"year":case"yrs":case"yr":case"y":return h*o;case"weeks":case"week":case"w":return h*i;case"days":case"day":case"d":return h*r;case"hours":case"hour":case"hrs":case"hr":case"h":return h*n;case"minutes":case"minute":case"mins":case"min":case"m":return h*e;case"seconds":case"second":case"secs":case"sec":case"s":return h*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return h;default:return}}}}function s(u){var d=Math.abs(u);return d>=r?Math.round(u/r)+"d":d>=n?Math.round(u/n)+"h":d>=e?Math.round(u/e)+"m":d>=t?Math.round(u/t)+"s":u+"ms"}function a(u){var d=Math.abs(u);return d>=r?l(u,d,r,"day"):d>=n?l(u,d,n,"hour"):d>=e?l(u,d,e,"minute"):d>=t?l(u,d,t,"second"):u+" ms"}function l(u,d,h,f){var m=d>=h*1.5;return Math.round(u/h)+" "+f+(m?"s":"")}return Do}var Bo,cc;function Zf(){if(cc)return Bo;cc=1;function t(e){r.debug=r,r.default=r,r.coerce=l,r.disable=c,r.enable=o,r.enabled=s,r.humanize=Yf(),r.destroy=u,Object.keys(e).forEach(d=>{r[d]=e[d]}),r.names=[],r.skips=[],r.formatters={};function n(d){let h=0;for(let f=0;f<d.length;f++)h=(h<<5)-h+d.charCodeAt(f),h|=0;return r.colors[Math.abs(h)%r.colors.length]}r.selectColor=n;function r(d){let h,f=null,m,g;function w(...p){if(!w.enabled)return;const C=w,_=Number(new Date),O=_-(h||_);C.diff=O,C.prev=h,C.curr=_,h=_,p[0]=r.coerce(p[0]),typeof p[0]!="string"&&p.unshift("%O");let L=0;p[0]=p[0].replace(/%([a-zA-Z%])/g,(q,F)=>{if(q==="%%")return"%";L++;const B=r.formatters[F];if(typeof B=="function"){const N=p[L];q=B.call(C,N),p.splice(L,1),L--}return q}),r.formatArgs.call(C,p),(C.log||r.log).apply(C,p)}return w.namespace=d,w.useColors=r.useColors(),w.color=r.selectColor(d),w.extend=i,w.destroy=r.destroy,Object.defineProperty(w,"enabled",{enumerable:!0,configurable:!1,get:()=>f!==null?f:(m!==r.namespaces&&(m=r.namespaces,g=r.enabled(d)),g),set:p=>{f=p}}),typeof r.init=="function"&&r.init(w),w}function i(d,h){const f=r(this.namespace+(typeof h>"u"?":":h)+d);return f.log=this.log,f}function o(d){r.save(d),r.namespaces=d,r.names=[],r.skips=[];let h;const f=(typeof d=="string"?d:"").split(/[\s,]+/),m=f.length;for(h=0;h<m;h++)f[h]&&(d=f[h].replace(/\*/g,".*?"),d[0]==="-"?r.skips.push(new RegExp("^"+d.slice(1)+"$")):r.names.push(new RegExp("^"+d+"$")))}function c(){const d=[...r.names.map(a),...r.skips.map(a).map(h=>"-"+h)].join(",");return r.enable(""),d}function s(d){if(d[d.length-1]==="*")return!0;let h,f;for(h=0,f=r.skips.length;h<f;h++)if(r.skips[h].test(d))return!1;for(h=0,f=r.names.length;h<f;h++)if(r.names[h].test(d))return!0;return!1}function a(d){return d.toString().substring(2,d.toString().length-2).replace(/\.\*\?$/,"*")}function l(d){return d instanceof Error?d.stack||d.message:d}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}return Bo=t,Bo}var lc;function Jf(){return lc||(lc=1,(function(t,e){var n={};e.formatArgs=i,e.save=o,e.load=c,e.useColors=r,e.storage=s(),e.destroy=(()=>{let l=!1;return()=>{l||(l=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#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 c(){let l;try{l=e.storage.getItem("debug")}catch{}return!l&&typeof process<"u"&&"env"in process&&(l=n.DEBUG),l}function s(){try{return localStorage}catch{}}t.exports=Zf()(e);const{formatters:a}=t.exports;a.j=function(l){try{return JSON.stringify(l)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}})(ti,ti.exports)),ti.exports}var Xf=Jf();const Je=pa(Xf);var $o,uc;function Qf(){if(uc)return $o;uc=1;var t=Object.defineProperty,e=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,i=(B,N)=>{for(var H in N)t(B,H,{get:N[H],enumerable:!0})},o=(B,N,H,$)=>{if(N&&typeof N=="object"||typeof N=="function")for(let P of n(N))!r.call(B,P)&&P!==H&&t(B,P,{get:()=>N[P],enumerable:!($=e(N,P))||$.enumerable});return B},c=B=>o(t({},"__esModule",{value:!0}),B),s={};i(s,{createFinalURL:()=>U,createPathBasedClient:()=>g,createQuerySerializer:()=>_,default:()=>d,defaultBodySerializer:()=>L,defaultPathSerializer:()=>O,mergeHeaders:()=>q,randomID:()=>u,removeTrailingSlash:()=>F,serializeArrayParam:()=>C,serializeObjectParam:()=>p,serializePrimitiveParam:()=>w,wrapAsPathBasedClient:()=>m}),$o=c(s);var a=/\{[^{}]+\}/g,l=()=>typeof process=="object"&&Number.parseInt(process?.versions?.node?.substring(0,2))>=18&&process.versions.undici;function u(){return Math.random().toString(36).slice(2,11)}function d(B){let{baseUrl:N="",Request:H=globalThis.Request,fetch:$=globalThis.fetch,querySerializer:P,bodySerializer:M,headers:S,requestInitExt:I=void 0,...j}={...B};I=l()?I:void 0,N=F(N);const y=[];async function E(A,T){const{baseUrl:b,fetch:v=$,Request:k=H,headers:x,params:R={},parseAs:D="json",querySerializer:K,bodySerializer:z=M??L,body:V,...Z}=T||{};let Q=N;b&&(Q=F(b)??N);let ne=typeof P=="function"?P:_(P);K&&(ne=typeof K=="function"?K:_({...typeof P=="object"?P:{},...K}));const oe=V===void 0?void 0:z(V,q(S,x,R.header)),ue=q(oe===void 0||oe instanceof FormData?{}:{"Content-Type":"application/json"},S,x,R.header),re={redirect:"follow",...j,...Z,body:oe,headers:ue};let ie,ce,se=new H(U(A,{baseUrl:Q,params:R,querySerializer:ne}),re),he;for(const le in Z)le in se||(se[le]=Z[le]);if(y.length){ie=u(),ce=Object.freeze({baseUrl:Q,fetch:v,parseAs:D,querySerializer:ne,bodySerializer:z});for(const le of y)if(le&&typeof le=="object"&&typeof le.onRequest=="function"){const fe=await le.onRequest({request:se,schemaPath:A,params:R,options:ce,id:ie});if(fe)if(fe instanceof H)se=fe;else if(fe instanceof Response){he=fe;break}
2else throw new Error("onRequest: must return new Request() or Response() when modifying the request")}}if(!he){try{he=await v(se,I)}catch(le){let fe=le;if(y.length)for(let me=y.length-1;me>=0;me--){const Ae=y[me];if(Ae&&typeof Ae=="object"&&typeof Ae.onError=="function"){const Ie=await Ae.onError({request:se,error:fe,schemaPath:A,params:R,options:ce,id:ie});if(Ie){if(Ie instanceof Response){fe=void 0,he=Ie;break}if(Ie instanceof Error){fe=Ie;continue}throw new Error("onError: must return new Response() or instance of Error")}}}if(fe)throw fe}if(y.length)for(let le=y.length-1;le>=0;le--){const fe=y[le];if(fe&&typeof fe=="object"&&typeof fe.onResponse=="function"){const me=await fe.onResponse({request:se,response:he,schemaPath:A,params:R,options:ce,id:ie});if(me){if(!(me instanceof Response))throw new Error("onResponse: must return new Response() when modifying the response");he=me}}}}if(he.status===204||se.method==="HEAD"||he.headers.get("Content-Length")==="0")return he.ok?{data:void 0,response:he}:{error:void 0,response:he};if(he.ok)return D==="stream"?{data:he.body,response:he}:{data:await he[D](),response:he};let ge=await he.text();try{ge=JSON.parse(ge)}catch{}return{error:ge,response:he}}return{request(A,T,b){return E(T,{...b,method:A.toUpperCase()})},GET(A,T){return E(A,{...T,method:"GET"})},PUT(A,T){return E(A,{...T,method:"PUT"})},POST(A,T){return E(A,{...T,method:"POST"})},DELETE(A,T){return E(A,{...T,method:"DELETE"})},OPTIONS(A,T){return E(A,{...T,method:"OPTIONS"})},HEAD(A,T){return E(A,{...T,method:"HEAD"})},PATCH(A,T){return E(A,{...T,method:"PATCH"})},TRACE(A,T){return E(A,{...T,method:"TRACE"})},use(...A){for(const T of A)if(T){if(typeof T!="object"||!("onRequest"in T||"onResponse"in T||"onError"in T))throw new Error("Middleware must be an object with one of `onRequest()`, `onResponse() or `onError()`");y.push(T)}},eject(...A){for(const T of A){const b=y.indexOf(T);b!==-1&&y.splice(b,1)}}}}var h=class{constructor(B,N){this.client=B,this.url=N}GET=B=>this.client.GET(this.url,B);PUT=B=>this.client.PUT(this.url,B);POST=B=>this.client.POST(this.url,B);DELETE=B=>this.client.DELETE(this.url,B);OPTIONS=B=>this.client.OPTIONS(this.url,B);HEAD=B=>this.client.HEAD(this.url,B);PATCH=B=>this.client.PATCH(this.url,B);TRACE=B=>this.client.TRACE(this.url,B)},f=class{constructor(){this.client=null}get(B,N){const H=new h(B,N);return this.client[N]=H,H}};function m(B){const N=new f,H=new Proxy(B,N);function $(){}$.prototype=H;const P=new $;return N.client=P,P}function g(B){return m(d(B))}function w(B,N,H){if(N==null)return"";if(typeof N=="object")throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${B}=${H?.allowReserved===!0?N:encodeURIComponent(N)}`}function p(B,N,H){if(!N||typeof N!="object")return"";const $=[],P={simple:",",label:".",matrix:";"}[H.style]||"&";if(H.style!=="deepObject"&&H.explode===!1){for(const I in N)$.push(I,H.allowReserved===!0?N[I]:encodeURIComponent(N[I]));const S=$.join(",");switch(H.style){case"form":return`${B}=${S}`;case"label":return`.${S}`;case"matrix":return`;${B}=${S}`;default:return S}}for(const S in N){const I=H.style==="deepObject"?`${B}[${S}]`:S;$.push(w(I,N[S],H))}const M=$.join(P);return H.style==="label"||H.style==="matrix"?`${P}${M}`:M}function C(B,N,H){if(!Array.isArray(N))return"";if(H.explode===!1){const M={form:",",spaceDelimited:"%20",pipeDelimited:"|"}[H.style]||",",S=(H.allowReserved===!0?N:N.map(I=>encodeURIComponent(I))).join(M);switch(H.style){case"simple":return S;case"label":return`.${S}`;case"matrix":return`;${B}=${S}`;default:return`${B}=${S}`}}const $={simple:",",label:".",matrix:";"}[H.style]||"&",P=[];
2for(const M of N)H.style==="simple"||H.style==="label"?P.push(H.allowReserved===!0?M:encodeURIComponent(M)):P.push(w(B,M,H));return H.style==="label"||H.style==="matrix"?`${$}${P.join($)}`:P.join($)}function _(B){return function(H){const $=[];if(H&&typeof H=="object")for(const P in H){const M=H[P];if(M!=null){if(Array.isArray(M)){if(M.length===0)continue;$.push(C(P,M,{style:"form",explode:!0,...B?.array,allowReserved:B?.allowReserved||!1}));continue}if(typeof M=="object"){$.push(p(P,M,{style:"deepObject",explode:!0,...B?.object,allowReserved:B?.allowReserved||!1}));continue}$.push(w(P,M,B))}}return $.join("&")}}function O(B,N){let H=B;for(const $ of B.match(a)??[]){let P=$.substring(1,$.length-1),M=!1,S="simple";if(P.endsWith("*")&&(M=!0,P=P.substring(0,P.length-1)),P.startsWith(".")?(S="label",P=P.substring(1)):P.startsWith(";")&&(S="matrix",P=P.substring(1)),!N||N[P]===void 0||N[P]===null)continue;const I=N[P];if(Array.isArray(I)){H=H.replace($,C(P,I,{style:S,explode:M}));continue}if(typeof I=="object"){H=H.replace($,p(P,I,{style:S,explode:M}));continue}if(S==="matrix"){H=H.replace($,`;${w(P,I)}`);continue}H=H.replace($,S==="label"?`.${encodeURIComponent(I)}`:encodeURIComponent(I))}return H}function L(B,N){return B instanceof FormData?B:N&&(N.get instanceof Function?N.get("Content-Type")??N.get("content-type"):N["Content-Type"]??N["content-type"])==="application/x-www-form-urlencoded"?new URLSearchParams(B).toString():JSON.stringify(B)}function U(B,N){let H=`${N.baseUrl}${B}`;N.params?.path&&(H=O(H,N.params.path));let $=N.querySerializer(N.params.query??{});return $.startsWith("?")&&($=$.substring(1)),$&&(H+=`?${$}`),H}function q(...B){const N=new Headers;for(const H of B){if(!H||typeof H!="object")continue;const $=H instanceof Headers?H.entries():Object.entries(H);for(const[P,M]of $)if(M===null)N.delete(P);else if(Array.isArray(M))for(const S of M)N.append(P,S);else M!==void 0&&N.set(P,M)}return N}function F(B){return B.endsWith("/")?B.substring(0,B.length-1):B}return $o}var Ko,dc;function ep(){if(dc)return Ko;dc=1;var t={},e=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,o=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,s=(U,q)=>{for(var F in q)n(U,F,{get:q[F],enumerable:!0})},a=(U,q,F,B)=>{if(q&&typeof q=="object"||typeof q=="function")for(let N of i(q))!c.call(U,N)&&N!==F&&n(U,N,{get:()=>q[N],enumerable:!(B=r(q,N))||B.enumerable});return U},l=(U,q,F)=>(F=U!=null?e(o(U)):{},a(!U||!U.__esModule?n(F,"default",{value:U,enumerable:!0}):F,U)),u=U=>a(n({},"__esModule",{value:!0}),U),d={};s(d,{analytics:()=>L}),Ko=u(d);var h=l(Qf()),f=class{constructor(U){this.batch=[],this.maxTimeoutMs=3e4,this.timeoutId=null,this.isSending=!1,this.batchSize=U.batchSize,this.baseTimeoutMs=U.baseTimeoutMs,this.currentTimeoutMs=U.baseTimeoutMs,this.sendFn=U.sendFn}enqueue(U){this.batch.push(U),this.schedule()}schedule(){this.batch.length>0&&!this.timeoutId&&(this.timeoutId=setTimeout(()=>{this.timeoutId=null,this.flush()},this.currentTimeoutMs))}async flush(){if(this.isSending||this.batch.length===0)return;this.isSending=!0;const U=[...this.batch.slice(0,this.batchSize)];this.batch=this.batch.slice(this.batchSize);try{await this.sendFn(U),this.currentTimeoutMs=this.baseTimeoutMs}catch(q){console.error("Sender: Failed to send batch",q),this.batch=[...U,...this.batch],this.currentTimeoutMs=Math.min(this.currentTimeoutMs*2,this.maxTimeoutMs)}finally{this.isSending=!1,this.schedule()}}},m=f,g=class{constructor(U){this.enabled=!1,this.properties={};const q=(0,h.default)({baseUrl:U}),F=async B=>{const N=await q.POST("/v1/events",{body:B});if(N.response.status!==200)throw new Error(N.error)};this.sender=new m({batchSize:100,baseTimeoutMs:200,sendFn:F})}enable(){this.enabled=!0}setGlobalProperty(U,q){this.properties[U]=q}track(U,q){if(!this.enabled)return;const F={name:U,...this.properties,...q};this.sender.enqueue(F)}},w=g,p,C;typeof process<"u"&&t&&(p=(C=t.METAMASK_ANALYTICS_ENDPOINT)!=null?C:t.NEXT_PUBLIC_METAMASK_ANALYTICS_ENDPOINT);var _=p??"https://mm-sdk-analytics.api.cx.metamask.io/",O=new w(_),L=O;return Ko}var Re=ep(),jo={exports:{}};var hc;function tp(){return hc||(hc=1,(function(t,e){(function(n){var r=Object.hasOwnProperty,i=Array.isArray?Array.isArray:function(E){return Object.prototype.toString.call(E)==="[object Array]"},o=10,c=typeof process=="object"&&typeof process.nextTick=="function",s=typeof Symbol=="function",a=typeof Reflect=="object",l=typeof setImmediate=="function",u=l?setImmediate:setTimeout,d=s?a&&typeof Reflect.ownKeys=="function"?Reflect.ownKeys:function(y){var E=Object.getOwnPropertyNames(y);return E.push.apply(E,Object.getOwnPropertySymbols(y)),E}:Object.keys;function h(){this._events={},this._conf&&f.call(this,this._conf)}function f(y){y&&(this._conf=y,y.delimiter&&(this.delimiter=y.delimiter),y.maxListeners!==n&&(this._maxListeners=y.maxListeners),y.wildcard&&(this.wildcard=y.wildcard),y.newListener&&(this._newListener=y.newListener),y.removeListener&&(this._removeListener=y.removeListener),y.verboseMemoryLeak&&(this.verboseMemoryLeak=y.verboseMemoryLeak),y.ignoreErrors&&(this.ignoreErrors=y.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function m(y,E){var A="(node) warning: possible EventEmitter memory leak detected. "+y+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(A+=" Event name: "+E+"."),typeof process<"u"&&process.emitWarning){var T=new Error(A);T.name="MaxListenersExceededWarning",T.emitter=this,T.count=y,process.emitWarning(T)}else console.error(A),console.trace&&console.trace()}var g=function(y,E,A){var T=arguments.length;switch(T){case 0:return[];case 1:return[y];case 2:return[y,E];case 3:return[y,E,A];default:for(var b=new Array(T);T--;)b[T]=arguments[T];return b}};function w(y,E){for(var A={},T,b=y.length,v=0,k=0;k<b;k++)T=y[k],A[T]=k<v?E[k]:n;return A}function p(y,E,A){this._emitter=y,this._target=E,this._listeners={},this._listenersCount=0;var T,b;if((A.on||A.off)&&(T=A.on,b=A.off),E.addEventListener?(T=E.addEventListener,b=E.removeEventListener):E.addListener?(T=E.addListener,b=E.removeListener):E.on&&(T=E.on,b=E.off),!T&&!b)throw Error("target does not implement any known event API");if(typeof T!="function")throw TypeError("on method must be a function");if(typeof b!="function")throw TypeError("off method must be a function");this._on=T,this._off=b;var v=y._observers;v?v.push(this):y._observers=[this]}Object.assign(p.prototype,{subscribe:function(y,E,A){var T=this,b=this._target,v=this._emitter,k=this._listeners,x=function(){var R=g.apply(null,arguments),D={data:R,name:E,original:y};if(A){var K=A.call(b,D);K!==!1&&v.emit.apply(v,[D.name].concat(R));return}v.emit.apply(v,[E].concat(R))};if(k[y])throw Error("Event '"+y+"' is already listening");this._listenersCount++,v._newListener&&v._removeListener&&!T._onNewListener?(this._onNewListener=function(R){R===E&&k[y]===null&&(k[y]=x,T._on.call(b,y,x))},v.on("newListener",this._onNewListener),this._onRemoveListener=function(R){R===E&&!v.hasListeners(R)&&k[y]&&(k[y]=null,T._off.call(b,y,x))},k[y]=null,v.on("removeListener",this._onRemoveListener)):(k[y]=x,T._on.call(b,y,x))},unsubscribe:function(y){var E=this,A=this._listeners,T=this._emitter,b,v,k=this._off,x=this._target,R;
2if(y&&typeof y!="string")throw TypeError("event must be a string");function D(){E._onNewListener&&(T.off("newListener",E._onNewListener),T.off("removeListener",E._onRemoveListener),E._onNewListener=null,E._onRemoveListener=null);var K=F.call(T,E);T._observers.splice(K,1)}if(y){if(b=A[y],!b)return;k.call(x,y,b),delete A[y],--this._listenersCount||D()}else{for(v=d(A),R=v.length;R-- >0;)y=v[R],k.call(x,y,A[y]);this._listeners={},this._listenersCount=0,D()}}});function C(y,E,A,T){var b=Object.assign({},E);if(!y)return b;if(typeof y!="object")throw TypeError("options must be an object");var v=Object.keys(y),k=v.length,x,R,D;function K(V){throw Error('Invalid "'+x+'" option value'+(V?". Reason: "+V:""))}for(var z=0;z<k;z++){if(x=v[z],!r.call(E,x))throw Error('Unknown "'+x+'" option');R=y[x],R!==n&&(D=A[x],b[x]=D?D(R,K):R)}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,R=A;R-- >0;)if(x===y[R])return v;k(E)}}var L=O(["function"]),U=O(["object","function"]);function q(y,E,A){var T,b,v=0,k,x=new y(function(R,D,K){A=C(A,{timeout:0,overload:!1},{timeout:function(Q,ne){return Q*=1,(typeof Q!="number"||Q<0||!Number.isFinite(Q))&&ne("timeout must be a positive number"),Q}}),T=!A.overload&&typeof y.prototype.cancel=="function"&&typeof K=="function";function z(){b&&(b=null),v&&(clearTimeout(v),v=0)}var V=function(Q){z(),R(Q)},Z=function(Q){z(),D(Q)};T?E(V,Z,K):(b=[function(Q){Z(Q||Error("canceled"))}],E(V,Z,function(Q){if(k)throw Error("Unable to subscribe on cancel event asynchronously");if(typeof Q!="function")throw TypeError("onCancel callback must be a function");b.push(Q)}),k=!0),A.timeout>0&&(v=setTimeout(function(){var Q=Error("timeout");Q.code="ETIMEDOUT",v=0,x.cancel(Q),D(Q)},A.timeout))});return T||(x.cancel=function(R){if(b){for(var D=b.length,K=1;K<D;K++)b[K](R);b[0](R),b=null}}),x}function F(y){var E=this._observers;if(!E)return-1;for(var A=E.length,T=0;T<A;T++)if(E[T]._target===y)return T;return-1}function B(y,E,A,T,b){if(!A)return null;if(T===0){var v=typeof E;if(v==="string"){var k,x,R=0,D=0,K=this.delimiter,z=K.length;if((x=E.indexOf(K))!==-1){k=new Array(5);do k[R++]=E.slice(D,x),D=x+z;while((x=E.indexOf(K,D))!==-1);k[R++]=E.slice(D),E=k,b=R}else E=[E],b=1}else v==="object"?b=E.length:(E=[E],b=1)}var V=null,Z,Q,ne,oe,ue,re=E[T],ie=E[T+1],ce,se;if(T===b)A._listeners&&(typeof A._listeners=="function"?(y&&y.push(A._listeners),V=[A]):(y&&y.push.apply(y,A._listeners),V=[A]));else if(re==="*"){for(ce=d(A),x=ce.length;x-- >0;)Z=ce[x],Z!=="_listeners"&&(se=B(y,E,A[Z],T+1,b),se&&(V?V.push.apply(V,se):V=se));return V}else if(re==="**"){for(ue=T+1===b||T+2===b&&ie==="*",ue&&A._listeners&&(V=B(y,E,A,b,b)),ce=d(A),x=ce.length;x-- >0;)Z=ce[x],Z!=="_listeners"&&(Z==="*"||Z==="**"?(A[Z]._listeners&&!ue&&(se=B(y,E,A[Z],b,b),se&&(V?V.push.apply(V,se):V=se)),se=B(y,E,A[Z],T,b)):Z===ie?se=B(y,E,A[Z],T+2,b):se=B(y,E,A[Z],T,b),se&&(V?V.push.apply(V,se):V=se));return V}else A[re]&&(V=B(y,E,A[re],T+1,b));if(Q=A["*"],Q&&B(y,E,Q,T+1,b),ne=A["**"],ne)if(T<b)for(ne._listeners&&B(y,E,ne,b,b),ce=d(ne),x=ce.length;x-- >0;)Z=ce[x],Z!=="_listeners"&&(Z===ie?B(y,E,ne[Z],T+2,b):Z===re?B(y,E,ne[Z],T+1,b):(oe={},oe[Z]=ne[Z],B(y,E,{"**":oe},T+1,b)));else ne._listeners?B(y,E,ne,b,b):ne["*"]&&ne["*"]._listeners&&B(y,E,ne["*"],b,b);return V}function N(y,E,A){var T=0,b=0,v,k=this.delimiter,x=k.length,R;if(typeof y=="string")if((v=y.indexOf(k))!==-1){R=new Array(5);do R[T++]=y.slice(b,v),b=v+x;while((v=y.indexOf(k,b))!==-1);R[T++]=y.slice(b)}else R=[y],T=1;else R=y,T=y.length;if(T>1){for(v=0;v+1<T;v++)if(R[v]==="**"&&R[v+1]==="**")return}var D=this.listenerTree,K;for(v=0;v<T;v++)if(K=R[v],D=D[K]||(D[K]={}),v===T-1)return D._listeners?(typeof D._listeners=="function"&&(D._listeners=[D._listeners]),A?D._listeners.unshift(E):D._listeners.push(E),!D._listeners.warned&&this._maxListeners>0&&D._listeners.length>this._maxListeners&&(D._listeners.warned=!0,m.call(this,D._listeners.length,K))):D._listeners=E,!0;return!0}function H(y,E,A,T){for(var b=d(y),v=b.length,k,x,R,D=y._listeners,K;v-- >0;)x=b[v],k=y[x],x==="_listeners"?R=A:R=A?A.concat(x):[x],K=T||typeof x=="symbol",D&&E.push(K?R:R.join(this.delimiter)),typeof k=="object"&&H.call(this,k,E,R,K);return E}function $(y){for(var E=d(y),A=E.length,T,b,v;A-- >0;)b=E[A],T=y[b],T&&(v=!0,b!=="_listeners"&&!$(T)&&delete y[b]);return v}function P(y,E,A){this.emitter=y,this.event=E,this.listener=A}P.prototype.off=function(){return this.emitter.off(this.event,this.listener),this};function M(y,E,A){if(A===!0)b=!0;else if(A===!1)T=!0;else{if(!A||typeof A!="object")throw TypeError("options should be an object or true");var T=A.async,b=A.promisify,v=A.nextTick,k=A.objectify}if(T||v||b){var x=E,R=E._origin||E;if(v&&!c)throw Error("process.nextTick is not supported");b===n&&(b=E.constructor.name==="AsyncFunction"),E=function(){var D=arguments,K=this,z=this.event;return b?v?Promise.resolve():new Promise(function(V){u(V)}).then(function(){return K.event=z,x.apply(K,D)}):(v?process.nextTick:u)(function(){K.event=z,x.apply(K,D)})},E._async=!0,E._origin=R}return[E,k?new P(this,y,E):this]}function S(y){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,f.call(this,y)}S.EventEmitter2=S,S.prototype.listenTo=function(y,E,A){if(typeof y!="object")throw TypeError("target musts be an object");var T=this;A=C(A,{on:n,off:n,reducers:n},{on:L,off:L,reducers:U});function b(v){if(typeof v!="object")throw TypeError("events must be an object");var k=A.reducers,x=F.call(T,y),R;x===-1?R=new p(T,y,A):R=T._observers[x];for(var D=d(v),K=D.length,z,V=typeof k=="function",Z=0;Z<K;Z++)z=D[Z],R.subscribe(z,v[z]||z,V?k:k&&k[z])}return i(E)?b(w(E)):b(typeof E=="string"?w(E.split(/\s+/)):E),this},S.prototype.stopListeningTo=function(y,E){var A=this._observers;if(!A)return!1;var T=A.length,b,v=!1;if(y&&typeof y!="object")throw TypeError("target should be an object");for(;T-- >0;
2)b=A[T],(!y||b._target===y)&&(b.unsubscribe(E),v=!0);return v},S.prototype.delimiter=".",S.prototype.setMaxListeners=function(y){y!==n&&(this._maxListeners=y,this._conf||(this._conf={}),this._conf.maxListeners=y)},S.prototype.getMaxListeners=function(){return this._maxListeners},S.prototype.event="",S.prototype.once=function(y,E,A){return this._once(y,E,!1,A)},S.prototype.prependOnceListener=function(y,E,A){return this._once(y,E,!0,A)},S.prototype._once=function(y,E,A,T){return this._many(y,1,E,A,T)},S.prototype.many=function(y,E,A,T){return this._many(y,E,A,!1,T)},S.prototype.prependMany=function(y,E,A,T){return this._many(y,E,A,!0,T)},S.prototype._many=function(y,E,A,T,b){var v=this;if(typeof A!="function")throw new Error("many only accepts instances of Function");function k(){return--E===0&&v.off(y,k),A.apply(this,arguments)}return k._origin=A,this._on(y,k,T,b)},S.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||h.call(this);var y=arguments[0],E,A=this.wildcard,T,b,v,k,x;if(y==="newListener"&&!this._newListener&&!this._events.newListener)return!1;if(A&&(E=y,y!=="newListener"&&y!=="removeListener"&&typeof y=="object")){if(b=y.length,s){for(v=0;v<b;v++)if(typeof y[v]=="symbol"){x=!0;break}}x||(y=y.join(this.delimiter))}var R=arguments.length,D;if(this._all&&this._all.length)for(D=this._all.slice(),v=0,b=D.length;v<b;v++)switch(this.event=y,R){case 1:D[v].call(this,y);break;case 2:D[v].call(this,y,arguments[1]);break;case 3:D[v].call(this,y,arguments[1],arguments[2]);break;default:D[v].apply(this,arguments)}if(A)D=[],B.call(this,D,E,this.listenerTree,0,b);else if(D=this._events[y],typeof D=="function"){switch(this.event=y,R){case 1:D.call(this);break;case 2:D.call(this,arguments[1]);break;case 3:D.call(this,arguments[1],arguments[2]);break;default:for(T=new Array(R-1),k=1;k<R;k++)T[k-1]=arguments[k];D.apply(this,T)}return!0}else D&&(D=D.slice());if(D&&D.length){if(R>3)for(T=new Array(R-1),k=1;k<R;k++)T[k-1]=arguments[k];for(v=0,b=D.length;v<b;v++)switch(this.event=y,R){case 1:D[v].call(this);break;case 2:D[v].call(this,arguments[1]);break;case 3:D[v].call(this,arguments[1],arguments[2]);break;default:D[v].apply(this,T)}return!0}else if(!this.ignoreErrors&&!this._all&&y==="error")throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");return!!this._all},S.prototype.emitAsync=function(){if(!this._events&&!this._all)return!1;this._events||h.call(this);var y=arguments[0],E=this.wildcard,A,T,b,v,k,x;if(y==="newListener"&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);if(E&&(A=y,y!=="newListener"&&y!=="removeListener"&&typeof y=="object")){if(v=y.length,s){for(k=0;k<v;k++)if(typeof y[k]=="symbol"){T=!0;break}}T||(y=y.join(this.delimiter))}var R=[],D=arguments.length,K;if(this._all)for(k=0,v=this._all.length;k<v;k++)switch(this.event=y,D){case 1:R.push(this._all[k].call(this,y));break;case 2:R.push(this._all[k].call(this,y,arguments[1]));break;case 3:R.push(this._all[k].call(this,y,arguments[1],arguments[2]));break;default:R.push(this._all[k].apply(this,arguments))}if(E?(K=[],B.call(this,K,A,this.listenerTree,0)):K=this._events[y],typeof K=="function")switch(this.event=y,D){case 1:R.push(K.call(this));break;case 2:R.push(K.call(this,arguments[1]));break;case 3:R.push(K.call(this,arguments[1],arguments[2]));break;default:for(b=new Array(D-1),x=1;x<D;x++)b[x-1]=arguments[x];R.push(K.apply(this,b))}else if(K&&K.length){if(K=K.slice(),D>3)for(b=new Array(D-1),x=1;x<D;x++)b[x-1]=arguments[x];for(k=0,v=K.length;k<v;k++)switch(this.event=y,D){case 1:R.push(K[k].call(this));break;case 2:R.push(K[k].call(this,arguments[1]));break;case 3:R.push(K[k].call(this,arguments[1],arguments[2]));break;default:R.push(K[k].apply(this,b))}}else if(!this.ignoreErrors&&!this._all&&y==="error")return arguments[1]instanceof Error?Promise.reject(arguments[1]):Promise.reject("Uncaught, unspecified 'error' event.");return Promise.all(R)},S.prototype.on=function(y,E,A){return this._on(y,E,!1,A)},S.prototype.prependListener=function(y,E,A){return this._on(y,E,!0,A)},S.prototype.onAny=function(y){return this._onAny(y,!1)},S.prototype.prependAny=function(y){return this._onAny(y,!0)},S.prototype.addListener=S.prototype.on,S.prototype._onAny=function(y,E){if
2(typeof y!="function")throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),E?this._all.unshift(y):this._all.push(y),this},S.prototype._on=function(y,E,A,T){if(typeof y=="function")return this._onAny(y,E),this;if(typeof E!="function")throw new Error("on only accepts instances of Function");this._events||h.call(this);var b=this,v;return T!==n&&(v=M.call(this,y,E,T),E=v[0],b=v[1]),this._newListener&&this.emit("newListener",y,E),this.wildcard?(N.call(this,y,E,A),b):(this._events[y]?(typeof this._events[y]=="function"&&(this._events[y]=[this._events[y]]),A?this._events[y].unshift(E):this._events[y].push(E),!this._events[y].warned&&this._maxListeners>0&&this._events[y].length>this._maxListeners&&(this._events[y].warned=!0,m.call(this,this._events[y].length,y))):this._events[y]=E,b)},S.prototype.off=function(y,E){if(typeof E!="function")throw new Error("removeListener only takes instances of Function");var A,T=[];if(this.wildcard){var b=typeof y=="string"?y.split(this.delimiter):y.slice();if(T=B.call(this,null,b,this.listenerTree,0),!T)return this}else{if(!this._events[y])return this;A=this._events[y],T.push({_listeners:A})}for(var v=0;v<T.length;v++){var k=T[v];if(A=k._listeners,i(A)){for(var x=-1,R=0,D=A.length;R<D;R++)if(A[R]===E||A[R].listener&&A[R].listener===E||A[R]._origin&&A[R]._origin===E){x=R;break}if(x<0)continue;return this.wildcard?k._listeners.splice(x,1):this._events[y].splice(x,1),A.length===0&&(this.wildcard?delete k._listeners:delete this._events[y]),this._removeListener&&this.emit("removeListener",y,E),this}else(A===E||A.listener&&A.listener===E||A._origin&&A._origin===E)&&(this.wildcard?delete k._listeners:delete this._events[y],this._removeListener&&this.emit("removeListener",y,E))}return this.listenerTree&&$(this.listenerTree),this},S.prototype.offAny=function(y){var E=0,A=0,T;if(y&&this._all&&this._all.length>0){for(T=this._all,E=0,A=T.length;E<A;E++)if(y===T[E])return T.splice(E,1),this._removeListener&&this.emit("removeListenerAny",y),this}else{if(T=this._all,this._removeListener)for(E=0,A=T.length;E<A;E++)this.emit("removeListenerAny",T[E]);this._all=[]}return this},S.prototype.removeListener=S.prototype.off,S.prototype.removeAllListeners=function(y){if(y===n)return!this._events||h.call(this),this;if(this.wildcard){var E=B.call(this,null,y,this.listenerTree,0),A,T;if(!E)return this;for(T=0;T<E.length;T++)A=E[T],A._listeners=null;this.listenerTree&&$(this.listenerTree)}else this._events&&(this._events[y]=null);return this},S.prototype.listeners=function(y){var E=this._events,A,T,b,v,k;if(y===n){if(this.wildcard)throw Error("event name required for wildcard emitter");if(!E)return[];for(A=d(E),v=A.length,b=[];v-- >0;)T=E[A[v]],typeof T=="function"?b.push(T):b.push.apply(b,T);return b}else{if(this.wildcard){if(k=this.listenerTree,!k)return[];var x=[],R=typeof y=="string"?y.split(this.delimiter):y.slice();return B.call(this,x,R,k,0),x}return E?(T=E[y],T?typeof T=="function"?[T]:T:[]):[]}},S.prototype.eventNames=function(y){var E=this._events;return this.wildcard?H.call(this,this.listenerTree,[],null,y):E?d(E):[]},S.prototype.listenerCount=function(y){return this.listeners(y).length},S.prototype.hasListeners=function(y){if(this.wildcard){var E=[],A=typeof y=="string"?y.split(this.delimiter):y.slice();return B.call(this,E,A,this.listenerTree,0),E.length>0}var T=this._events,b=this._all;return!!(b&&b.length||T&&(y===n?d(T).length:T[y]))},S.prototype.listenersAny=function(){return this._all?this._all:[]},S.prototype.waitFor=function(y,E){var A=this,T=typeof E;return T==="number"?E={timeout:E}:T==="function"&&(E={filter:E}),E=C(E,{timeout:0,filter:n,handleError:!1,Promise,overload:!1},{filter:L,Promise:_}),q(E.Promise,function(b,v,k){function x(){var R=E.filter;if(!(R&&!R.apply(A,arguments)))if(A.off(y,x),E.handleError){var D=arguments[0];D?v(D):b(g.apply(null,arguments).slice(1))}else b(g.apply(null,arguments))}k(function(){A.off(y,x)}),A._on(y,x,!1)},{timeout:E.timeout,overload:E.overload})};function I(y,E,A){A=C(A,{Promise,timeout:0,overload:!1},{Promise:_});var T=A.Promise;return q(T,function(b,v,k){var x;if(typeof y.addEventListener=="function"){x=function(){b(g.apply(null,arguments))},k(function(){y.removeEventListener(E,x)}),y.addEventListener(E,x,{once:!0});return}var R=function(){D&&y.removeListener("error",D),b(g.apply(null,arguments))},D;E!=="error"&&(D=function(K){y.removeListener(E,R),v(K)},y.once("error",D)),k(function(){D&&y.removeListener("error",D),y.removeListener(E,R)}),y.once(E,R)},{timeout:A.timeout,overload:A.overload})}var j=S.prototype;Object.defineProperties(S,{defaultMaxListeners:{get:function(){return j._maxListeners},set:function(y){if(typeof y!="number"||y<0||Number.isNaN(y))throw TypeError("n must be a non-negative number");j._maxListeners=y},enumerable:!0},once:{value:I,writable:!0,configurable:!0}}),Object.defineProperties(j,{_maxListeners:{value:o,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),t.exports=S})()})(jo)),jo.exports}var Eo=tp();const np=pa(Eo);var ni,rp=new Uint8Array(16);function ip(){if(!ni&&(ni=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!ni))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ni(rp)}const op=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Rs(t){return typeof t=="string"&&op.test(t)}var Ke=[];for(var Uo=0;Uo<256;++Uo)Ke.push((Uo+256).toString(16).substr(1));function sp(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(Ke[t[e+0]]+Ke[t[e+1]]+Ke[t[e+2]]+Ke[t[e+3]]+"-"+Ke[t[e+4]]+Ke[t[e+5]]+"-"+Ke[t[e+6]]+Ke[t[e+7]]+"-"+Ke[t[e+8]]+Ke[t[e+9]]+"-"+Ke[t[e+10]]+Ke[t[e+11]]+Ke[t[e+12]]+Ke[t[e+13]]+Ke[t[e+14]]+Ke[t[e+15]]).toLowerCase();
vendor: 6,316 bytes, line 2
2if(!Rs(n))throw TypeError("Stringified UUID is invalid");return n}function gn(t,e,n){t=t||{};var r=t.random||(t.rng||ip)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,sp(r)}const jt=Object.create(null);jt.open="0";jt.close="1";jt.ping="2";jt.pong="3";jt.message="4";jt.upgrade="5";jt.noop="6";const xi=Object.create(null);Object.keys(jt).forEach(t=>{xi[jt[t]]=t});const Os={type:"error",data:"parser error"},Pu=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Iu=typeof ArrayBuffer=="function",Lu=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,ma=({type:t,data:e},n,r)=>Pu&&e instanceof Blob?n?r(e):fc(e,r):Iu&&(e instanceof ArrayBuffer||Lu(e))?n?r(e):fc(new Blob([e]),r):r(jt[t]+(e||"")),fc=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)};function pc(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let Ho;function ap(t,e){if(Pu&&t.data instanceof Blob)return t.data.arrayBuffer().then(pc).then(e);if(Iu&&(t.data instanceof ArrayBuffer||Lu(t.data)))return e(pc(t.data));ma(t,!1,n=>{Ho||(Ho=new TextEncoder),e(Ho.encode(n))})}const mc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",wr=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<mc.length;t++)wr[mc.charCodeAt(t)]=t;const cp=t=>{let e=t.length*.75,n=t.length,r,i=0,o,c,s,a;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const l=new ArrayBuffer(e),u=new Uint8Array(l);for(r=0;r<n;r+=4)o=wr[t.charCodeAt(r)],c=wr[t.charCodeAt(r+1)],s=wr[t.charCodeAt(r+2)],a=wr[t.charCodeAt(r+3)],u[i++]=o<<2|c>>4,u[i++]=(c&15)<<4|s>>2,u[i++]=(s&3)<<6|a&63;return l},lp=typeof ArrayBuffer=="function",ga=(t,e)=>{if(typeof t!="string")return{type:"message",data:Nu(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:up(t.substring(1),e)}:xi[n]?t.length>1?{type:xi[n],data:t.substring(1)}:{type:xi[n]}:Os},up=(t,e)=>{if(lp){const n=cp(t);return Nu(n,e)}else return{base64:!0,data:t}},Nu=(t,e)=>e==="blob"?t instanceof Blob?t:new Blob([t]):t instanceof ArrayBuffer?t:t.buffer,Du="�",dp=(t,e)=>{const n=t.length,r=new Array(n);let i=0;t.forEach((o,c)=>{ma(o,!1,s=>{r[c]=s,++i===n&&e(r.join(Du))})})},hp=(t,e)=>{const n=t.split(Du),r=[];for(let i=0;i<n.length;i++){const o=ga(n[i],e);if(r.push(o),o.type==="error")break}return r};function fp(){return new TransformStream({transform(t,e){ap(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 Fo;function ri(t){return t.reduce((e,n)=>e+n.length,0)}function ii(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 pp(t,e){Fo||(Fo=new TextDecoder);const n=[];let r=0,i=-1,o=!1;return new TransformStream({transform(c,s){for(n.push(c);;){if(r===0){if(ri(n)<1)break;const a=ii(n,1);o=(a[0]&128)===128,i=a[0]&127,i<126?r=3:i===126?r=1:r=2}else if(r===1){if(ri(n)<2)break;const a=ii(n,2);i=new DataView(a.buffer,a.byteOffset,a.length).getUint16(0),r=3}else if(r===2){if(ri(n)<8)break;const a=ii(n,8),l=new DataView(a.buffer,a.byteOffset,a.length),u=l.getUint32(0);if(u>Math.pow(2,21)-1){s.enqueue(Os);break}i=u*Math.pow(2,32)+l.getUint32(4),r=3}else{if(ri(n)<i)break;const a=ii(n,i);s.enqueue(ga(o?a:Fo.decode(a),e)),r=0}if(i===0||i>t){s.enqueue(Os);break}}}})}const Bu=4;function Pe(t){if(t)return mp(t)}function mp(t){for(var e in Pe.prototype)t[e]=Pe.prototype[e];return t}Pe.prototype.on=Pe.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};Pe.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this};Pe.prototype.off=Pe.prototype.removeListener=Pe.prototype.removeAllListeners=Pe.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===e||r.fn===e){n.splice(i,1);break}return n.length===0&&delete this._callbacks["$"+t],this};Pe.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),n=this._callbacks["$"+t],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,e)}return this};Pe.prototype.emitReserved=Pe.prototype.emit;Pe.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};Pe.prototype.hasListeners=function(t){return!!this.listeners(t).length};const _o=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0),vt=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),gp="arraybuffer";function $u(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const yp=vt.setTimeout,vp=vt.clearTimeout;function So(t,e){e.useNativeTimers?(t.setTimeoutFn=yp.bind(vt),t.clearTimeoutFn=vp.bind(vt)):(t.setTimeoutFn=vt.setTimeout.bind(vt),t.clearTimeoutFn=vt.clearTimeout.bind(vt))}const bp=1.33;function wp(t){return typeof t=="string"?Ep(t):Math.ceil((t.byteLength||t.size)*bp)}function Ep(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 Ku(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function _p(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function Sp(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}
vendor: 6,199 bytes, line 2
2class Cp extends Error{constructor(e,n,r){super(e),this.description=n,this.context=r,this.type="TransportError"}}class ya extends Pe{constructor(e){super(),this.writable=!1,So(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 Cp(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=ga(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=_p(e);return n.length?"?"+n:""}}class kp extends ya{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)};hp(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,dp(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]=Ku()),!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 xp(){}class Tp extends kp{constructor(e){if(super(e),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||r!==e.port}}doWrite(e,n){const r=this.request({method:"POST",data:e});r.on("success",n),r.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=e}}class Bt extends Pe{constructor(e,n,r){super(),this.createRequest=e,So(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=$u(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=Bt.requestsCount++,Bt.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=xp,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Bt.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Bt.requestsCount=0;Bt.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",gc);else if(typeof addEventListener=="function"){const t="onpagehide"in vt?"pagehide":"unload";addEventListener(t,gc,!1)}}function gc(){for(let t in Bt.requests)Bt.requests.hasOwnProperty(t)&&Bt.requests[t].abort()}const Mp=(function(){const t=Uu({xdomain:!1});return t&&t.responseType!==null})();class Rp extends Tp{constructor(e){super(e);const n=e&&e.forceBase64;this.supportsBinary=Mp&&!n}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Bt(Uu,this.uri(),e)}}function Uu(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Ap))return new XMLHttpRequest}catch{}if(!e)try{return new vt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Hu=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Op extends ya{get name(){return"websocket"}doOpen(){const e=this.uri(),n=this.opts.protocols,r=Hu?{}:$u(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)}
vendor: 17,830 bytes, line 2
2this.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;ma(r,this.supportsBinary,o=>{try{this.doWrite(r,o)}catch{}i&&_o(()=>{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]=Ku()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}}const qo=vt.WebSocket||vt.MozWebSocket;class Pp extends Op{createSocket(e,n,r){return Hu?new qo(e,n,r):n?new qo(e,n):new qo(e)}doWrite(e,n){this.ws.send(n)}}class Ip extends ya{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=pp(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(n).getReader(),i=fp();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();const o=()=>{r.read().then(({done:s,value:a})=>{s||(this.onPacket(a),o())}).catch(s=>{})};o();const c={type:"open"};this.query.sid&&(c.data=`{"sid":"${this.query.sid}"}`),this._writer.write(c).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],i=n===e.length-1;this._writer.write(r).then(()=>{i&&_o(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const Lp={websocket:Pp,webtransport:Ip,polling:Rp},Np=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Dp=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Ps(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=Np.exec(t||""),o={},c=14;for(;c--;)o[Dp[c]]=i[c]||"";return n!=-1&&r!=-1&&(o.source=e,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=Bp(o,o.path),o.queryKey=$p(o,o.query),o}function Bp(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 $p(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}const Is=typeof addEventListener=="function"&&typeof removeEventListener=="function",Ti=[];Is&&addEventListener("offline",()=>{Ti.forEach(t=>t())},!1);class En extends Pe{constructor(e,n){if(super(),this.binaryType=gp,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=Ps(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=Ps(n.host).host);So(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=Sp(this.opts.query)),Is&&(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"})},Ti.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=Bu,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+=wp(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,_o(()=>{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(),Is&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=Ti.indexOf(this._offlineEventListener);r!==-1&&Ti.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this._prevBufferLen=0}}}En.protocol=Bu;class Kp 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 c=d=>{const h=new Error("probe error: "+d);h.transport=n.name,o(),this.emitReserved("upgradeError",h)};function s(){c("transport closed")}function a(){c("socket closed")}function l(d){n&&d.name!==n.name&&o()}const u=()=>{n.removeListener("open",i),n.removeListener("error",c),n.removeListener("close",s),this.off("close",a),this.off("upgrading",l)};n.once("open",i),n.once("error",c),n.once("close",s),this.once("close",a),this.once("upgrading",l),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const n=[];for(let r=0;r<e.length;r++)~this.transports.indexOf(e[r])&&n.push(e[r]);return n}}let jp=class extends Kp{constructor(e,n={}){const r=typeof e=="object"?e:n;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(i=>Lp[i]).filter(i=>!!i)),super(e,r)}};function Up(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=Ps(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 Hp=typeof ArrayBuffer=="function",Fp=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,Fu=Object.prototype.toString,qp=typeof Blob=="function"||typeof Blob<"u"&&Fu.call(Blob)==="[object BlobConstructor]",zp=typeof File=="function"||typeof File<"u"&&Fu.call(File)==="[object FileConstructor]";function va(t){return Hp&&(t instanceof ArrayBuffer||Fp(t))||qp&&t instanceof Blob||zp&&t instanceof File}function Mi(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n<r;n++)if(Mi(t[n]))return!0;return!1}if(va(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return Mi(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&Mi(t[n]))return!0;return!1}function Vp(t){const e=[],n=t.data,r=t;return r.data=Ls(n,e),r.attachments=e.length,{packet:r,buffers:e}}function Ls(t,e){if(!t)return t;if(va(t)){const n={_placeholder:!0,num:e.length};return e.push(t),n}else if(Array.isArray(t)){const n=new Array(t.length);for(let r=0;r<t.length;r++)n[r]=Ls(t[r],e);return n}else if(typeof t=="object"&&!(t instanceof Date)){const n={};for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=Ls(t[r],e));return n}return t}function Wp(t,e){return t.data=Ns(t.data,e),delete t.attachments,t}function Ns(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]=Ns(t[n],e);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=Ns(t[n],e));return t}const Gp=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var be;(function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"})(be||(be={}));class Yp{constructor(e){this.replacer=e}encode(e){return(e.type===be.EVENT||e.type===be.ACK)&&Mi(e)?this.encodeAsBinary({type:e.type===be.EVENT?be.BINARY_EVENT:be.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let n=""+e.type;return(e.type===be.BINARY_EVENT||e.type===be.BINARY_ACK)&&(n+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(n+=e.nsp+","),e.id!=null&&(n+=e.id),e.data!=null&&(n+=JSON.stringify(e.data,this.replacer)),n}encodeAsBinary(e){const n=Vp(e),r=this.encodeAsString(n.packet),i=n.buffers;return i.unshift(r),i}}class ba extends Pe{constructor(e){super(),this.reviver=e}add(e){let n;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(e);const r=n.type===be.BINARY_EVENT;r||n.type===be.BINARY_ACK?(n.type=r?be.EVENT:be.ACK,this.reconstructor=new Zp(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(va(e)||e.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(e),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let n=0;const r={type:Number(e.charAt(0))};if(be[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===be.BINARY_EVENT||r.type===be.BINARY_ACK){const o=n+1;for(;e.charAt(++n)!=="-"&&n!=e.length;);const c=e.substring(o,n);if(c!=Number(c)||e.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(c)}if(e.charAt(n+1)==="/"){const o=n+1;for(;++n&&!(e.charAt(n)===","||n===e.length););r.nsp=e.substring(o,n)}else r.nsp="/";const i=e.charAt(n+1);if(i!==""&&Number(i)==i){const o=n+1;for(;++n;){const c=e.charAt(n);if(c==null||Number(c)!=c){--n;break}if(n===e.length)break}r.id=Number(e.substring(o,n+1))}if(e.charAt(++n)){const o=this.tryParse(e.substr(n));if(ba.isPayloadValid(r.type,o))r.data=o;else throw new Error("invalid payload")}return r}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,n){switch(e){case be.CONNECT:return yc(n);case be.DISCONNECT:return n===void 0;case be.CONNECT_ERROR:return typeof n=="string"||yc(n);case be.EVENT:case be.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&Gp.indexOf(n[0])===-1);case be.ACK:case be.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Zp{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=Wp(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function yc(t){return Object.prototype.toString.call(t)==="[object Object]"}const Jp=Object.freeze(Object.defineProperty({__proto__:null,Decoder:ba,Encoder:Yp,get PacketType(){return be}},Symbol.toStringTag,{value:"Module"}));function _t(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const Xp=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class qu extends Pe{constructor(e,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[_t(e,"open",this.onopen.bind(this)),_t(e,"packet",this.onpacket.b
vendor: 2,660 bytes, line 2
2ind(this)),_t(e,"error",this.onerror.bind(this)),_t(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...n){var r,i,o;if(Xp.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(n.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const c={type:be.EVENT,data:n};if(c.options={},c.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const u=this.ids++,d=n.pop();this._registerAckCallback(u,d),c.id=u}const s=(i=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||i===void 0?void 0:i.writable,a=this.connected&&!(!((o=this.io.engine)===null||o===void 0)&&o._hasPingExpired());return this.flags.volatile&&!s||(a?(this.notifyOutgoingListeners(c),this.packet(c)):this.sendBuffer.push(c)),this.flags={},this}_registerAckCallback(e,n){var r;const i=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(i===void 0){this.acks[e]=n;return}const o=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let s=0;s<this.sendBuffer.length;s++)this.sendBuffer[s].id===e&&this.sendBuffer.splice(s,1);n.call(this,new Error("operation has timed out"))},i),c=(...s)=>{this.io.clearTimeoutFn(o),n.apply(this,s)};c.withError=!0,this.acks[e]=c}emitWithAck(e,...n){return new Promise((r,i)=>{const o=(c,s)=>c?i(c):r(s);o.withError=!0,n.push(o),this.emit(e,...n)})}_addToQueue(e){let n;typeof e[e.length-1]=="function"&&(n=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...o)=>(this._queue[0],i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...o)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!e||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:be.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,n),this._clearAcks()}
vendor: 7,087 bytes, line 2
2_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(r=>String(r.id)===e)){const r=this.acks[e];delete this.acks[e],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case be.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case be.EVENT:case be.BINARY_EVENT:this.onevent(e);break;case be.ACK:case be.BINARY_ACK:this.onack(e);break;case be.DISCONNECT:this.ondisconnect();break;case be.CONNECT_ERROR:this.destroy();const r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){const n=e.data||[];e.id!=null&&n.push(this.ack(e.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:be.ACK,id:e,data:i}))}}onack(e){const n=this.acks[e.id];typeof n=="function"&&(delete this.acks[e.id],n.withError&&e.data.unshift(null),n.apply(this,e.data))}onconnect(e,n){this.id=e,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:be.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,e.data)}}}function 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)==0?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 Ds extends Pe{constructor(e,n){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(n=e,e=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,So(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||Jp;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 jp(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=_t(n,"open",function(){r.onopen(),e&&e()}),o=s=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",s),e?e(s):this.maybeReconnectOnOpen()},c=_t(n,"error",o);if(this._timeout!==!1){const s=this._timeout,a=this.setTimeoutFn(()=>{i(),o(new Error("timeout")),n.close()},s);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}return this.subs.push(i),this.subs.push(c),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(_t(e,"ping",this.onping.bind(this)),_t(e,"data",this.ondata.bind(this)),_t(e,"error",this.onerror.bind(this)),_t(e,"close",this.onclose.bind(this)),_t(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(n){this.onclose("parse error",n)}}ondecoded(e){_o(()=>{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 qu(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)}
2cleanup(){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 Ri(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=Up(t,e.path||"/socket.io"),r=n.source,i=n.id,o=n.path,c=pr[i]&&o in pr[i].nsps,s=e.forceNew||e["force new connection"]||e.multiplex===!1||c;let a;return s?a=new Ds(r,e):(pr[i]||(pr[i]=new Ds(r,e)),a=pr[i]),n.query&&!e.query&&(e.query=n.queryKey),a.socket(n.path,e)}Object.assign(Ri,{Manager:Ds,Socket:qu,io:Ri,connect:Ri});function J(t,e,n,r){return new(n||(n=Promise))((function(i,o){function c(l){try{a(r.next(l))}catch(u){o(u)}}function s(l){try{a(r.throw(l))}catch(u){o(u)}}function a(l){var u;l.done?i(l.value):(u=l.value,u instanceof n?u:new n((function(d){d(u)}))).then(c,s)}a((r=r.apply(t,e||[])).next())}))}var Xe=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},Rt=[],mt=[],Qp=typeof Uint8Array<"u"?Uint8Array:Array,wa=!1;function zu(){wa=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0;e<64;++e)Rt[e]=t[e],mt[t.charCodeAt(e)]=e;mt[45]=62,mt[95]=63}function e0(t,e,n){for(var r,i,o=[],c=e;c<n;c+=3)r=(t[c]<<16)+(t[c+1]<<8)+t[c+2],o.push(Rt[(i=r)>>18&63]+Rt[i>>12&63]+Rt[i>>6&63]+Rt[63&i]);return o.join("")}function vc(t){var e;wa||zu();for(var n=t.length,r=n%3,i="",o=[],c=16383,s=0,a=n-r;s<a;s+=c)o.push(e0(t,s,s+c>a?a:s+c));return r===1?(e=t[n-1],i+=Rt[e>>2],i+=Rt[e<<4&63],i+="=="):r===2&&(e=(t[n-2]<<8)+t[n-1],i+=Rt[e>>10],i+=Rt[e>>4&63],i+=Rt[e<<2&63],i+="="),o.push(i),o.join("")}function oi(t,e,n,r,i){var o,c,s=8*i-r-1,a=(1<<s)-1,l=a>>1,u=-7,d=n?i-1:0,h=n?-1:1,f=t[e+d];for(d+=h,o=f&(1<<-u)-1,f>>=-u,u+=s;u>0;o=256*o+t[e+d],d+=h,u-=8);for(c=o&(1<<-u)-1,o>>=-u,u+=r;u>0;c=256*c+t[e+d],d+=h,u-=8);if(o===0)o=1-l;else{if(o===a)return c?NaN:1/0*(f?-1:1);c+=Math.pow(2,r),o-=l}return(f?-1:1)*c*Math.pow(2,o-r)}function Vu(t,e,n,r,i,o){var c,s,a,l=8*o-i-1,u=(1<<l)-1,d=u>>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,m=r?1:-1,g=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,c=u):(c=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-c))<1&&(c--,a*=2),(e+=c+d>=1?h/a:h*Math.pow(2,1-d))*a>=2&&(c++,a/=2),c+d>=u?(s=0,c=u):c+d>=1?(s=(e*a-1)*Math.pow(2,i),c+=d):(s=e*Math.pow(2,d-1)*Math.pow(2,i),c=0));i>=8;t[n+f]=255&s,f+=m,s/=256,i-=8);for(c=c<<i|s,l+=i;l>0;t[n+f]=255&c,f+=m,c/=256,l-=8);t[n+f-m]|=128*g}var t0={}.toString,Wu=Array.isArray||function(t){return t0.call(t)=="[object Array]"};X.TYPED_ARRAY_SUPPORT=Xe.TYPED_ARRAY_SUPPORT===void 0||Xe.TYPED_ARRAY_SUPPORT;var n0=Gi();function Gi(){return X.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Gt(t,e){if(Gi()<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 Bs(this,t)}return Gu(this,t,e,n)}function Gu(t,e,n,r){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer?(function(i,o,c,s){if(o.byteLength,c<0||o.byteLength<c)throw new RangeError("'offset' is out of bounds");if(o.byteLength<c+(s||0))throw new RangeError("'length' is out of bounds");return o=c===void 0&&s===void 0?new Uint8Array(o):s===void 0?new Uint8Array(o,c):new Uint8Array(o,c,s),X.TYPED_ARRAY_SUPPORT?(i=o).__proto__=X.prototype:i=zo(i,o),i})(t,e,n,r):typeof e=="string"?(function(i,o,c){if(typeof c=="string"&&c!==""||(c="utf8"),!X.isEncoding(c))throw new TypeError('"encoding" must be a valid string encoding');var s=0|Zu(o,c);i=Gt(i,s);var a=i.write(o,c);return a!==s&&(i=i.slice(0,a)),i})(t,e,n):(function(i,o){if(Ot(o)){var c=0|Ea(o.length);return(i=Gt(i,c)).length===0||o.copy(i,0,0,c),i}if(o){if(typeof ArrayBuffer<"u"&&o.buffer instanceof ArrayBuffer||"length"in o)return typeof o.length!="number"||(s=o.length)!=s?Gt(i,0):zo(i,o);if(o.type==="Buffer"&&Wu(o.data))return zo(i,o.data)}var s;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")})(t,e)}function Yu(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 Bs(t,e){if(Yu(e),t=Gt(t,e<0?0:0|Ea(e)),!X.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function zo(t,e){var n=e.length<0?0:0|Ea(e.length);t=Gt(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function Ea(t){if(t>=Gi())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Gi().toString(16)+" bytes");return 0|t}function Ot(t){return!(t==null||!t._isBuffer)}function Zu(t,e){if(Ot(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var n=t.length;if(n===0)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return Yi(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return ed(t).length;default:if(r)return Yi(t).length;e=(""+e).toLowerCase(),r=!0}}function r0(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 h0(this,e,n);case"utf8":case"utf-8":return Xu(this,e,n);case"ascii":return u0(this,e,n);case"latin1":case"binary":return d0(this,e,n);case"base64":return l0(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return f0(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 bc(t,e,n,r,i){if(t.length===0)return-1;if(typeof n=="string"?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if(typeof e=="string"&&(e=X.from(e,r)),Ot(e))return e.length===0?-1:wc(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):wc(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function wc(t,e,n,r,i){var o,c=1,s=t.length,a=e.length;if(r!==void 0&&((r=String(r).toLowerCase())==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(t.length<2||e.length<2)return-1;c=2,s/=2,a/=2,n/=2}function l(f,m){return c===1?f[m]:f.readUInt16BE(m*c)}if(i){var u=-1;for(o=n;o<s;o++)if(l(t,o)===l(e,u===-1?0:o-u)){if(u===-1&&(u=o),o-u+1===a)return u*c}else u!==-1&&(o-=o-u),u=-1}else for(n+a>s&&(n=s-a),o=n;o>=0;o--){for(var d=!0,h=0;h<a;h++)if(l(t,o+h)!==l(e,h)){d=!1;break}if(d)return o}return-1}function i0(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var c=0;c<r;++c){var s=parseInt(e.substr(2*c,2),16);if(isNaN(s))return c;t[n+c]=s}return c}function o0(t,e,n,r){return Co(Yi(e,t.length-n),t,n,r)}function Ju(t,e,n,r){return Co((function(i){for(var o=[],c=0;c<i.length;
vendor: 15,395 bytes, line 2
2++c)o.push(255&i.charCodeAt(c));return o})(e),t,n,r)}function s0(t,e,n,r){return Ju(t,e,n,r)}function a0(t,e,n,r){return Co(ed(e),t,n,r)}function c0(t,e,n,r){return Co((function(i,o){for(var c,s,a,l=[],u=0;u<i.length&&!((o-=2)<0);++u)s=(c=i.charCodeAt(u))>>8,a=c%256,l.push(a),l.push(s);return l})(e,t.length-n),t,n,r)}function l0(t,e,n){return e===0&&n===t.length?vc(t):vc(t.slice(e,n))}function Xu(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var o,c,s,a,l=t[i],u=null,d=l>239?4:l>223?3:l>191?2:1;if(i+d<=n)switch(d){case 1:l<128&&(u=l);break;case 2:(192&(o=t[i+1]))==128&&(a=(31&l)<<6|63&o)>127&&(u=a);break;case 3:o=t[i+1],c=t[i+2],(192&o)==128&&(192&c)==128&&(a=(15&l)<<12|(63&o)<<6|63&c)>2047&&(a<55296||a>57343)&&(u=a);break;case 4:o=t[i+1],c=t[i+2],s=t[i+3],(192&o)==128&&(192&c)==128&&(192&s)==128&&(a=(15&l)<<18|(63&o)<<12|(63&c)<<6|63&s)>65535&&a<1114112&&(u=a)}u===null?(u=65533,d=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),i+=d}return(function(h){var f=h.length;if(f<=Ec)return String.fromCharCode.apply(String,h);for(var m="",g=0;g<f;)m+=String.fromCharCode.apply(String,h.slice(g,g+=Ec));return m})(r)}X.poolSize=8192,X._augment=function(t){return t.__proto__=X.prototype,t},X.from=function(t,e,n){return Gu(null,t,e,n)},X.TYPED_ARRAY_SUPPORT&&(X.prototype.__proto__=Uint8Array.prototype,X.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&X[Symbol.species]),X.alloc=function(t,e,n){return(function(r,i,o,c){return Yu(i),i<=0?Gt(r,i):o!==void 0?typeof c=="string"?Gt(r,i).fill(o,c):Gt(r,i).fill(o):Gt(r,i)})(null,t,e,n)},X.allocUnsafe=function(t){return Bs(null,t)},X.allocUnsafeSlow=function(t){return Bs(null,t)},X.isBuffer=td,X.compare=function(t,e){if(!Ot(t)||!Ot(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},X.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},X.concat=function(t,e){if(!Wu(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return X.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=X.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){var o=t[n];if(!Ot(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},X.byteLength=Zu,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?Xu(this,0,t):r0.apply(this,arguments)},X.prototype.equals=function(t){if(!Ot(t))throw new TypeError("Argument must be a Buffer");return this===t||X.compare(this,t)===0},X.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},X.prototype.compare=function(t,e,n,r,i){if(!Ot(t))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),n===void 0&&(n=t?t.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(r>>>=0),c=(n>>>=0)-(e>>>=0),s=Math.min(o,c),a=this.slice(r,i),l=t.slice(e,n),u=0;u<s;++u)if(a[u]!==l[u]){o=a[u],c=l[u];break}return o<c?-1:c<o?1:0},X.prototype.includes=function(t,e,n){return this.indexOf(t,e,n)!==-1},X.prototype.indexOf=function(t,e,n){return bc(this,t,e,n,!0)},X.prototype.lastIndexOf=function(t,e,n){return bc(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 i0(this,t,e,n);case"utf8":case"utf-8":return o0(this,t,e,n);case"ascii":return Ju(this,t,e,n);case"latin1":case"binary":return s0(this,t,e,n);case"base64":return a0(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c0(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 Ec=4096;function u0(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 d0(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 h0(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+=m0(t[o]);return i}function f0(t,e,n){for(var r=t.slice(e,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function Le(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function Qe(t,e,n,r,i,o){if(!Ot(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function si(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 ai(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 Qu(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 _c(t,e,n,r,i){return i||Qu(t,0,n,4),Vu(t,e,n,r,23,4),n+4}function Sc(t,e,n,r,i){return i||Qu(t,0,n,8),Vu(t,e,n,r,52,8),n+8}X.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=e===void 0?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),X.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=X.prototype;else{var i=e-t;n=new X(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+t]}return n},X.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||Le(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r},X.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||Le(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},X.prototype.readUInt8=function(t,e){return e||Le(t,1,this.length),this[t]},X.prototype.readUInt16LE=function(t,e){return e||Le(t,2,this.length),this[t]|this[t+1]<<8},X.prototype.readUInt16BE=function(t,e){return e||Le(t,2,this.length),this[t]<<8|this[t+1]},X.prototype.readUInt32LE=function(t,e){return e||Le(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},X.prototype.readUInt32BE=function(t,e){return e||Le(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},X.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||Le(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*e)),r},X.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||Le(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},X.prototype.readInt8=function(t,e){return e||Le(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},X.prototype.readInt16LE=function(t,e){e||Le(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},X.prototype.readInt16BE=function(t,e){e||Le(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},X.prototype.readInt32LE=function(t,e){return e||Le(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},X.prototype.readInt32BE=function(t,e){return e||Le(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},X.prototype.readFloatLE=function(t,e){return e||Le(t,4,this.length),oi(this,t,!0,23,4)},X.prototype.readFloatBE=function(t,e){return e||Le(t,4,this.length),oi(this,t,!1,23,4)},X.prototype.readDoubleLE=function(t,e){return e||Le(t,8,this.length),oi(this,t,!0,52,8)},X.prototype.readDoubleBE=function(t,e){return e||Le(t,8,this.length),oi(this,t,!1,52,8)},X.prototype.writeUIntLE=function(t,e,n,r){t=+t,e|=0,n|=0,r||Qe(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},X.prototype.writeUIntBE=function(t,e,n,r){t=+t,e|=0,n|=0,r||Qe(this,t,e,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},X.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||Qe(this,t,e,1,255,0),X.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},X.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||Qe(this,t,e,2,65535,0),X.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):si(this,t,e,!0),e+2},X.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||Qe(this,t,e,2,65535,0),X.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):si(this,t,e,!1),e+2},X.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||Qe(this,t,e,4,4294967295,0),X.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):ai(this,t,e,!0),e+4},X.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||Qe(this,t,e,4,4294967295,0),X.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):ai(this,t,e,!1),e+4},X.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);Qe(this,t,e,n,i-1,-i)}var o=0,c=1,s=0;for(this[e]=255&t;++o<n&&(c*=256);)t<0&&s===0&&this[e+o-1]!==0&&(s=1),this[e+o]=(t/c>>0)-s&255;return e+n},X.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);Qe(this,t,e,n,i-1,-i)}var o=n-1,c=1,s=0;for(this[e+o]=255&t;--o>=0&&(c*=256);)t<0&&s===0&&this[e+o+1]!==0&&(s=1),this[e+o]=(t/c>>0)-s&255;return e+n},X.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||Qe(this,t,e,1,127,-128),X.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},X.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||Qe(this,t,e,2,32767,-32768),X.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):si(this,t,e,!0),e+2},X.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||Qe(this,t,e,2,32767,-32768),X.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):si(this,t,e,!1),e+2},X.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||Qe(this,t,e,4,2147483647,-2147483648),X.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):ai(this,t,e,!0),e+4},X.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||Qe(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),X.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):ai(this,t,e,!1),e+4},X.prototype.writeFloatLE=function(t,e,n){return _c(this,t,e,!0,n)},X.prototype.writeFloatBE=function(t,e,n){return _c(this,t,e,!1,n)},X.prototype.writeDoubleLE=function(t,e,n){return Sc(this,t,e,!0,n)},X.prototype.writeDoubleBE=function(t,e,n){return Sc(this,t,e,!1,n)},X.prototype.copy=function(t,e,n,r){if(n||(n=0),r||r===0||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i,o=r-n;if(this===t&&n<e&&e<r)for(i=o-1;i>=0;--i)t[i+e]=this[i+n];else if(o<1e3||!X.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+o),e);return o},X.prototype.fill=function(t,e,n,r){if(typeof t=="string"){if(typeof e=="string"?(r=e,e=0,n=this.length):typeof n=="string"&&(r=n,n=this.length),t.length===1){var i=t.charCodeAt(0);i<256&&(t=i)}if(r!==void 0&&typeof r!="string")throw new TypeError("encoding must be a string");if(typeof r=="string"&&!X.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else typeof t=="number"&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var o;if(e>>>=0,n=n===void 0?this.length:n>>>0,t||(t=0),typeof t=="number")for(o=e;o<n;++o)this[o]=t;else{var c=Ot(t)?t:Yi(new X(t,r).toString()),s=c.length;for(o=0;o<n-e;++o)this[o+e]=c[o%s]}return this};var p0=/[^+\/0-9A-Za-z-_]/g;function m0(t){return t<16?"0"+t.toString(16):t.toString(16)}function Yi(t,e){var n;e=e||1/0;for(var r=t.length,i=null,o=[],c=0;c<r;++c){if((n=t.charCodeAt(c))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(c+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function ed(t){return(function(e){var n,r,i,o,c,s;wa||zu();var a=e.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");c=e[a-2]==="="?2:e[a-1]==="="?1:0,s=new Qp(3*a/4-c),i=c>0?a-4:a;var l=0;for(n=0,r=0;n<i;n+=4,r+=3)o=mt[e.charCodeAt(n)]<<18|mt[e.charCodeAt(n+1)]<<12|mt[e.charCodeAt(n+2)]<<6|mt[e.charCodeAt(n+3)],s[l++]=o>>16&255,s[l++]=o>>8&255,s[l++]=255&o;return c===2?(o=mt[e.charCodeAt(n)]<<2|mt[e.charCodeAt(n+1)]>>4,s[l++]=255&o):c===1&&(o=mt[e.charCodeAt(n)]<<10|mt[e.charCodeAt(n+1)]<<4|mt[e.charCodeAt(n+2)]>>2,s[l++]=o>>8&255,s[l++]=255&o),s})((function(e){if((e=(function(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")})(e).replace(p0,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e})(t))}function Co(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 td(t){return t!=null&&(!!t._isBuffer||Cc(t)||(function(e){return typeof e.readFloatLE=="function"&&typeof e.slice=="function"&&Cc(e.slice(0,0))})(t))}function Cc(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}var g0=Object.freeze({__proto__:null,Buffer:X,INSPECT_MAX_BYTES:50,SlowBuffer:function(t){return+t!=t&&(t=0),X.alloc(+t)},isBuffer:td,kMaxLength:n0}),bt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ko(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}
2function Gr(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={},ut={},ze={};function Zi(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`positive integer expected, not ${t}`)}function nd(t){if(typeof t!="boolean")throw new Error(`boolean expected, not ${t}`)}function rd(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function _a(t,...e){if(!rd(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 id(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("hash must be wrapped by utils.wrapConstructor");Zi(t.outputLen),Zi(t.blockLen)}function od(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 sd(t,e){_a(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}Object.defineProperty(ze,"__esModule",{value:!0}),ze.isBytes=rd,ze.number=Zi,ze.bool=nd,ze.bytes=_a,ze.hash=id,ze.exists=od,ze.output=sd;const y0={number:Zi,bool:nd,bytes:_a,hash:id,exists:od,output:sd};ze.default=y0,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.wrapCipher=t.Hash=t.nextTick=t.isLE=t.createView=t.u32=t.u16=t.u8=void 0,t.bytesToHex=r,t.hexToBytes=c,t.hexToNumber=s,t.bytesToNumberBE=function(d){return s(r(d))},t.numberToBytesBE=function(d,h){return c(d.toString(16).padStart(2*h,"0"))},t.asyncLoop=async function(d,h,f){let m=Date.now();for(let g=0;g<d;g++){f(g);const w=Date.now()-m;w>=0&&w<h||(await(0,t.nextTick)(),m+=w)}},t.utf8ToBytes=a,t.bytesToUtf8=function(d){return new TextDecoder().decode(d)},t.toBytes=function(d){if(typeof d=="string")d=a(d);else{if(!(0,e.isBytes)(d))throw new Error("Uint8Array expected, got "+typeof d);d=u(d)}return d},t.concatBytes=function(...d){let h=0;for(let m=0;m<d.length;m++){const g=d[m];(0,e.bytes)(g),h+=g.length}const f=new Uint8Array(h);for(let m=0,g=0;m<d.length;m++){const w=d[m];f.set(w,g),g+=w.length}return f},t.checkOpts=function(d,h){if(h==null||typeof h!="object")throw new Error("options must be defined");return Object.assign(d,h)},t.equalBytes=function(d,h){if(d.length!==h.length)return!1;let f=0;for(let m=0;m<d.length;m++)f|=d[m]^h[m];return f===0},t.setBigUint64=l,t.u64Lengths=function(d,h){const f=new Uint8Array(16),m=(0,t.createView)(f);return l(m,0,BigInt(h?h.length:0),!0),l(m,8,BigInt(d.length),!0),f},t.isAligned32=function(d){return d.byteOffset%4==0},t.copyBytes=u,t.clean=function(...d){for(let h=0;h<d.length;h++)d[h].fill(0)};const e=ze;if(t.u8=d=>new Uint8Array(d.buffer,d.byteOffset,d.byteLength),t.u16=d=>new Uint16Array(d.buffer,d.byteOffset,Math.floor(d.byteLength/2)),t.u32=d=>new Uint32Array(d.buffer,d.byteOffset,Math.floor(d.byteLength/4)),t.createView=d=>new DataView(d.buffer,d.byteOffset,d.byteLength),t.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,!t.isLE)throw new Error("Non little-endian hardware is not supported");const n=Array.from({length:256},((d,h)=>h.toString(16).padStart(2,"0")));function r(d){(0,e.bytes)(d);let h="";for(let f=0;f<d.length;f++)h+=n[d[f]];return h}const i={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function o(d){return d>=i._0&&d<=i._9?d-i._0:d>=i._A&&d<=i._F?d-(i._A-10):d>=i._a&&d<=i._f?d-(i._a-10):void 0}function c(d){if(typeof d!="string")throw new Error("hex string expected, got "+typeof d);const h=d.length,f=h/2;if(h%2)throw new Error("padded hex string expected, got unpadded hex of length "+h);const m=new Uint8Array(f);for(let g=0,w=0;g<f;g++,w+=2){const p=o(d.charCodeAt(w)),C=o(d.charCodeAt(w+1));if(p===void 0||C===void 0){const _=d[w]+d[w+1];throw new Error('hex string expected, got non-hex character "'+_+'" at index '+w)}m[g]=16*p+C}return m}function s(d){if(typeof d!="string")throw new Error("hex string expected, got "+typeof d);return BigInt(d===""?"0":`0x${d}`)}
2function a(d){if(typeof d!="string")throw new Error("string expected, got "+typeof d);return new Uint8Array(new TextEncoder().encode(d))}t.nextTick=async()=>{},t.Hash=class{};function l(d,h,f,m){if(typeof d.setBigUint64=="function")return d.setBigUint64(h,f,m);const g=BigInt(32),w=BigInt(4294967295),p=Number(f>>g&w),C=Number(f&w),_=m?4:0,O=m?0:4;d.setUint32(h+_,p,m),d.setUint32(h+O,C,m)}function u(d){return Uint8Array.from(d)}t.wrapCipher=(d,h)=>(Object.assign(h,d),h)})(ut);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 Vo={},Ji={},Ao={},ad={},Sa={},ci={};Object.defineProperty(ci,"__esModule",{value:!0}),ci.crypto=void 0,ci.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.gcm=t.ctr=t.cbc=t.utils=void 0,t.randomBytes=i,t.getWebcryptoSubtle=o,t.managedNonce=function(a){return(0,n.number)(a.nonceLength),(l,...u)=>({encrypt(d,...h){const{nonceLength:f}=a,m=i(f),g=a(l,m,...u).encrypt(d,...h),w=(0,r.concatBytes)(m,g);return g.fill(0),w},decrypt(d,...h){const{nonceLength:f}=a,m=d.subarray(0,f),g=d.subarray(f);return a(l,m,...u).decrypt(g,...h)}})};const e=ci,n=ze,r=ut;function i(a=32){if(e.crypto&&typeof e.crypto.getRandomValues=="function")return e.crypto.getRandomValues(new Uint8Array(a));if(e.crypto&&typeof e.crypto.randomBytes=="function")return e.crypto.randomBytes(a);throw new Error("crypto.getRandomValues must be defined")}function o(){if(e.crypto&&typeof e.crypto.subtle=="object"&&e.crypto.subtle!=null)return e.crypto.subtle;throw new Error("crypto.subtle must be defined")}t.utils={async encrypt(a,l,u,d){const h=o(),f=await h.importKey("raw",a,l,!0,["encrypt"]),m=await h.encrypt(u,f,d);return new Uint8Array(m)},async decrypt(a,l,u,d){const h=o(),f=await h.importKey("raw",a,l,!0,["decrypt"]),m=await h.decrypt(u,f,d);return new Uint8Array(m)}};const c={CBC:"AES-CBC",CTR:"AES-CTR",GCM:"AES-GCM"};function s(a){return(l,u,d)=>{(0,n.bytes)(l),(0,n.bytes)(u);const h={name:a,length:8*l.length},f=(function(m,g,w){if(m===c.CBC)return{name:c.CBC,iv:g};if(m===c.CTR)return{name:c.CTR,counter:g,length:64};if(m===c.GCM)return w?{name:c.GCM,iv:g,additionalData:w}:{name:c.GCM,iv:g};throw new Error("unknown aes block mode")})(a,u,d);return{encrypt:m=>((0,n.bytes)(m),t.utils.encrypt(l,h,f,m)),decrypt:m=>((0,n.bytes)(m),t.utils.decrypt(l,h,f,m))}}}t.cbc=s(c.CBC),t.ctr=s(c.CTR),t.gcm=s(c.GCM)})(Sa);var cd={},De={},Yt={},ct={};function Xi(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`positive integer expected, not ${t}`)}function ld(t){if(typeof t!="boolean")throw new Error(`boolean expected, not ${t}`)}function ud(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function Ca(t,...e){if(!ud(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 dd(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Xi(t.outputLen),Xi(t.blockLen)}function hd(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 fd(t,e){Ca(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}
2Object.defineProperty(ct,"__esModule",{value:!0}),ct.isBytes=ud,ct.number=Xi,ct.bool=ld,ct.bytes=Ca,ct.hash=dd,ct.exists=hd,ct.output=fd;const v0={number:Xi,bool:ld,bytes:Ca,hash:dd,exists:hd,output:fd};ct.default=v0;var en={},li={};Object.defineProperty(li,"__esModule",{value:!0}),li.crypto=void 0,li.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Hash=t.nextTick=t.byteSwapIfBE=t.byteSwap=t.isLE=t.rotl=t.rotr=t.createView=t.u32=t.u8=void 0,t.isBytes=function(l){return l instanceof Uint8Array||l!=null&&typeof l=="object"&&l.constructor.name==="Uint8Array"},t.byteSwap32=function(l){for(let u=0;u<l.length;u++)l[u]=(0,t.byteSwap)(l[u])},t.bytesToHex=function(l){(0,n.bytes)(l);let u="";for(let d=0;d<l.length;d++)u+=r[l[d]];return u},t.hexToBytes=function(l){if(typeof l!="string")throw new Error("hex string expected, got "+typeof l);const u=l.length,d=u/2;if(u%2)throw new Error("padded hex string expected, got unpadded hex of length "+u);const h=new Uint8Array(d);for(let f=0,m=0;f<d;f++,m+=2){const g=o(l.charCodeAt(m)),w=o(l.charCodeAt(m+1));if(g===void 0||w===void 0){const p=l[m]+l[m+1];throw new Error('hex string expected, got non-hex character "'+p+'" at index '+m)}h[f]=16*g+w}return h},t.asyncLoop=async function(l,u,d){let h=Date.now();for(let f=0;f<l;f++){d(f);const m=Date.now()-h;m>=0&&m<u||(await(0,t.nextTick)(),h+=m)}},t.utf8ToBytes=c,t.toBytes=s,t.concatBytes=function(...l){let u=0;for(let h=0;h<l.length;h++){const f=l[h];(0,n.bytes)(f),u+=f.length}const d=new Uint8Array(u);for(let h=0,f=0;h<l.length;h++){const m=l[h];d.set(m,f),f+=m.length}return d},t.checkOpts=function(l,u){if(u!==void 0&&a.call(u)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(l,u)},t.wrapConstructor=function(l){const u=h=>l().update(s(h)).digest(),d=l();return u.outputLen=d.outputLen,u.blockLen=d.blockLen,u.create=()=>l(),u},t.wrapConstructorWithOpts=function(l){const u=(h,f)=>l(f).update(s(h)).digest(),d=l({});return u.outputLen=d.outputLen,u.blockLen=d.blockLen,u.create=h=>l(h),u},t.wrapXOFConstructorWithOpts=function(l){const u=(h,f)=>l(f).update(s(h)).digest(),d=l({});return u.outputLen=d.outputLen,u.blockLen=d.blockLen,u.create=h=>l(h),u},t.randomBytes=function(l=32){if(e.crypto&&typeof e.crypto.getRandomValues=="function")return e.crypto.getRandomValues(new Uint8Array(l));if(e.crypto&&typeof e.crypto.randomBytes=="function")return e.crypto.randomBytes(l);throw new Error("crypto.getRandomValues must be defined")};const e=li,n=ct;t.u8=l=>new Uint8Array(l.buffer,l.byteOffset,l.byteLength),t.u32=l=>new Uint32Array(l.buffer,l.byteOffset,Math.floor(l.byteLength/4)),t.createView=l=>new DataView(l.buffer,l.byteOffset,l.byteLength),t.rotr=(l,u)=>l<<32-u|l>>>u,t.rotl=(l,u)=>l<<u|l>>>32-u>>>0,t.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,t.byteSwap=l=>l<<24&4278190080|l<<8&16711680|l>>>8&65280|l>>>24&255,t.byteSwapIfBE=t.isLE?l=>l:l=>(0,t.byteSwap)(l);const r=Array.from({length:256},((l,u)=>u.toString(16).padStart(2,"0"))),i={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function o(l){return l>=i._0&&l<=i._9?l-i._0:l>=i._A&&l<=i._F?l-(i._A-10):l>=i._a&&l<=i._f?l-(i._a-10):void 0}function c(l){if(typeof l!="string")throw new Error("utf8ToBytes expected string, got "+typeof l);return new Uint8Array(new TextEncoder().encode(l))}function s(l){return typeof l=="string"&&(l=c(l)),(0,n.bytes)(l),l}t.nextTick=async()=>{},t.Hash=class{clone(){return this._cloneInto()}};const a={}.toString})(en),Object.defineProperty(Yt,"__esModule",{value:!0}),Yt.HashMD=Yt.Maj=Yt.Chi=void 0;const Wo=ct,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,Wo.exists)(this);const{view:e,buffer:n,blockLen:r}=this,i=(t=(0,mr.toBytes)(t)).length;for(let o=0;o<i;){const c=Math.min(r-this.pos,i-o);if(c!==r)n.set(t.subarray(o,o+c),this.pos),this.pos+=c,o+=c,this.pos===r&&(this.process(e,0),this.pos=0);else{const s=(0,mr.createView)(t);for(;r<=i-o;o+=r)this.process(s,o)}}return this.length+=t.length,this.roundClean(),this}digestInto(t){(0,Wo.exists)(this),(0,Wo.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);
vendor: 1,180 bytes, line 2
2const m=BigInt(32),g=BigInt(4294967295),w=Number(h>>m&g),p=Number(h&g),C=f?4:0,_=f?0:4;u.setUint32(d+C,w,f),u.setUint32(d+_,p,f)})(n,r-8,BigInt(8*this.length),i),this.process(n,0);const c=(0,mr.createView)(t),s=this.outputLen;if(s%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const a=s/4,l=this.get();if(a>l.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<a;u++)c.setUint32(4*u,l[u],i)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:n,length:r,finished:i,destroyed:o,pos:c}=this;return t.length=r,t.pos=c,t.finished=i,t.destroyed=o,r%e&&t.buffer.set(n),t}};var pe={};Object.defineProperty(pe,"__esModule",{value:!0}),pe.add5L=pe.add5H=pe.add4H=pe.add4L=pe.add3H=pe.add3L=pe.rotlBL=pe.rotlBH=pe.rotlSL=pe.rotlSH=pe.rotr32L=pe.rotr32H=pe.rotrBL=pe.rotrBH=pe.rotrSL=pe.rotrSH=pe.shrSL=pe.shrSH=pe.toBig=void 0,pe.fromBig=ka,pe.split=pd,pe.add=Td;const ui=BigInt(2**32-1),$s=BigInt(32);function ka(t,e=!1){return e?{h:Number(t&ui),l:Number(t>>$s&ui)}:{h:0|Number(t>>$s&ui),l:0|Number(t&ui)}}
vendor: 2,594 bytes, line 2
2function pd(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let i=0;i<t.length;i++){const{h:o,l:c}=ka(t[i],e);[n[i],r[i]]=[o,c]}return[n,r]}const md=(t,e)=>BigInt(t>>>0)<<$s|BigInt(e>>>0);pe.toBig=md;const gd=(t,e,n)=>t>>>n;pe.shrSH=gd;const yd=(t,e,n)=>t<<32-n|e>>>n;pe.shrSL=yd;const vd=(t,e,n)=>t>>>n|e<<32-n;pe.rotrSH=vd;const bd=(t,e,n)=>t<<32-n|e>>>n;pe.rotrSL=bd;const wd=(t,e,n)=>t<<64-n|e>>>n-32;pe.rotrBH=wd;const Ed=(t,e,n)=>t>>>n-32|e<<64-n;pe.rotrBL=Ed;const _d=(t,e)=>e;pe.rotr32H=_d;const Sd=(t,e)=>t;pe.rotr32L=Sd;const Cd=(t,e,n)=>t<<n|e>>>32-n;pe.rotlSH=Cd;const kd=(t,e,n)=>e<<n|t>>>32-n;pe.rotlSL=kd;const Ad=(t,e,n)=>e<<n-32|t>>>64-n;pe.rotlBH=Ad;const xd=(t,e,n)=>t<<n-32|e>>>64-n;function Td(t,e,n,r){const i=(e>>>0)+(r>>>0);return{h:t+n+(i/2**32|0)|0,l:0|i}}pe.rotlBL=xd;const Md=(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0);pe.add3L=Md;const Rd=(t,e,n,r)=>e+n+r+(t/2**32|0)|0;pe.add3H=Rd;const Od=(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0);pe.add4L=Od;const Pd=(t,e,n,r,i)=>e+n+r+i+(t/2**32|0)|0;pe.add4H=Pd;const Id=(t,e,n,r,i)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(i>>>0);pe.add5L=Id;const Ld=(t,e,n,r,i,o)=>e+n+r+i+o+(t/2**32|0)|0;pe.add5H=Ld;const b0={fromBig:ka,split:pd,toBig:md,shrSH:gd,shrSL:yd,rotrSH:vd,rotrSL:bd,rotrBH:wd,rotrBL:Ed,rotr32H:_d,rotr32L:Sd,rotlSH:Cd,rotlSL:kd,rotlBH:Ad,rotlBL:xd,add:Td,add3L:Md,add3H:Rd,add4L:Od,add4H:Pd,add5H:Ld,add5L:Id};pe.default=b0,Object.defineProperty(De,"__esModule",{value:!0}),De.sha384=De.sha512_256=De.sha512_224=De.sha512=De.SHA384=De.SHA512_256=De.SHA512_224=De.SHA512=void 0;const w0=Yt,ye=pe,di=en,[E0,_0]=ye.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
25771202a","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 Yr extends w0.HashMD{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:n,Bh:r,Bl:i,Ch:o,Cl:c,Dh:s,Dl:a,Eh:l,El:u,Fh:d,Fl:h,Gh:f,Gl:m,Hh:g,Hl:w}=this;return[e,n,r,i,o,c,s,a,l,u,d,h,f,m,g,w]}set(e,n,r,i,o,c,s,a,l,u,d,h,f,m,g,w){this.Ah=0|e,this.Al=0|n,this.Bh=0|r,this.Bl=0|i,this.Ch=0|o,this.Cl=0|c,this.Dh=0|s,this.Dl=0|a,this.Eh=0|l,this.El=0|u,this.Fh=0|d,this.Fl=0|h,this.Gh=0|f,this.Gl=0|m,this.Hh=0|g,this.Hl=0|w}process(e,n){for(let _=0;_<16;_++,n+=4)tn[_]=e.getUint32(n),nn[_]=e.getUint32(n+=4);for(let _=16;_<80;_++){const O=0|tn[_-15],L=0|nn[_-15],U=ye.default.rotrSH(O,L,1)^ye.default.rotrSH(O,L,8)^ye.default.shrSH(O,L,7),q=ye.default.rotrSL(O,L,1)^ye.default.rotrSL(O,L,8)^ye.default.shrSL(O,L,7),F=0|tn[_-2],B=0|nn[_-2],N=ye.default.rotrSH(F,B,19)^ye.default.rotrBH(F,B,61)^ye.default.shrSH(F,B,6),H=ye.default.rotrSL(F,B,19)^ye.default.rotrBL(F,B,61)^ye.default.shrSL(F,B,6),$=ye.default.add4L(q,H,nn[_-7],nn[_-16]),P=ye.default.add4H($,U,N,tn[_-7],tn[_-16]);tn[_]=0|P,nn[_]=0|$}let{Ah:r,Al:i,Bh:o,Bl:c,Ch:s,Cl:a,Dh:l,Dl:u,Eh:d,El:h,Fh:f,Fl:m,Gh:g,Gl:w,Hh:p,Hl:C}=this;for(let _=0;_<80;_++){const O=ye.default.rotrSH(d,h,14)^ye.default.rotrSH(d,h,18)^ye.default.rotrBH(d,h,41),L=ye.default.rotrSL(d,h,14)^ye.default.rotrSL(d,h,18)^ye.default.rotrBL(d,h,41),U=d&f^~d&g,q=h&m^~h&w,F=ye.default.add5L(C,L,q,_0[_],nn[_]),B=ye.default.add5H(F,p,O,U,E0[_],tn[_]),N=0|F,H=ye.default.rotrSH(r,i,28)^ye.default.rotrBH(r,i,34)^ye.default.rotrBH(r,i,39),$=ye.default.rotrSL(r,i,28)^ye.default.rotrBL(r,i,34)^ye.default.rotrBL(r,i,39),P=r&o^r&s^o&s,M=i&c^i&a^c&a;p=0|g,C=0|w,g=0|f,w=0|m,f=0|d,m=0|h,{h:d,l:h}=ye.default.add(0|l,0|u,0|B,0|N),l=0|s,u=0|a,s=0|o,a=0|c,o=0|r,c=0|i;const S=ye.default.add3L(N,$,M);r=ye.default.add3H(S,B,H,P),i=0|S}({h:r,l:i}=ye.default.add(0|this.Ah,0|this.Al,0|r,0|i)),{h:o,l:c}=ye.default.add(0|this.Bh,0|this.Bl,0|o,0|c),{h:s,l:a}=ye.default.add(0|this.Ch,0|this.Cl,0|s,0|a),{h:l,l:u}=ye.default.add(0|this.Dh,0|this.Dl,0|l,0|u),{h:d,l:h}=ye.default.add(0|this.Eh,0|this.El,0|d,0|h),{h:f,l:m}=ye.default.add(0|this.Fh,0|this.Fl,0|f,0|m),{h:g,l:w}=ye.default.add(0|this.Gh,0|this.Gl,0|g,0|w),{h:p,l:C}=ye.default.add(0|this.Hh,0|this.Hl,0|p,0|C),this.set(r,i,o,c,s,a,l,u,d,h,f,m,g,w,p,C)}roundClean(){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)}}De.SHA512=Yr;class Nd extends Yr{constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}}De.SHA512_224=Nd;class Dd extends Yr{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}De.SHA512_256=Dd;class kc extends Yr{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}De.SHA384=kc,De.sha512=(0,di.wrapConstructor)((()=>new Yr)),De.sha512_224=(0,di.wrapConstructor)((()=>new Nd)),De.sha512_256=(0,di.wrapConstructor)((()=>new Dd)),De.sha384=(0,di.wrapConstructor)((()=>new kc));var Ks={},Gn={},Ce={},ve={};
2Object.defineProperty(ve,"__esModule",{value:!0}),ve.notImplemented=ve.bitMask=void 0,ve.isBytes=Qi,ve.abytes=eo,ve.abool=function(t,e){if(typeof e!="boolean")throw new Error(`${t} must be valid boolean, got "${e}".`)},ve.bytesToHex=Go,ve.numberToHexUnpadded=Ac,ve.hexToNumber=Yo,ve.hexToBytes=Pi,ve.bytesToNumberBE=function(t){return Yo(Go(t))},ve.bytesToNumberLE=function(t){return eo(t),Yo(Go(Uint8Array.from(t).reverse()))},ve.numberToBytesBE=Tc,ve.numberToBytesLE=function(t,e){return Tc(t,e).reverse()},ve.numberToVarBytesBE=function(t){return Pi(Ac(t))},ve.ensureBytes=function(t,e,n){let r;if(typeof e=="string")try{r=Pi(e)}catch(o){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${o}`)}else{if(!Qi(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},ve.concatBytes=Mc,ve.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},ve.utf8ToBytes=function(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))},ve.inRange=Rc,ve.aInRange=function(t,e,n,r){if(!Rc(e,n,r))throw new Error(`expected valid ${t}: ${n} <= n < ${r}, got ${typeof e} ${e}`)},ve.bitLen=function(t){let e;for(e=0;t>js;t>>=Oi,e+=1);return e},ve.bitGet=function(t,e){return t>>BigInt(e)&Oi},ve.bitSet=function(t,e,n){return t|(n?Oi:js)<<BigInt(e)},ve.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=Jo(t),i=Jo(t),o=0;const c=()=>{r.fill(1),i.fill(0),o=0},s=(...u)=>n(i,r,...u),a=(u=Jo())=>{i=s(Oc([0]),u),r=s(),u.length!==0&&(i=s(Oc([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 Mc(...d)};return(u,d)=>{let h;for(c(),a(u);!(h=d(l()));)a();return c(),h}},ve.validateObject=function(t,e,n={}){const r=(i,o,c)=>{const s=k0[o];if(typeof s!="function")throw new Error(`Invalid validator "${o}", expected function`);const a=t[i];if(!(c&&a===void 0||s(a,t)))throw new Error(`Invalid param ${String(i)}=${a} (${typeof a}), expected ${o}`)};for(const[i,o]of Object.entries(e))r(i,o,!1);for(const[i,o]of Object.entries(n))r(i,o,!0);return t},ve.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 js=BigInt(0),Oi=BigInt(1),S0=BigInt(2);function Qi(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function eo(t){if(!Qi(t))throw new Error("Uint8Array expected")}const C0=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function Go(t){eo(t);let e="";for(let n=0;n<t.length;n++)e+=C0[t[n]];return e}function Ac(t){const e=t.toString(16);return 1&e.length?`0${e}`:e}function Yo(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 xc(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 Pi(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length,n=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(n);for(let i=0,o=0;i<n;i++,o+=2){const c=xc(t.charCodeAt(o)),s=xc(t.charCodeAt(o+1));if(c===void 0||s===void 0){const a=t[o]+t[o+1];throw new Error('hex string expected, got non-hex character "'+a+'" at index '+o)}r[i]=16*c+s}return r}function Tc(t,e){return Pi(t.toString(16).padStart(2*e,"0"))}function Mc(...t){let e=0;for(let r=0;r<t.length;r++){const i=t[r];eo(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 Zo=t=>typeof t=="bigint"&&js<=t;function Rc(t,e,n){return Zo(t)&&Zo(e)&&Zo(n)&&e<=t&&t<n}ve.bitMask=t=>(S0<<BigInt(t-1))-Oi;const Jo=t=>new Uint8Array(t),Oc=t=>Uint8Array.from(t),k0={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"||Qi(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)};ve.notImplemented=()=>{throw new Error("not implemented")}
2,Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.isNegativeLE=void 0,Ce.mod=st,Ce.pow=Bd,Ce.pow2=function(t,e,n){let r=t;for(;e-- >Be;)r*=r,r%=n;return r},Ce.invert=hi,Ce.tonelliShanks=$d,Ce.FpSqrt=Lc,Ce.validateField=function(t){const e=x0.reduce(((n,r)=>(n[r]="function",n)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"});return(0,it.validateObject)(t,e)},Ce.FpPow=Nc,Ce.FpInvertBatch=Dc,Ce.FpDiv=function(t,e,n){return t.mul(e,typeof n=="bigint"?hi(n,t.ORDER):t.inv(n))},Ce.FpLegendre=Bc,Ce.FpIsSquare=function(t){const e=Bc(t.ORDER);return n=>{const r=e(t,n);return t.eql(r,t.ZERO)||t.eql(r,t.ONE)}},Ce.nLength=Xo,Ce.Field=function(t,e,n=!1,r={}){if(t<=Be)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:o}=Xo(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const c=Lc(t),s=Object.freeze({ORDER:t,BITS:i,BYTES:o,MASK:(0,it.bitMask)(i),ZERO:Be,ONE:ke,create:a=>st(a,t),isValid:a=>{if(typeof a!="bigint")throw new Error("Invalid field element: expected bigint, got "+typeof a);return Be<=a&&a<t},is0:a=>a===Be,isOdd:a=>(a&ke)===ke,neg:a=>st(-a,t),eql:(a,l)=>a===l,sqr:a=>st(a*a,t),add:(a,l)=>st(a+l,t),sub:(a,l)=>st(a-l,t),mul:(a,l)=>st(a*l,t),pow:(a,l)=>Nc(s,a,l),div:(a,l)=>st(a*hi(l,t),t),sqrN:a=>a*a,addN:(a,l)=>a+l,subN:(a,l)=>a-l,mulN:(a,l)=>a*l,inv:a=>hi(a,t),sqrt:r.sqrt||(a=>c(s,a)),invertBatch:a=>Dc(s,a),cmov:(a,l,u)=>u?l:a,toBytes:a=>n?(0,it.numberToBytesLE)(a,o):(0,it.numberToBytesBE)(a,o),fromBytes:a=>{if(a.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${a.length}`);return n?(0,it.bytesToNumberLE)(a):(0,it.bytesToNumberBE)(a)}});return Object.freeze(s)},Ce.FpSqrtOdd=function(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const n=t.sqrt(e);return t.isOdd(n)?n:t.neg(n)},Ce.FpSqrtEven=function(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const n=t.sqrt(e);return t.isOdd(n)?t.neg(n):n},Ce.hashToPrivateScalar=function(t,e,n=!1){t=(0,it.ensureBytes)("privateHash",t);const r=t.length,i=Xo(e).nByteLength+8;if(i<24||r<i||r>1024)throw new Error(`hashToPrivateScalar: expected ${i}-1024 bytes of input, got ${r}`);const o=n?(0,it.bytesToNumberLE)(t):(0,it.bytesToNumberBE)(t);return st(o,e-ke)+ke},Ce.getFieldBytesLength=Hs,Ce.getMinHashLength=$c,Ce.mapHashToField=function(t,e,n=!1){const r=t.length,i=Hs(e),o=$c(e);if(r<16||r<o||r>1024)throw new Error(`expected ${o}-1024 bytes of input, got ${r}`);const c=st(n?(0,it.bytesToNumberBE)(t):(0,it.bytesToNumberLE)(t),e-ke)+ke;return n?(0,it.numberToBytesLE)(c,i):(0,it.numberToBytesBE)(c,i)};const it=ve,Be=BigInt(0),ke=BigInt(1),yn=BigInt(2),A0=BigInt(3),Us=BigInt(4),Pc=BigInt(5),Ic=BigInt(8);function st(t,e){const n=t%e;return n>=Be?n:e+n}function Bd(t,e,n){if(n<=Be||e<Be)throw new Error("Expected power/modulo > 0");if(n===ke)return Be;let r=ke;for(;e>Be;)e&ke&&(r=r*t%n),t=t*t%n,e>>=ke;return r}function hi(t,e){if(t===Be||e<=Be)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=st(t,e),r=e,i=Be,o=ke;for(;n!==Be;){const c=r%n,s=i-o*(r/n);r=n,n=c,i=o,o=s}if(r!==ke)throw new Error("invert: does not exist");return st(i,e)}function $d(t){const e=(t-ke)/yn;let n,r,i;for(n=t-ke,r=0;n%yn===Be;n/=yn,r++);for(i=yn;i<t&&Bd(i,e,t)!==t-ke;i++);if(r===1){const c=(t+ke)/Us;return function(s,a){const l=s.pow(a,c);if(!s.eql(s.sqr(l),a))throw new Error("Cannot find square root");return l}}const o=(n+ke)/yn;return function(c,s){if(c.pow(s,e)===c.neg(c.ONE))throw new Error("Cannot find square root");let a=r,l=c.pow(c.mul(c.ONE,i),n),u=c.pow(s,o),d=c.pow(s,n);for(;!c.eql(d,c.ONE);){if(c.eql(d,c.ZERO))return c.ZERO;let h=1;for(let m=c.sqr(d);h<a&&!c.eql(m,c.ONE);h++)m=c.sqr(m);const f=c.pow(l,ke<<BigInt(a-h-1));l=c.sqr(f),u=c.mul(u,f),d=c.mul(d,l),a=h}return u}}function Lc(t){if(t%Us===A0){const e=(t+ke)/Us;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%Ic===Pc){const e=(t-Pc)/Ic;return function(n,r){const i=n.mul(r,yn),o=n.pow(i,e),c=n.mul(r,o),s=n.mul(n.mul(c,yn),o),a=n.mul(c,n.sub(s,n.ONE));if(!n.eql(n.sqr(a),r))throw new Error("Cannot find square root");return a}}return $d(t)}BigInt(9),BigInt(16);Ce.isNegativeLE=(t,e)=>(st(t,e)&ke)===ke;const x0=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Nc(t,e,n){if(n<Be)throw new Error("Expected power > 0");if(n===Be)return t.ONE;if(n===ke)return e;let r=t.ONE,i=e;for(;n>Be;)n&ke&&(r=t.mul(r,i)),i=t.sqr(i),n>>=ke;return r}function Dc(t,e){const n=new Array(e.length),r=e.reduce(((o,c,s)=>t.is0(c)?o:(n[s]=o,t.mul(o,c))),t.ONE),i=t.inv(r);return e.reduceRight(((o,c,s)=>t.is0(c)?o:(n[s]=t.mul(o,n[s]),t.mul(o,c))),i),n}function Bc(t){const e=(t-ke)/yn;return(n,r)=>n.pow(r,e)}function Xo(t,e){const n=e!==void 0?e:t.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function Hs(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 $c(t){const e=Hs(t);return e+Math.ceil(e/2)}Object.defineProperty(Gn,"__esModule",{value:!0}),Gn.wNAF=function(t,e){const n=(o,c)=>{const s=c.negate();return o?s:c},r=o=>{if(!Number.isSafeInteger(o)||o<=0||o>e)throw new Error(`Wrong window size=${o}, should be [1..${e}]`)},i=o=>(r(o),{windows:Math.ceil(e/o)+1,windowSize:2**(o-1)});return{constTimeNegate:n,unsafeLadder(o,c){let s=t.ZERO,a=o;for(;c>T0;)c&Qo&&(s=s.add(a)),a=a.double(),c>>=Qo;return s}
2,precomputeWindow(o,c){const{windows:s,windowSize:a}=i(c),l=[];let u=o,d=u;for(let h=0;h<s;h++){d=u,l.push(d);for(let f=1;f<a;f++)d=d.add(u),l.push(d);u=d.double()}return l},wNAF(o,c,s){const{windows:a,windowSize:l}=i(o);let u=t.ZERO,d=t.BASE;const h=BigInt(2**o-1),f=2**o,m=BigInt(o);for(let g=0;g<a;g++){const w=g*l;let p=Number(s&h);s>>=m,p>l&&(p-=f,s+=Qo);const C=w,_=w+Math.abs(p)-1,O=g%2!=0,L=p<0;p===0?d=d.add(n(O,c[C])):u=u.add(n(L,c[_]))}return{p:u,f:d}},wNAFCached(o,c,s){const a=Uc.get(o)||1;let l=es.get(o);return l||(l=this.precomputeWindow(o,a),a!==1&&es.set(o,s(l))),this.wNAF(a,l,c)},setWindowSize(o,c){r(c),Uc.set(o,c),es.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,jc.bitLen)(BigInt(n.length)),o=i>12?i-3:i>4?i-2:i?2:1,c=(1<<o)-1,s=new Array(c+1).fill(t.ZERO),a=Math.floor((e.BITS-1)/o)*o;let l=t.ZERO;for(let u=a;u>=0;u-=o){s.fill(t.ZERO);for(let h=0;h<r.length;h++){const f=r[h],m=Number(f>>BigInt(u)&BigInt(c));s[m]=s[m].add(n[h])}let d=t.ZERO;for(let h=s.length-1,f=t.ZERO;h>0;h--)f=f.add(s[h]),d=d.add(f);if(l=l.add(d),u!==0)for(let h=0;h<o;h++)l=l.double()}return l},Gn.validateBasic=function(t){return(0,Kc.validateField)(t.Fp),(0,jc.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,jc=ve,T0=BigInt(0),Qo=BigInt(1),es=new WeakMap,Uc=new WeakMap;Object.defineProperty(Ks,"__esModule",{value:!0}),Ks.twistedEdwards=function(t){const e=(function(P){const M=(0,ts.validateBasic)(P);return et.validateObject(P,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...M})})(t),{Fp:n,n:r,prehash:i,hash:o,randomBytes:c,nByteLength:s,h:a}=e,l=fi<<BigInt(8*s)-tt,u=n.create,d=(0,Hc.Field)(e.n,e.nBitLength),h=e.uvRatio||((P,M)=>{try{return{isValid:!0,value:n.sqrt(P*n.inv(M))}}catch{return{isValid:!1,value:wt}}}),f=e.adjustScalarBytes||(P=>P),m=e.domain||((P,M,S)=>{if((0,ot.abool)("phflag",S),M.length||S)throw new Error("Contexts/pre-hash are not supported");return P});function g(P,M){et.aInRange("coordinate "+P,M,wt,l)}function w(P){if(!(P instanceof _))throw new Error("ExtendedPoint expected")}const p=(0,ot.memoized)(((P,M)=>{const{ex:S,ey:I,ez:j}=P,y=P.is0();M==null&&(M=y?M0:n.inv(j));const E=u(S*M),A=u(I*M),T=u(j*M);if(y)return{x:wt,y:tt};if(T!==tt)throw new Error("invZ was invalid");return{x:E,y:A}})),C=(0,ot.memoized)((P=>{const{a:M,d:S}=e;if(P.is0())throw new Error("bad point: ZERO");const{ex:I,ey:j,ez:y,et:E}=P,A=u(I*I),T=u(j*j),b=u(y*y),v=u(b*b),k=u(A*M);if(u(b*u(k+T))!==u(v+u(S*u(A*T))))throw new Error("bad point: equation left != right (1)");if(u(I*j)!==u(y*E))throw new Error("bad point: equation left != right (2)");return!0}));class _{constructor(M,S,I,j){this.ex=M,this.ey=S,this.ez=I,this.et=j,g("x",M),g("y",S),g("z",I),g("t",j),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(M){if(M instanceof _)throw new Error("extended point not allowed");const{x:S,y:I}=M||{};return g("x",S),g("y",I),new _(S,I,tt,u(S*I))}static normalizeZ(M){const S=n.invertBatch(M.map((I=>I.ez)));return M.map(((I,j)=>I.toAffine(S[j]))).map(_.fromAffine)}static msm(M,S){return(0,ts.pippenger)(_,d,M,S)}_setWindowSize(M){U.setWindowSize(this,M)}assertValidity(){C(this)}equals(M){w(M);const{ex:S,ey:I,ez:j}=this,{ex:y,ey:E,ez:A}=M,T=u(S*A),b=u(y*j),v=u(I*A),k=u(E*j);return T===b&&v===k}is0(){return this.equals(_.ZERO)}negate(){return new _(u(-this.ex),this.ey,this.ez,u(-this.et))}double(){const{a:M}=e,{ex:S,ey:I,ez:j}=this,y=u(S*S),E=u(I*I),A=u(fi*u(j*j)),T=u(M*y),b=S+I,v=u(u(b*b)-y-E),k=T+E,x=k-A,R=T-E,D=u(v*x),K=u(k*R),z=u(v*R),V=u(x*k);return new _(D,K,V,z)}add(M){w(M);const{a:S,d:I}=e,{ex:j,ey:y,ez:E,et:A}=this,{ex:T,ey:b,ez:v,et:k}=M;
2if(S===BigInt(-1)){const ie=u((y-j)*(b+T)),ce=u((y+j)*(b-T)),se=u(ce-ie);if(se===wt)return this.double();const he=u(E*fi*k),ge=u(A*fi*v),le=ge+he,fe=ce+ie,me=ge-he,Ae=u(le*se),Ie=u(fe*me),Io=u(le*me),Lo=u(se*fe);return new _(Ae,Ie,Lo,Io)}const x=u(j*T),R=u(y*b),D=u(A*I*k),K=u(E*v),z=u((j+y)*(T+b)-x-R),V=K-D,Z=K+D,Q=u(R-S*x),ne=u(z*V),oe=u(Z*Q),ue=u(z*Q),re=u(V*Z);return new _(ne,oe,re,ue)}subtract(M){return this.add(M.negate())}wNAF(M){return U.wNAFCached(this,M,_.normalizeZ)}multiply(M){const S=M;et.aInRange("scalar",S,tt,r);const{p:I,f:j}=this.wNAF(S);return _.normalizeZ([I,j])[0]}multiplyUnsafe(M){const S=M;return et.aInRange("scalar",S,wt,r),S===wt?L:this.equals(L)||S===tt?this:this.equals(O)?this.wNAF(S).p:U.unsafeLadder(this,S)}isSmallOrder(){return this.multiplyUnsafe(a).is0()}isTorsionFree(){return U.unsafeLadder(this,r).is0()}toAffine(M){return p(this,M)}clearCofactor(){const{h:M}=e;return M===tt?this:this.multiplyUnsafe(M)}static fromHex(M,S=!1){const{d:I,a:j}=e,y=n.BYTES;M=(0,ot.ensureBytes)("pointHex",M,y),(0,ot.abool)("zip215",S);const E=M.slice(),A=M[y-1];E[y-1]=-129&A;const T=et.bytesToNumberLE(E),b=S?l:n.ORDER;et.aInRange("pointHex.y",T,wt,b);const v=u(T*T),k=u(v-tt),x=u(I*v-j);let{isValid:R,value:D}=h(k,x);if(!R)throw new Error("Point.fromHex: invalid y coordinate");const K=(D&tt)===tt,z=(128&A)!=0;if(!S&&D===wt&&z)throw new Error("Point.fromHex: x=0 and x_0=1");return z!==K&&(D=u(-D)),_.fromAffine({x:D,y:T})}static fromPrivateKey(M){return B(M).point}toRawBytes(){const{x:M,y:S}=this.toAffine(),I=et.numberToBytesLE(S,n.BYTES);return I[I.length-1]|=M&tt?128:0,I}toHex(){return et.bytesToHex(this.toRawBytes())}}_.BASE=new _(e.Gx,e.Gy,tt,u(e.Gx*e.Gy)),_.ZERO=new _(wt,tt,tt,wt);const{BASE:O,ZERO:L}=_,U=(0,ts.wNAF)(_,8*s);function q(P){return(0,Hc.mod)(P,r)}function F(P){return q(et.bytesToNumberLE(P))}function B(P){const M=s;P=(0,ot.ensureBytes)("private key",P,M);const S=(0,ot.ensureBytes)("hashed private key",o(P),2*M),I=f(S.slice(0,M)),j=S.slice(M,2*M),y=F(I),E=O.multiply(y),A=E.toRawBytes();return{head:I,prefix:j,scalar:y,point:E,pointBytes:A}}function N(P=new Uint8Array,...M){const S=et.concatBytes(...M);return F(o(m(S,(0,ot.ensureBytes)("context",P),!!i)))}const H=R0;return O._setWindowSize(8),{CURVE:e,getPublicKey:function(P){return B(P).pointBytes},sign:function(P,M,S={}){P=(0,ot.ensureBytes)("message",P),i&&(P=i(P));const{prefix:I,scalar:j,pointBytes:y}=B(M),E=N(S.context,I,P),A=O.multiply(E).toRawBytes(),T=q(E+N(S.context,A,y,P)*j);et.aInRange("signature.s",T,wt,r);const b=et.concatBytes(A,et.numberToBytesLE(T,n.BYTES));return(0,ot.ensureBytes)("result",b,2*s)},verify:function(P,M,S,I=H){const{context:j,zip215:y}=I,E=n.BYTES;P=(0,ot.ensureBytes)("signature",P,2*E),M=(0,ot.ensureBytes)("message",M),y!==void 0&&(0,ot.abool)("zip215",y),i&&(M=i(M));const A=et.bytesToNumberLE(P.slice(E,2*E));let T,b,v;try{T=_.fromHex(S,y),b=_.fromHex(P.slice(0,E),y),v=O.multiplyUnsafe(A)}catch{return!1}if(!y&&T.isSmallOrder())return!1;const k=N(j,b.toRawBytes(),T.toRawBytes(),M);return b.add(T.multiplyUnsafe(k)).subtract(v).clearCofactor().equals(_.ZERO)},ExtendedPoint:_,utils:{getExtendedPublicKey:B,randomPrivateKey:()=>c(n.BYTES),precompute:(P=8,M=_.BASE)=>(M._setWindowSize(P),M.multiply(BigInt(3)),M)}}};const ts=Gn,Hc=Ce,et=ve,ot=ve,wt=BigInt(0),tt=BigInt(1),fi=BigInt(2),M0=BigInt(8),R0={zip215:!0};var dn={};Object.defineProperty(dn,"__esModule",{value:!0}),dn.expand_message_xmd=Kd,dn.expand_message_xof=jd,dn.hash_to_field=ns,dn.isogenyMap=function(t,e){const n=e.map((r=>Array.from(r).reverse()));return(r,i)=>{const[o,c,s,a]=n.map((l=>l.reduce(((u,d)=>t.add(t.mul(u,r),d)))));return r=t.div(o,c),i=t.mul(i,t.div(s,a)),{x:r,y:i}}},dn.createHasher=function(t,e,n){if(typeof e!="function")throw new Error("mapToCurve() must be defined");return{hashToCurve(r,i){const o=ns(r,2,{...n,DST:n.DST,...i}),c=t.fromAffine(e(o[0])),s=t.fromAffine(e(o[1])),a=c.add(s).clearCofactor();return a.assertValidity(),a},encodeToCurve(r,i){const o=ns(r,1,{...n,DST:n.encodeDST,...i}),c=t.fromAffine(e(o[0])).clearCofactor();return c.assertValidity(),c},mapToCurve(r){if(!Array.isArray(r))throw new Error("mapToCurve: expected array of bigints");for(const o of r)if(typeof o!="bigint")throw new Error(`mapToCurve: expected array of bigints, got ${o} in array`);const i=t.fromAffine(e(r)).clearCofactor();return i.assertValidity(),i}}};const O0=Ce,qe=ve,P0=qe.bytesToNumberBE;function hn(t,e){if(Lr(t),Lr(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 I0(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 Lr(t){if(!Number.isSafeInteger(t))throw new Error("number expected")}function Kd(t,e,n,r){(0,qe.abytes)(t),(0,qe.abytes)(e),Lr(n),e.length>255&&(e=r((0,qe.concatBytes)((0,qe.utf8ToBytes)("H2C-OVERSIZE-DST-"),e)));const{outputLen:i,blockLen:o}=r,c=Math.ceil(n/i);if(n>65535||c>
2255)throw new Error("expand_message_xmd: invalid lenInBytes");const s=(0,qe.concatBytes)(e,hn(e.length,1)),a=hn(0,o),l=hn(n,2),u=new Array(c),d=r((0,qe.concatBytes)(a,t,l,hn(0,1),s));u[0]=r((0,qe.concatBytes)(d,hn(1,1),s));for(let h=1;h<=c;h++){const f=[I0(d,u[h-1]),hn(h+1,1),s];u[h]=r((0,qe.concatBytes)(...f))}return(0,qe.concatBytes)(...u).slice(0,n)}function jd(t,e,n,r,i){if((0,qe.abytes)(t),(0,qe.abytes)(e),Lr(n),e.length>255){const o=Math.ceil(2*r/8);e=i.create({dkLen:o}).update((0,qe.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(e).digest()}if(n>65535||e.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return i.create({dkLen:n}).update(t).update(hn(n,2)).update(e).update(hn(e.length,1)).digest()}function ns(t,e,n){(0,qe.validateObject)(n,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:r,k:i,m:o,hash:c,expand:s,DST:a}=n;(0,qe.abytes)(t),Lr(e);const l=typeof a=="string"?(0,qe.utf8ToBytes)(a):a,u=r.toString(2).length,d=Math.ceil((u+i)/8),h=e*o*d;let f;if(s==="xmd")f=Kd(t,l,h,c);else if(s==="xof")f=jd(t,l,h,i,c);else{if(s!=="_internal_pass")throw new Error('expand must be "xmd" or "xof"');f=t}const m=new Array(e);for(let g=0;g<e;g++){const w=new Array(o);for(let p=0;p<o;p++){const C=d*(p+g*o),_=f.subarray(C,C+d);w[p]=(0,O0.mod)(P0(_),r)}m[g]=w}return m}var Fs={};Object.defineProperty(Fs,"__esModule",{value:!0}),Fs.montgomery=function(t){const e=(function(g){return(0,rn.validateObject)(g,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...g})})(t),{P:n}=e,r=g=>(0,Fc.mod)(g,n),i=e.montgomeryBits,o=Math.ceil(i/8),c=e.nByteLength,s=e.adjustScalarBytes||(g=>g),a=e.powPminus2||(g=>(0,Fc.pow)(g,n-BigInt(2),n));function l(g,w,p){const C=r(g*(w-p));return[w=r(w-C),p=r(p+C)]}const u=(e.a-BigInt(2))/BigInt(4);function d(g){return(0,rn.numberToBytesLE)(r(g),o)}function h(g,w){const p=(function(O){const L=(0,rn.ensureBytes)("u coordinate",O,o);return c===32&&(L[31]&=127),(0,rn.bytesToNumberLE)(L)})(w),C=(function(O){const L=(0,rn.ensureBytes)("scalar",O),U=L.length;if(U!==o&&U!==c)throw new Error(`Expected ${o} or ${c} bytes, got ${U}`);return(0,rn.bytesToNumberLE)(s(L))})(g),_=(function(O,L){(0,rn.aInRange)("u",O,Hn,n),(0,rn.aInRange)("scalar",L,Hn,n);const U=L,q=O;let F,B=rs,N=Hn,H=O,$=rs,P=Hn;for(let S=BigInt(i-1);S>=Hn;S--){const I=U>>S&rs;P^=I,F=l(P,B,H),B=F[0],H=F[1],F=l(P,N,$),N=F[0],$=F[1],P=I;const j=B+N,y=r(j*j),E=B-N,A=r(E*E),T=y-A,b=H+$,v=r((H-$)*j),k=r(b*E),x=v+k,R=v-k;H=r(x*x),$=r(q*r(R*R)),B=r(y*A),N=r(T*(y+r(u*T)))}F=l(P,B,H),B=F[0],H=F[1],F=l(P,N,$),N=F[0],$=F[1];const M=a(N);return r(B*M)})(p,C);if(_===Hn)throw new Error("Invalid private or public key received");return d(_)}const f=d(e.Gu);function m(g){return h(g,f)}return{scalarMult:h,scalarMultBase:m,getSharedSecret:(g,w)=>h(g,w),getPublicKey:g=>m(g),utils:{randomPrivateKey:()=>e.randomBytes(e.nByteLength)},GuBytes:f}};const Fc=Ce,rn=ve,Hn=BigInt(0),rs=BigInt(1);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.hash_to_ristretto255=t.hashToRistretto255=t.RistrettoPoint=t.encodeToCurve=t.hashToCurve=t.edwardsToMontgomery=t.x25519=t.ed25519ph=t.ed25519ctx=t.ed25519=t.ED25519_TORSION_SUBGROUP=void 0,t.edwardsToMontgomeryPub=U,t.edwardsToMontgomeryPriv=function(k){const x=O.hash(k.subarray(0,32));return O.adjustScalarBytes(x).subarray(0,32)};const e=De,n=en,r=Ks,i=dn,o=Ce,c=Fs,s=ve,a=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),l=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),u=BigInt(0),d=BigInt(1),h=BigInt(2),f=BigInt(3),m=BigInt(5),g=BigInt(8);function w(k){const x=BigInt(10),R=BigInt(20),D=BigInt(40),K=BigInt(80),z=a,V=k*k%z*k%z,Z=(0,o.pow2)(V,h,z)*V%z,Q=(0,o.pow2)(Z,d,z)*k%z,ne=(0,o.pow2)(Q,m,z)*Q%z,oe=(0,o.pow2)(ne,x,z)*ne%z,ue=(0,o.pow2)(oe,R,z)*oe%z,re=(0,o.pow2)(ue,D,z)*ue%z,ie=(0,o.pow2)(re,K,z)*re%z,ce=(0,o.pow2)(ie,K,z)*re%z,se=(0,o.pow2)(ce,x,z)*ne%z;return{pow_p_5_8:(0,o.pow2)(se,h,z)*k%z,b2:V}}function p(k){return k[0]&=248,k[31]&=127,k[31]|=64,k}function C(k,x){const R=a,D=(0,o.mod)(x*x*x,R),K=w(k*(0,o.mod)(D*D*x,R)).pow_p_5_8;let z=(0,o.mod)(k*D*K,R);const V=(0,o.mod)(x*z*z,R),Z=z,Q=(0,o.mod)(z*l,R),ne=V===k,oe=V===(0,o.mod)(-k,R),ue=V===(0,o.mod)(-k*l,R);return ne&&(z=Z),(oe||ue)&&(z=Q),(0,o.isNegativeLE)(z,R)&&(z=(0,o.mod)(-z,R)),{isValid:ne||oe,value:z}}t.ED25519_TORSION_SUBGROUP=["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"];const _=(0,o.Field)(a,void 0,!0),O={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:_,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:g,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:e.sha512,randomBytes:n.randomBytes,adjustScalarBytes:p,uvRatio:C};function L(k,x,R){if(x.length>255)throw new Error("Context is too big");
2return(0,n.concatBytes)((0,n.utf8ToBytes)("SigEd25519 no Ed25519 collisions"),new Uint8Array([R?1:0,x.length]),x,k)}function U(k){const{y:x}=t.ed25519.ExtendedPoint.fromHex(k),R=BigInt(1);return _.toBytes(_.create((R+x)*_.inv(R-x)))}t.ed25519=(0,r.twistedEdwards)(O),t.ed25519ctx=(0,r.twistedEdwards)({...O,domain:L}),t.ed25519ph=(0,r.twistedEdwards)(Object.assign({},O,{domain:L,prehash:e.sha512})),t.x25519=(0,c.montgomery)({P:a,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:k=>{const x=a,{pow_p_5_8:R,b2:D}=w(k);return(0,o.mod)((0,o.pow2)(R,f,x)*D,x)},adjustScalarBytes:p,randomBytes:n.randomBytes}),t.edwardsToMontgomery=U;const q=(_.ORDER+f)/g,F=_.pow(h,q),B=_.sqrt(_.neg(_.ONE)),N=(0,o.FpSqrtEven)(_,_.neg(BigInt(486664)));function H(k){const{xMn:x,xMd:R,yMn:D,yMd:K}=(function(re){const ie=(_.ORDER-m)/g,ce=BigInt(486662);let se=_.sqr(re);se=_.mul(se,h);let he=_.add(se,_.ONE),ge=_.neg(ce),le=_.sqr(he),fe=_.mul(le,he),me=_.mul(se,ce);me=_.mul(me,ge),me=_.add(me,le),me=_.mul(me,ge);let Ae=_.sqr(fe);le=_.sqr(Ae),Ae=_.mul(Ae,fe),Ae=_.mul(Ae,me),le=_.mul(le,Ae);let Ie=_.pow(le,ie);Ie=_.mul(Ie,Ae);let Io=_.mul(Ie,B);le=_.sqr(Ie),le=_.mul(le,fe);let Lo=_.eql(le,me),oc=_.cmov(Io,Ie,Lo),Kf=_.mul(ge,se),hr=_.mul(Ie,re);hr=_.mul(hr,F);let jf=_.mul(hr,B),Uf=_.mul(me,se);le=_.sqr(hr),le=_.mul(le,fe);let Hf=_.eql(le,Uf),Ff=_.cmov(jf,hr,Hf);le=_.sqr(oc),le=_.mul(le,fe);let No=_.eql(le,me),qf=_.cmov(Kf,ge,No),fr=_.cmov(Ff,oc,No),zf=_.isOdd(fr);return fr=_.cmov(fr,_.neg(fr),No!==zf),{xMn:qf,xMd:he,yMn:fr,yMd:d}})(k);let z=_.mul(x,K);z=_.mul(z,N);let V=_.mul(R,D),Z=_.sub(x,R),Q=_.add(x,R),ne=_.mul(V,Q),oe=_.eql(ne,_.ZERO);z=_.cmov(z,_.ZERO,oe),V=_.cmov(V,_.ONE,oe),Z=_.cmov(Z,_.ONE,oe),Q=_.cmov(Q,_.ONE,oe);const ue=_.invertBatch([V,Q]);return{x:_.mul(z,ue[0]),y:_.mul(Z,ue[1])}}const $=(0,i.createHasher)(t.ed25519.ExtendedPoint,(k=>H(k[0])),{DST:"edwards25519_XMD:SHA-512_ELL2_RO_",encodeDST:"edwards25519_XMD:SHA-512_ELL2_NU_",p:_.ORDER,m:1,k:128,expand:"xmd",hash:e.sha512});function P(k){if(!(k instanceof v))throw new Error("RistrettoPoint expected")}t.hashToCurve=$.hashToCurve,t.encodeToCurve=$.encodeToCurve;const M=l,S=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),I=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),j=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),y=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),E=k=>C(d,k),A=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),T=k=>t.ed25519.CURVE.Fp.create((0,s.bytesToNumberLE)(k)&A);function b(k){const{d:x}=t.ed25519.CURVE,R=t.ed25519.CURVE.Fp.ORDER,D=t.ed25519.CURVE.Fp.create,K=D(M*k*k),z=D((K+d)*j);let V=BigInt(-1);const Z=D((V-x*K)*D(K+x));let{isValid:Q,value:ne}=C(z,Z),oe=D(ne*k);(0,o.isNegativeLE)(oe,R)||(oe=D(-oe)),Q||(ne=oe),Q||(V=K);const ue=D(V*(K-d)*y-Z),re=ne*ne,ie=D((ne+ne)*Z),ce=D(ue*S),se=D(d-re),he=D(d+re);return new t.ed25519.ExtendedPoint(D(ie*he),D(se*ce),D(ce*he),D(ie*se))}class v{constructor(x){this.ep=x}static fromAffine(x){return new v(t.ed25519.ExtendedPoint.fromAffine(x))}static hashToCurve(x){x=(0,s.ensureBytes)("ristrettoHash",x,64);const R=b(T(x.slice(0,32))),D=b(T(x.slice(32,64)));return new v(R.add(D))}static fromHex(x){x=(0,s.ensureBytes)("ristrettoHex",x,32);const{a:R,d:D}=t.ed25519.CURVE,K=t.ed25519.CURVE.Fp.ORDER,z=t.ed25519.CURVE.Fp.create,V="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",Z=T(x);if(!(0,s.equalBytes)((0,s.numberToBytesLE)(Z,32),x)||(0,o.isNegativeLE)(Z,K))throw new Error(V);const Q=z(Z*Z),ne=z(d+R*Q),oe=z(d-R*Q),ue=z(ne*ne),re=z(oe*oe),ie=z(R*D*ue-re),{isValid:ce,value:se}=E(z(ie*re)),he=z(se*oe),ge=z(se*he*ie);let le=z((Z+Z)*he);(0,o.isNegativeLE)(le,K)&&(le=z(-le));const fe=z(ne*ge),me=z(le*fe);if(!ce||(0,o.isNegativeLE)(me,K)||fe===u)throw new Error(V);return new v(new t.ed25519.ExtendedPoint(le,fe,d,me))}toRawBytes(){let{ex:x,ey:R,ez:D,et:K}=this.ep;const z=t.ed25519.CURVE.Fp.ORDER,V=t.ed25519.CURVE.Fp.create,Z=V(V(D+R)*V(D-R)),Q=V(x*R),ne=V(Q*Q),{value:oe}=E(V(Z*ne)),ue=V(oe*Z),re=V(oe*Q),ie=V(ue*re*K);let ce;if((0,o.isNegativeLE)(K*ie,z)){let he=V(R*M),ge=V(x*M);x=he,R=ge,ce=V(ue*I)}else ce=re;(0,o.isNegativeLE)(x*ie,z)&&(R=V(-R));let se=V((D-R)*ce);return(0,o.isNegativeLE)(se,z)&&(se=V(-se)),(0,s.numberToBytesLE)(se,32)}toHex(){return(0,s.bytesToHex)(this.toRawBytes())}toString(){return this.toHex()}equals(x){P(x);const{ex:R,ey:D}=this.ep,{ex:K,ey:z}=x.ep,V=t.ed25519.CURVE.Fp.create,Z=V(R*z)===V(D*K),Q=V(D*z)===V(R*K);return Z||Q}add(x){return P(x),new v(this.ep.add(x.ep))}subtract(x){return P(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)=>
2{const R=x.DST,D=typeof R=="string"?(0,n.utf8ToBytes)(R):R,K=(0,i.expand_message_xmd)(k,D,64,e.sha512);return v.hashToCurve(K)},t.hash_to_ristretto255=t.hashToRistretto255})(cd);var Ud={},Zt={};Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.sha224=Zt.sha256=Zt.SHA256=void 0;const is=Yt,ft=en,L0=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 Aa extends is.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:c,G:s,H:a}=this;return[e,n,r,i,o,c,s,a]}set(e,n,r,i,o,c,s,a){this.A=0|e,this.B=0|n,this.C=0|r,this.D=0|i,this.E=0|o,this.F=0|c,this.G=0|s,this.H=0|a}process(e,n){for(let d=0;d<16;d++,n+=4)sn[d]=e.getUint32(n,!1);for(let d=16;d<64;d++){const h=sn[d-15],f=sn[d-2],m=(0,ft.rotr)(h,7)^(0,ft.rotr)(h,18)^h>>>3,g=(0,ft.rotr)(f,17)^(0,ft.rotr)(f,19)^f>>>10;sn[d]=g+sn[d-7]+m+sn[d-16]|0}let{A:r,B:i,C:o,D:c,E:s,F:a,G:l,H:u}=this;for(let d=0;d<64;d++){const h=u+((0,ft.rotr)(s,6)^(0,ft.rotr)(s,11)^(0,ft.rotr)(s,25))+(0,is.Chi)(s,a,l)+L0[d]+sn[d]|0,f=((0,ft.rotr)(r,2)^(0,ft.rotr)(r,13)^(0,ft.rotr)(r,22))+(0,is.Maj)(r,i,o)|0;u=l,l=a,a=s,s=c+h|0,c=o,o=i,i=r,r=h+f|0}r=r+this.A|0,i=i+this.B|0,o=o+this.C|0,c=c+this.D|0,s=s+this.E|0,a=a+this.F|0,l=l+this.G|0,u=u+this.H|0,this.set(r,i,o,c,s,a,l,u)}roundClean(){sn.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}Zt.SHA256=Aa;class N0 extends Aa{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}}
2Zt.sha256=(0,ft.wrapConstructor)((()=>new Aa)),Zt.sha224=(0,ft.wrapConstructor)((()=>new N0));var Ii={},xa={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.hmac=t.HMAC=void 0;const e=ct,n=en;class r extends n.Hash{constructor(o,c){super(),this.finished=!1,this.destroyed=!1,(0,e.hash)(o);const s=(0,n.toBytes)(c);if(this.iHash=o.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const a=this.blockLen,l=new Uint8Array(a);l.set(s.length>a?o.create().update(s).digest():s);for(let u=0;u<l.length;u++)l[u]^=54;this.iHash.update(l),this.oHash=o.create();for(let u=0;u<l.length;u++)l[u]^=106;this.oHash.update(l),l.fill(0)}update(o){return(0,e.exists)(this),this.iHash.update(o),this}digestInto(o){(0,e.exists)(this),(0,e.bytes)(o,this.outputLen),this.finished=!0,this.iHash.digestInto(o),this.oHash.update(o),this.oHash.digestInto(o),this.destroy()}digest(){const o=new Uint8Array(this.oHash.outputLen);return this.digestInto(o),o}_cloneInto(o){o||(o=Object.create(Object.getPrototypeOf(this),{}));const{oHash:c,iHash:s,finished:a,destroyed:l,blockLen:u,outputLen:d}=this;return o.finished=a,o.destroyed=l,o.blockLen=u,o.outputLen=d,o.oHash=c._cloneInto(o.oHash),o.iHash=s._cloneInto(o.iHash),o}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}t.HMAC=r,t.hmac=(i,o,c)=>new r(i,o).update(c).digest(),t.hmac.create=(i,o)=>new r(i,o)})(xa);var Ta={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.DER=void 0,t.weierstrassPoints=f,t.weierstrass=function(g){const w=(function(k){const x=(0,e.validateBasic)(k);return r.validateObject(x,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...x})})(g),{Fp:p,n:C}=w,_=p.BYTES+1,O=2*p.BYTES+1;function L(k){return n.mod(k,C)}function U(k){return n.invert(k,C)}const{ProjectivePoint:q,normPrivateKeyToScalar:F,weierstrassEquation:B,isWithinCurveOrder:N}=f({...w,toBytes(k,x,R){const D=x.toAffine(),K=p.toBytes(D.x),z=r.concatBytes;return(0,i.abool)("isCompressed",R),R?z(Uint8Array.from([x.hasEvenY()?2:3]),K):z(Uint8Array.from([4]),K,p.toBytes(D.y))},fromBytes(k){const x=k.length,R=k[0],D=k.subarray(1);if(x!==_||R!==2&&R!==3){if(x===O&&R===4)return{x:p.fromBytes(D.subarray(0,p.BYTES)),y:p.fromBytes(D.subarray(p.BYTES,2*p.BYTES))};throw new Error(`Point of length ${x} was invalid. Expected ${_} compressed bytes or ${O} uncompressed bytes`)}{const K=r.bytesToNumberBE(D);if(!r.inRange(K,l,p.ORDER))throw new Error("Point is not on curve");const z=B(K);let V;try{V=p.sqrt(z)}catch(Z){const Q=Z instanceof Error?": "+Z.message:"";throw new Error("Point is not on curve"+Q)}return(1&R)==1!=((V&l)===l)&&(V=p.neg(V)),{x:K,y:V}}}}),H=k=>r.bytesToHex(r.numberToBytesBE(k,w.nByteLength));function $(k){return k>C>>l}const P=(k,x,R)=>r.bytesToNumberBE(k.slice(x,R));class M{constructor(x,R,D){this.r=x,this.s=R,this.recovery=D,this.assertValidity()}static fromCompact(x){const R=w.nByteLength;return x=(0,i.ensureBytes)("compactSignature",x,2*R),new M(P(x,0,R),P(x,R,2*R))}static fromDER(x){const{r:R,s:D}=t.DER.toSig((0,i.ensureBytes)("DER",x));return new M(R,D)}assertValidity(){r.aInRange("r",this.r,l,C),r.aInRange("s",this.s,l,C)}addRecoveryBit(x){return new M(this.r,this.s,x)}recoverPublicKey(x){const{r:R,s:D,recovery:K}=this,z=y((0,i.ensureBytes)("msgHash",x));if(K==null||![0,1,2,3].includes(K))throw new Error("recovery id invalid");const V=K===2||K===3?R+w.n:R;if(V>=p.ORDER)throw new Error("recovery id 2 or 3 invalid");const Z=(1&K)==0?"02":"03",Q=q.fromHex(Z+H(V)),ne=U(V),oe=L(-z*ne),ue=L(D*ne),re=q.BASE.multiplyAndAddUnsafe(Q,oe,ue);if(!re)throw new Error("point at infinify");return re.assertValidity(),re}hasHighS(){return $(this.s)}normalizeS(){return this.hasHighS()?new M(this.r,L(-this.s),this.recovery):this}toDERRawBytes(){return r.hexToBytes(this.toDERHex())}toDERHex(){return t.DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return r.hexToBytes(this.toCompactHex())}toCompactHex(){return H(this.r)+H(this.s)}}const S={isValidPrivateKey(k){try{return F(k),!0}catch{return!1}},normPrivateKeyToScalar:F,randomPrivateKey:()=>{const k=n.getMinHashLength(w.n);return n.mapHashToField(w.randomBytes(k),w.n)},precompute:(k=8,x=q.BASE)=>(x._setWindowSize(k),x.multiply(BigInt(3)),x)};function I(k){const x=r.isBytes(k),R=typeof k=="string",D=(x||R)&&k.length;return x?D===_||D===O:R?D===2*_||D===2*O:k instanceof q}const j=w.bits2int||function(k){const x=r.bytesToNumberBE(k),R=8*k.length-w.nBitLength;return R>0?x>>BigInt(R):x},y=w.bits2int_modN||function(k){return L(j(k))},E=r.bitMask(w.nBitLength);function A(k){return r.aInRange(`num < 2^${w.nBitLength}`,k,a,E),r.numberToBytesBE(k,w.nByteLength)}function T(k,x,R=b){if(["recovered","canonical"].some((ie=>ie in R)))throw new Error("sign() legacy options not supported");const{hash:D,randomBytes:K}=w;let{lowS:z,prehash:V,extraEntropy:Z}=R;z==null&&(z=!0),k=(0,i.ensureBytes)("msgHash",k),o(R),V&&(k=(0,i.ensureBytes)("prehashed msgHash",D(k)));const Q=y(k),ne=F(x),oe=[A(ne),A(Q)];if(Z!=null&&Z!==!1){const ie=Z===!0?K(p.BYTES):Z;oe.push((0,i.ensureBytes)("extraEntropy",ie))}const ue=r.concatBytes(...oe),re=Q;return{seed:ue,k2sig:function(ie){const ce=j(ie);if(!N(ce))return;const se=U(ce),he=q.BASE.multiply(ce).toAffine(),ge=L(he.x);if(ge===a)return;const le=L(se*L(re+ge*ne));if(le===a)return;let fe=(he.x===ge?0:2)|Number(he.y&l),me=le;return z&&$(le)&&(me=(function(Ae){return $(Ae)?L(-Ae):Ae})(le),fe^=1),new M(ge,me,fe)}}}const b={lowS:w.lowS,prehash:!1},v={lowS:w.lowS,prehash:!1};return q.BASE._setWindowSize(8),{CURVE:w,getPublicKey:function(k,x=!0){return q.fromPrivateKey(k).toRawBytes(x)},getSharedSecret:function(k,x,R=!0){if(I(k))throw new Error("first arg must be private key");if(!I(x))throw new Error("second arg must be public key");return q.fromHex(x).multiply(F(k)).toRawBytes(R)},sign:function(k,x,R=b){const{seed:D,k2sig:K}=T(k,x,R),z=w;return r.createHmacDrbg(z.hash.outputLen,z.nByteLength,z.hmac)(D,K)},verify:function(k,x,R,D=v){const K=k;if(x=(0,i.ensureBytes)("msgHash",x),R=(0,i.ensureBytes)("publicKey",R),"strict"in D)throw new Error("options.strict was renamed to lowS");o(D);const{lowS:z,prehash:V}=D;let Z,Q;try{if(typeof K=="string"||r.isBytes(K))try{Z=M.fromDER(K)}catch(ge){if(!(ge instanceof t.DER.Err))throw ge;Z=M.fromCompact(K)}else{if(typeof K!="object"||typeof K.r!="bigint"||typeof K.s!="bigint")throw new Error("PARSE");{const{r:ge,s:le}=K;Z=new M(ge,le)}}Q=q.fromHex(R)}catch(ge){if(ge.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(z&&Z.hasHighS())return!1;V&&(x=w.hash(x));const{r:ne,s:oe}=Z,ue=y(x),re=U(oe),ie=L(ue*re),ce=L(ne*re),se=q.BASE.multiplyAndAddUnsafe(Q,ie,ce)?.toAffine();
2return se?L(se.x)===ne:!1},ProjectivePoint:q,Signature:M,utils:S}},t.SWUFpSqrtRatio=m,t.mapToCurveSimpleSWU=function(g,w){if(n.validateField(g),!g.isValid(w.A)||!g.isValid(w.B)||!g.isValid(w.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const p=m(g,w.Z);if(!g.isOdd)throw new Error("Fp.isOdd is not implemented!");return C=>{let _,O,L,U,q,F,B,N;_=g.sqr(C),_=g.mul(_,w.Z),O=g.sqr(_),O=g.add(O,_),L=g.add(O,g.ONE),L=g.mul(L,w.B),U=g.cmov(w.Z,g.neg(O),!g.eql(O,g.ZERO)),U=g.mul(U,w.A),O=g.sqr(L),F=g.sqr(U),q=g.mul(F,w.A),O=g.add(O,q),O=g.mul(O,L),F=g.mul(F,U),q=g.mul(F,w.B),O=g.add(O,q),B=g.mul(_,L);const{isValid:H,value:$}=p(O,F);N=g.mul(_,C),N=g.mul(N,$),B=g.cmov(B,L,H),N=g.cmov(N,$,H);const P=g.isOdd(C)===g.isOdd(N);return N=g.cmov(g.neg(N),N,P),B=g.div(B,U),{x:B,y:N}}};const e=Gn,n=Ce,r=ve,i=ve;function o(g){g.lowS!==void 0&&(0,i.abool)("lowS",g.lowS),g.prehash!==void 0&&(0,i.abool)("prehash",g.prehash)}const{bytesToNumberBE:c,hexToBytes:s}=r;t.DER={Err:class extends Error{constructor(g=""){super(g)}},_tlv:{encode:(g,w)=>{const{Err:p}=t.DER;if(g<0||g>256)throw new p("tlv.encode: wrong tag");if(1&w.length)throw new p("tlv.encode: unpadded data");const C=w.length/2,_=r.numberToHexUnpadded(C);if(_.length/2&128)throw new p("tlv.encode: long form length too big");const O=C>127?r.numberToHexUnpadded(_.length/2|128):"";return`${r.numberToHexUnpadded(g)}${O}${_}${w}`},decode(g,w){const{Err:p}=t.DER;let C=0;if(g<0||g>256)throw new p("tlv.encode: wrong tag");if(w.length<2||w[C++]!==g)throw new p("tlv.decode: wrong tlv");const _=w[C++];let O=0;if(128&_){const U=127&_;if(!U)throw new p("tlv.decode(long): indefinite length not supported");if(U>4)throw new p("tlv.decode(long): byte length is too big");const q=w.subarray(C,C+U);if(q.length!==U)throw new p("tlv.decode: length bytes not complete");if(q[0]===0)throw new p("tlv.decode(long): zero leftmost byte");for(const F of q)O=O<<8|F;if(C+=U,O<128)throw new p("tlv.decode(long): not minimal encoding")}else O=_;const L=w.subarray(C,C+O);if(L.length!==O)throw new p("tlv.decode: wrong value length");return{v:L,l:w.subarray(C+O)}}},_int:{encode(g){const{Err:w}=t.DER;if(g<a)throw new w("integer: negative integers are not allowed");let p=r.numberToHexUnpadded(g);if(8&Number.parseInt(p[0],16)&&(p="00"+p),1&p.length)throw new w("unexpected assertion");return p},decode(g){const{Err:w}=t.DER;if(128&g[0])throw new w("Invalid signature integer: negative");if(g[0]===0&&!(128&g[1]))throw new w("Invalid signature integer: unnecessary leading zero");return c(g)}},toSig(g){const{Err:w,_int:p,_tlv:C}=t.DER,_=typeof g=="string"?s(g):g;r.abytes(_);const{v:O,l:L}=C.decode(48,_);if(L.length)throw new w("Invalid signature: left bytes after parsing");const{v:U,l:q}=C.decode(2,O),{v:F,l:B}=C.decode(2,q);if(B.length)throw new w("Invalid signature: left bytes after parsing");return{r:p.decode(U),s:p.decode(F)}},hexFromSig(g){const{_tlv:w,_int:p}=t.DER,C=`${w.encode(2,p.encode(g.r))}${w.encode(2,p.encode(g.s))}`;return w.encode(48,C)}};const a=BigInt(0),l=BigInt(1),u=BigInt(2),d=BigInt(3),h=BigInt(4);function f(g){const w=(function(P){const M=(0,e.validateBasic)(P);r.validateObject(M,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:S,Fp:I,a:j}=M;if(S){if(!I.eql(j,I.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof S!="object"||typeof S.beta!="bigint"||typeof S.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...M})})(g),{Fp:p}=w,C=n.Field(w.n,w.nBitLength),_=w.toBytes||((P,M,S)=>{const I=M.toAffine();return r.concatBytes(Uint8Array.from([4]),p.toBytes(I.x),p.toBytes(I.y))}),O=w.fromBytes||(P=>{const M=P.subarray(1);return{x:p.fromBytes(M.subarray(0,p.BYTES)),y:p.fromBytes(M.subarray(p.BYTES,2*p.BYTES))}});function L(P){const{a:M,b:S}=w,I=p.sqr(P),j=p.mul(I,P);return p.add(p.add(j,p.mul(P,M)),S)}if(!p.eql(p.sqr(w.Gy),L(w.Gx)))throw new Error("bad generator point: equation left != right");function U(P){const{allowedPrivateKeyLengths:M,nByteLength:S,wrapPrivateKey:I,n:j}=w;
2if(M&&typeof P!="bigint"){if(r.isBytes(P)&&(P=r.bytesToHex(P)),typeof P!="string"||!M.includes(P.length))throw new Error("Invalid key");P=P.padStart(2*S,"0")}let y;try{y=typeof P=="bigint"?P:r.bytesToNumberBE((0,i.ensureBytes)("private key",P,S))}catch{throw new Error(`private key must be ${S} bytes, hex or bigint, not ${typeof P}`)}return I&&(y=n.mod(y,j)),r.aInRange("private key",y,l,j),y}function q(P){if(!(P instanceof N))throw new Error("ProjectivePoint expected")}const F=(0,i.memoized)(((P,M)=>{const{px:S,py:I,pz:j}=P;if(p.eql(j,p.ONE))return{x:S,y:I};const y=P.is0();M==null&&(M=y?p.ONE:p.inv(j));const E=p.mul(S,M),A=p.mul(I,M),T=p.mul(j,M);if(y)return{x:p.ZERO,y:p.ZERO};if(!p.eql(T,p.ONE))throw new Error("invZ was invalid");return{x:E,y:A}})),B=(0,i.memoized)((P=>{if(P.is0()){if(w.allowInfinityPoint&&!p.is0(P.py))return;throw new Error("bad point: ZERO")}const{x:M,y:S}=P.toAffine();if(!p.isValid(M)||!p.isValid(S))throw new Error("bad point: x or y not FE");const I=p.sqr(S),j=L(M);if(!p.eql(I,j))throw new Error("bad point: equation left != right");if(!P.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0}));class N{constructor(M,S,I){if(this.px=M,this.py=S,this.pz=I,M==null||!p.isValid(M))throw new Error("x required");if(S==null||!p.isValid(S))throw new Error("y required");if(I==null||!p.isValid(I))throw new Error("z required");Object.freeze(this)}static fromAffine(M){const{x:S,y:I}=M||{};if(!M||!p.isValid(S)||!p.isValid(I))throw new Error("invalid affine point");if(M instanceof N)throw new Error("projective point not allowed");const j=y=>p.eql(y,p.ZERO);return j(S)&&j(I)?N.ZERO:new N(S,I,p.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(M){const S=p.invertBatch(M.map((I=>I.pz)));return M.map(((I,j)=>I.toAffine(S[j]))).map(N.fromAffine)}static fromHex(M){const S=N.fromAffine(O((0,i.ensureBytes)("pointHex",M)));return S.assertValidity(),S}static fromPrivateKey(M){return N.BASE.multiply(U(M))}static msm(M,S){return(0,e.pippenger)(N,C,M,S)}_setWindowSize(M){$.setWindowSize(this,M)}assertValidity(){B(this)}hasEvenY(){const{y:M}=this.toAffine();if(p.isOdd)return!p.isOdd(M);throw new Error("Field doesn't support isOdd")}equals(M){q(M);const{px:S,py:I,pz:j}=this,{px:y,py:E,pz:A}=M,T=p.eql(p.mul(S,A),p.mul(y,j)),b=p.eql(p.mul(I,A),p.mul(E,j));return T&&b}negate(){return new N(this.px,p.neg(this.py),this.pz)}double(){const{a:M,b:S}=w,I=p.mul(S,d),{px:j,py:y,pz:E}=this;let A=p.ZERO,T=p.ZERO,b=p.ZERO,v=p.mul(j,j),k=p.mul(y,y),x=p.mul(E,E),R=p.mul(j,y);return R=p.add(R,R),b=p.mul(j,E),b=p.add(b,b),A=p.mul(M,b),T=p.mul(I,x),T=p.add(A,T),A=p.sub(k,T),T=p.add(k,T),T=p.mul(A,T),A=p.mul(R,A),b=p.mul(I,b),x=p.mul(M,x),R=p.sub(v,x),R=p.mul(M,R),R=p.add(R,b),b=p.add(v,v),v=p.add(b,v),v=p.add(v,x),v=p.mul(v,R),T=p.add(T,v),x=p.mul(y,E),x=p.add(x,x),v=p.mul(x,R),A=p.sub(A,v),b=p.mul(x,k),b=p.add(b,b),b=p.add(b,b),new N(A,T,b)}add(M){q(M);const{px:S,py:I,pz:j}=this,{px:y,py:E,pz:A}=M;let T=p.ZERO,b=p.ZERO,v=p.ZERO;const k=w.a,x=p.mul(w.b,d);let R=p.mul(S,y),D=p.mul(I,E),K=p.mul(j,A),z=p.add(S,I),V=p.add(y,E);z=p.mul(z,V),V=p.add(R,D),z=p.sub(z,V),V=p.add(S,j);let Z=p.add(y,A);return V=p.mul(V,Z),Z=p.add(R,K),V=p.sub(V,Z),Z=p.add(I,j),T=p.add(E,A),Z=p.mul(Z,T),T=p.add(D,K),Z=p.sub(Z,T),v=p.mul(k,V),T=p.mul(x,K),v=p.add(T,v),T=p.sub(D,v),v=p.add(D,v),b=p.mul(T,v),D=p.add(R,R),D=p.add(D,R),K=p.mul(k,K),V=p.mul(x,V),D=p.add(D,K),K=p.sub(R,K),K=p.mul(k,K),V=p.add(V,K),R=p.mul(D,V),b=p.add(b,R),R=p.mul(Z,V),T=p.mul(z,T),T=p.sub(T,R),R=p.mul(z,D),v=p.mul(Z,v),v=p.add(v,R),new N(T,b,v)}subtract(M){return this.add(M.negate())}is0(){return this.equals(N.ZERO)}wNAF(M){return $.wNAFCached(this,M,N.normalizeZ)}multiplyUnsafe(M){r.aInRange("scalar",M,a,w.n);const S=N.ZERO;if(M===a)return S;if(M===l)return this;const{endo:I}=w;if(!I)return $.unsafeLadder(this,M);let{k1neg:j,k1:y,k2neg:E,k2:A}=I.splitScalar(M),T=S,b=S,v=this;for(;y>a||A>a;)y&l&&(T=T.add(v)),A&l&&(b=b.add(v)),v=v.double(),y>>=l,A>>=l;return j&&(T=T.negate()),E&&(b=b.negate()),b=new N(p.mul(b.px,I.beta),b.py,b.pz),T.add(b)}
2multiply(M){const{endo:S,n:I}=w;let j,y;if(r.aInRange("scalar",M,l,I),S){const{k1neg:E,k1:A,k2neg:T,k2:b}=S.splitScalar(M);let{p:v,f:k}=this.wNAF(A),{p:x,f:R}=this.wNAF(b);v=$.constTimeNegate(E,v),x=$.constTimeNegate(T,x),x=new N(p.mul(x.px,S.beta),x.py,x.pz),j=v.add(x),y=k.add(R)}else{const{p:E,f:A}=this.wNAF(M);j=E,y=A}return N.normalizeZ([j,y])[0]}multiplyAndAddUnsafe(M,S,I){const j=N.BASE,y=(A,T)=>T!==a&&T!==l&&A.equals(j)?A.multiply(T):A.multiplyUnsafe(T),E=y(this,S).add(y(M,I));return E.is0()?void 0:E}toAffine(M){return F(this,M)}isTorsionFree(){const{h:M,isTorsionFree:S}=w;if(M===l)return!0;if(S)return S(N,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:M,clearCofactor:S}=w;return M===l?this:S?S(N,this):this.multiplyUnsafe(w.h)}toRawBytes(M=!0){return(0,i.abool)("isCompressed",M),this.assertValidity(),_(N,this,M)}toHex(M=!0){return(0,i.abool)("isCompressed",M),r.bytesToHex(this.toRawBytes(M))}}N.BASE=new N(w.Gx,w.Gy,p.ONE),N.ZERO=new N(p.ZERO,p.ONE,p.ZERO);const H=w.nBitLength,$=(0,e.wNAF)(N,w.endo?Math.ceil(H/2):H);return{CURVE:w,ProjectivePoint:N,normPrivateKeyToScalar:U,weierstrassEquation:L,isWithinCurveOrder:function(P){return r.inRange(P,l,w.n)}}}function m(g,w){const p=g.ORDER;let C=a;for(let P=p-l;P%u===a;P/=u)C+=l;const _=C,O=u<<_-l-l,L=O*u,U=(p-l)/L,q=(U-l)/u,F=L-l,B=O,N=g.pow(w,U),H=g.pow(w,(U+l)/u);let $=(P,M)=>{let S=N,I=g.pow(M,F),j=g.sqr(I);j=g.mul(j,M);let y=g.mul(P,j);y=g.pow(y,q),y=g.mul(y,I),I=g.mul(y,M),j=g.mul(y,P);let E=g.mul(j,I);y=g.pow(E,B);let A=g.eql(y,g.ONE);I=g.mul(j,H),y=g.mul(E,S),j=g.cmov(I,j,A),E=g.cmov(y,E,A);for(let T=_;T>l;T--){let b=T-u;b=u<<b-l;let v=g.pow(E,b);const k=g.eql(v,g.ONE);I=g.mul(j,S),S=g.mul(S,S),v=g.mul(E,S),j=g.cmov(I,j,k),E=g.cmov(v,E,k)}return{isValid:A,value:j}};if(g.ORDER%h===d){const P=(g.ORDER-d)/h,M=g.sqrt(g.neg(w));$=(S,I)=>{let j=g.sqr(I);const y=g.mul(S,I);j=g.mul(j,y);let E=g.pow(j,P);E=g.mul(E,y);const A=g.mul(E,M),T=g.mul(g.sqr(E),I),b=g.eql(T,S);return{isValid:b,value:g.cmov(A,E,b)}}}return $}})(Ta),Object.defineProperty(Ii,"__esModule",{value:!0}),Ii.getHash=zc,Ii.createCurve=function(t,e){const n=r=>(0,B0.weierstrass)({...t,...zc(r)});return Object.freeze({...n(e),create:n})};const D0=xa,qc=en,B0=Ta;function zc(t){return{hash:t,hmac:(e,...n)=>(0,D0.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=Ii,i=dn,o=Ce,c=ve,s=Ta,a=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),l=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),u=BigInt(1),d=BigInt(2),h=(y,E)=>(y+E/d)/E;function f(y){const E=a,A=BigInt(3),T=BigInt(6),b=BigInt(11),v=BigInt(22),k=BigInt(23),x=BigInt(44),R=BigInt(88),D=y*y*y%E,K=D*D*y%E,z=(0,o.pow2)(K,A,E)*K%E,V=(0,o.pow2)(z,A,E)*K%E,Z=(0,o.pow2)(V,d,E)*D%E,Q=(0,o.pow2)(Z,b,E)*Z%E,ne=(0,o.pow2)(Q,v,E)*Q%E,oe=(0,o.pow2)(ne,x,E)*ne%E,ue=(0,o.pow2)(oe,R,E)*oe%E,re=(0,o.pow2)(ue,x,E)*ne%E,ie=(0,o.pow2)(re,A,E)*K%E,ce=(0,o.pow2)(ie,k,E)*Q%E,se=(0,o.pow2)(ce,T,E)*D%E,he=(0,o.pow2)(se,d,E);if(!m.eql(m.sqr(he),y))throw new Error("Cannot find square root");return he}const m=(0,o.Field)(a,void 0,void 0,{sqrt:f});t.secp256k1=(0,r.createCurve)({a:BigInt(0),b:BigInt(7),Fp:m,n:l,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:y=>{const E=l,A=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),T=-u*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),b=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),v=A,k=BigInt("0x100000000000000000000000000000000"),x=h(v*y,E),R=h(-T*y,E);let D=(0,o.mod)(y-x*A-R*b,E),K=(0,o.mod)(-x*T-R*v,E);const z=D>k,V=K>k;if(z&&(D=E-D),V&&(K=E-K),D>k||K>k)throw new Error("splitScalar: Endomorphism failed, k="+y);return{k1neg:z,k1:D,k2neg:V,k2:K}}}},e.sha256);const g=BigInt(0),w={};function p(y,...E){let A=w[y];if(A===void 0){const T=(0,e.sha256)(Uint8Array.from(y,(b=>b.charCodeAt(0))));A=(0,c.concatBytes)(T,T),w[y]=A}return(0,e.sha256)((0,c.concatBytes)(A,...E))}const C=y=>y.toRawBytes(!0).slice(1),_=y=>(0,c.numberToBytesBE)(y,32),O=y=>(0,o.mod)(y,a),L=y=>(0,o.mod)(y,l),U=t.secp256k1.ProjectivePoint,q=(y,E,A)=>U.BASE.multiplyAndAddUnsafe(y,E,A);function F(y){let E=t.secp256k1.utils.normPrivateKeyToScalar(y),A=U.fromPrivateKey(E);return{scalar:A.hasEvenY()?E:L(-E),bytes:C(A)}}function B(y){(0,c.aInRange)("x",y,u,a);const E=O(y*y);let A=f(O(E*y+BigInt(7)));A%d!==g&&(A=O(-A));const T=new U(y,A,u);return T.assertValidity(),T}const N=c.bytesToNumberBE;function H(...y){return L(N(p("BIP0340/challenge",...y)))}function $(y){return F(y).bytes}function P(y,E,A=(0,n.randomBytes)(32)){const T=(0,c.ensureBytes)("message",y),{bytes:b,scalar:v}=F(E),k=(0,c.ensureBytes)("auxRand",A,32),x=_(v^N(p("BIP0340/aux",k))),R=p("BIP0340/nonce",x,b,T),D=L(N(R));if(D===g)throw new Error("sign failed: k is zero");const{bytes:K,scalar:z}=F(D),V=H(K,b,T),Z=new Uint8Array(64);if(Z.set(K,0),Z.set(_(L(z+V*v)),32),!M(Z,T,b))throw new Error("sign: Invalid signature produced");return Z}function M(y,E,A){const T=(0,c.ensureBytes)("signature",y,64),b=(0,c.ensureBytes)("message",E),v=(0,c.ensureBytes)("publicKey",A,32);try{const k=B(N(v)),x=N(T.subarray(0,32));if(!(0,c.inRange)(x,u,a))return!1;const R=N(T.subarray(32,64));if(!(0,c.inRange)(R,u,l))return!1;const D=H(_(x),C(k),b),K=q(k,R,L(-D));return!(!K||!K.hasEvenY()||K.toAffine().x!==x)}catch{return!1}}t.schnorr={getPublicKey:$,sign:P,verify:M,utils:{randomPrivateKey:t.secp256k1.utils.randomPrivateKey,lift_x:B,pointToBytes:C,numberToBytesBE:c.numberToBytesBE,bytesToNumberBE:c.bytesToNumberBE,taggedHash:p,mod:o.mod}};const S=(0,i.isogenyMap)(m,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a4
213deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map((y=>y.map((E=>BigInt(E)))))),I=(0,s.mapToCurveSimpleSWU)(m,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:m.create(BigInt("-11"))}),j=(0,i.createHasher)(t.secp256k1.ProjectivePoint,(y=>{const{x:E,y:A}=I(m.create(y[0]));return S(E,A)}),{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:m.ORDER,m:1,k:128,expand:"xmd",hash:e.sha256});t.hashToCurve=j.hashToCurve,t.encodeToCurve=j.encodeToCurve})(Ud);var qs={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.decodeHex=t.remove0x=void 0;var e=ut;t.remove0x=function(n){return n.startsWith("0x")||n.startsWith("0X")?n.slice(2):n},t.decodeHex=function(n){return(0,e.hexToBytes)((0,t.remove0x)(n))}})(qs),(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.hexToPublicKey=t.convertPublicKeyFormat=t.getSharedPoint=t.getPublicKey=t.isValidPrivateKey=t.getValidSecret=void 0;var e=Sa,n=cd,r=Ud,i=Ir,o=Ne,c=qs;t.getValidSecret=function(){var u;do u=(0,e.randomBytes)(o.SECRET_KEY_LENGTH);while(!(0,t.isValidPrivateKey)(u));return u},t.isValidPrivateKey=function(u){return s((0,i.ellipticCurve)(),(function(d){return d.utils.isValidPrivateKey(u)}),(function(){return!0}),(function(){return!0}))},t.getPublicKey=function(u){return s((0,i.ellipticCurve)(),(function(d){return d.getPublicKey(u)}),(function(d){return d.getPublicKey(u)}),(function(d){return d.getPublicKey(u)}))},t.getSharedPoint=function(u,d,h){return s((0,i.ellipticCurve)(),(function(f){return f.getSharedSecret(u,d,h)}),(function(f){return f.getSharedSecret(u,d)}),(function(f){return l(f,u,d)}))},t.convertPublicKeyFormat=function(u,d){return s((0,i.ellipticCurve)(),(function(h){return h.getSharedSecret(BigInt(1),u,d)}),(function(){return u}),(function(){return u}))};function s(u,d,h,f){if(u==="secp256k1")return d(r.secp256k1);if(u==="x25519")return h(n.x25519);if(u==="ed25519")return f(n.ed25519);throw new Error("Not implemented")}t.hexToPublicKey=function(u){var d=(0,c.decodeHex)(u);return s((0,i.ellipticCurve)(),(function(){return a(d)}),(function(){return d}),(function(){return d}))};var a=function(u){if(u.length===o.ETH_PUBLIC_KEY_SIZE){var d=new Uint8Array(1+u.length);return d.set([4]),d.set(u,1),d}return u},l=function(u,d,h){var f=u.utils.getExtendedPublicKey(d).scalar;return u.ExtendedPoint.fromHex(h).multiply(f).toRawBytes()}})(ad);var Hd={},Yn={};Object.defineProperty(Yn,"__esModule",{value:!0}),Yn.hkdf=void 0,Yn.extract=qd,Yn.expand=zd;const zs=ct,Vc=en,Fd=xa;function qd(t,e,n){return(0,zs.hash)(t),n===void 0&&(n=new Uint8Array(t.outputLen)),(0,Fd.hmac)(t,(0,Vc.toBytes)(n),(0,Vc.toBytes)(e))}const os=new Uint8Array([0]),Wc=new Uint8Array;function zd(t,e,n,r=32){if((0,zs.hash)(t),(0,zs.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=Wc);const o=new Uint8Array(i*t.outputLen),c=Fd.hmac.create(t,e),s=c._cloneInto(),a=new Uint8Array(c.outputLen);for(let l=0;l<i;l++)os[0]=l+1,s.update(l===0?Wc:a).update(n).update(os).digestInto(a),o.set(a,t.outputLen*l),c._cloneInto(s);return c.destroy(),s.destroy(),a.fill(0),os.fill(0),o.slice(0,r)}Yn.hkdf=(t,e,n,r,i)=>zd(t,qd(t,e,n),r,i),(function(t){Object.defineProperty(t,"__esMo
2dule",{value:!0}),t.getSharedKey=t.deriveKey=void 0;var e=ut,n=Yn,r=Zt;t.deriveKey=function(i,o,c){return(0,n.hkdf)(r.sha256,i,o,c,32)},t.getSharedKey=function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return(0,t.deriveKey)(e.concatBytes.apply(void 0,i))}})(Hd);var Gc={},tr={},Te={},On={};Object.defineProperty(On,"__esModule",{value:!0}),On.polyval=On.ghash=void 0,On._toGHASHKey=Vd;const Pn=ze,Ye=ut,qt=16,Ma=new Uint8Array(16),Pt=(0,Ye.u32)(Ma),gt=t=>(t>>>0&255)<<24|(t>>>8&255)<<16|(t>>>16&255)<<8|t>>>24&255|0;function Vd(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 Wd{constructor(e,n){this.blockLen=qt,this.outputLen=qt,this.s0=0,this.s1=0,this.s2=0,this.s3=0,this.finished=!1,e=(0,Ye.toBytes)(e),(0,Pn.bytes)(e,16);const r=(0,Ye.createView)(e);let i=r.getUint32(0,!1),o=r.getUint32(4,!1),c=r.getUint32(8,!1),s=r.getUint32(12,!1);const a=[];for(let p=0;p<128;p++)a.push({s0:gt(i),s1:gt(o),s2:gt(c),s3:gt(s)}),{s0:i,s1:o,s2:c,s3:s}={s3:(d=c)<<31|(h=s)>>>1,s2:(u=o)<<31|d>>>1,s1:(l=i)<<31|u>>>1,s0:l>>>1^225<<24&-(1&h)};var l,u,d,h;const f=(p=>p>65536?8:p>1024?4:2)(n||1024);if(![1,2,4,8].includes(f))throw new Error(`ghash: wrong window size=${f}, should be 2, 4 or 8`);this.W=f;const m=128/f,g=this.windowSize=2**f,w=[];for(let p=0;p<m;p++)for(let C=0;C<g;C++){let _=0,O=0,L=0,U=0;for(let q=0;q<f;q++){if(!(C>>>f-q-1&1))continue;const{s0:F,s1:B,s2:N,s3:H}=a[f*p+q];_^=F,O^=B,L^=N,U^=H}w.push({s0:_,s1:O,s2:L,s3:U})}this.t=w}_updateBlock(e,n,r,i){e^=this.s0,n^=this.s1,r^=this.s2,i^=this.s3;const{W:o,t:c,windowSize:s}=this;let a=0,l=0,u=0,d=0;const h=(1<<o)-1;let f=0;for(const m of[e,n,r,i])for(let g=0;g<4;g++){const w=m>>>8*g&255;for(let p=8/o-1;p>=0;p--){const C=w>>>o*p&h,{s0:_,s1:O,s2:L,s3:U}=c[f*s+C];a^=_,l^=O,u^=L,d^=U,f+=1}}this.s0=a,this.s1=l,this.s2=u,this.s3=d}update(e){e=(0,Ye.toBytes)(e),(0,Pn.exists)(this);const n=(0,Ye.u32)(e),r=Math.floor(e.length/qt),i=e.length%qt;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&&(Ma.set(e.subarray(r*qt)),this._updateBlock(Pt[0],Pt[1],Pt[2],Pt[3]),(0,Ye.clean)(Pt)),this}destroy(){const{t:e}=this;for(const n of e)n.s0=0,n.s1=0,n.s2=0,n.s3=0}digestInto(e){(0,Pn.exists)(this),(0,Pn.output)(e,this),this.finished=!0;const{s0:n,s1:r,s2:i,s3:o}=this,c=(0,Ye.u32)(e);return c[0]=n,c[1]=r,c[2]=i,c[3]=o,e}digest(){const e=new Uint8Array(qt);return this.digestInto(e),this.destroy(),e}}class $0 extends Wd{constructor(e,n){e=(0,Ye.toBytes)(e);const r=Vd((0,Ye.copyBytes)(e));super(r,n),(0,Ye.clean)(r)}update(e){e=(0,Ye.toBytes)(e),(0,Pn.exists)(this);const n=(0,Ye.u32)(e),r=e.length%qt,i=Math.floor(e.length/qt);for(let o=0;o<i;o++)this._updateBlock(gt(n[4*o+3]),gt(n[4*o+2]),gt(n[4*o+1]),gt(n[4*o+0]));return r&&(Ma.set(e.subarray(i*qt)),this._updateBlock(gt(Pt[3]),gt(Pt[2]),gt(Pt[1]),gt(Pt[0])),(0,Ye.clean)(Pt)),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,c=(0,Ye.u32)(e);return c[0]=n,c[1]=r,c[2]=i,c[3]=o,e.reverse()}}function Yc(t){const e=(r,i)=>t(i,r.length).update((0,Ye.toBytes)(r)).digest(),n=t(new Uint8Array(16),0);return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=(r,i)=>t(r,i),e}On.ghash=Yc(((t,e)=>new Wd(t,e))),On.polyval=Yc(((t,e)=>new $0(t,e))),Object.defineProperty(Te,"__esModule",{value:!0}),Te.unsafe=Te.aeskwp=Te.aeskw=Te.siv=Te.gcm=Te.cfb=Te.cbc=Te.ecb=Te.ctr=void 0,Te.expandKeyLE=Ct,Te.expandKeyDecLE=Nr;const we=ze,Vs=On,ee=ut,rt=16,pi=new Uint8Array(rt),K0=283;function Ra(t){return t<<1^K0&-(t>>7)}function Zn(t,e){let n=0;for(;e>0;e>>=1)n^=t&-(1&e),t=Ra(t);return n}const Ws=(()=>{const t=new Uint8Array(256);for(let n=0,r=1;n<256;n++,r^=Ra(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})(),j0=Ws.map(((t,e)=>Ws.indexOf(e))),U0=t=>t<<24|t>>>8,ss=t=>t<<8|t>>>24,to=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function Gd(t,e){if(t.length!==256)throw new Error("Wrong sbox length");const n=new Uint32Array(256).map(((l,u)=>
vendor: 4,912 bytes, line 2
2e(t[u]))),r=n.map(ss),i=r.map(ss),o=i.map(ss),c=new Uint32Array(65536),s=new Uint32Array(65536),a=new Uint16Array(65536);for(let l=0;l<256;l++)for(let u=0;u<256;u++){const d=256*l+u;c[d]=n[l]^r[u],s[d]=i[l]^o[u],a[d]=t[l]<<8|t[u]}return{sbox:t,sbox2:a,T0:n,T1:r,T2:i,T3:o,T01:c,T23:s}}const Oa=Gd(Ws,(t=>Zn(t,3)<<24|t<<16|t<<8|Zn(t,2))),Yd=Gd(j0,(t=>Zn(t,11)<<24|Zn(t,13)<<16|Zn(t,9)<<8|Zn(t,14))),H0=(()=>{const t=new Uint8Array(16);for(let e=0,n=1;e<16;e++,n=Ra(n))t[e]=n;return t})();function Ct(t){(0,we.bytes)(t);const e=t.length;if(![16,24,32].includes(e))throw new Error(`aes: wrong key size: should be 16, 24 or 32, got: ${e}`);const{sbox2:n}=Oa,r=[];(0,ee.isAligned32)(t)||r.push(t=(0,ee.copyBytes)(t));const i=(0,ee.u32)(t),o=i.length,c=a=>Lt(n,a,a,a,a),s=new Uint32Array(e+28);s.set(i);for(let a=o;a<s.length;a++){let l=s[a-1];a%o==0?l=c(U0(l))^H0[a/o-1]:o>6&&a%o==4&&(l=c(l)),s[a]=s[a-o]^l}return(0,ee.clean)(...r),s}function Nr(t){const e=Ct(t),n=e.slice(),r=e.length,{sbox2:i}=Oa,{T0:o,T1:c,T2:s,T3:a}=Yd;for(let l=0;l<r;l+=4)for(let u=0;u<4;u++)n[l+u]=e[r-l-4+u];(0,ee.clean)(e);for(let l=4;l<r-4;l++){const u=n[l],d=Lt(i,u,u,u,u);n[l]=o[255&d]^c[d>>>8&255]^s[d>>>16&255]^a[d>>>24]}return n}function bn(t,e,n,r,i,o){return t[n<<8&65280|r>>>8&255]^e[i>>>8&65280|o>>>24&255]}function Lt(t,e,n,r,i){return t[255&e|65280&n]|t[r>>>16&255|i>>>16&65280]<<16}function Ze(t,e,n,r,i){const{sbox2:o,T01:c,T23:s}=Oa;let a=0;e^=t[a++],n^=t[a++],r^=t[a++],i^=t[a++];const l=t.length/4-2;for(let u=0;u<l;u++){const d=t[a++]^bn(c,s,e,n,r,i),h=t[a++]^bn(c,s,n,r,i,e),f=t[a++]^bn(c,s,r,i,e,n),m=t[a++]^bn(c,s,i,e,n,r);e=d,n=h,r=f,i=m}return{s0:t[a++]^Lt(o,e,n,r,i),s1:t[a++]^Lt(o,n,r,i,e),s2:t[a++]^Lt(o,r,i,e,n),s3:t[a++]^Lt(o,i,e,n,r)}}function Dr(t,e,n,r,i){const{sbox2:o,T01:c,T23:s}=Yd;let a=0;e^=t[a++],n^=t[a++],r^=t[a++],i^=t[a++];const l=t.length/4-2;for(let u=0;u<l;u++){const d=t[a++]^bn(c,s,e,i,r,n),h=t[a++]^bn(c,s,n,e,i,r),f=t[a++]^bn(c,s,r,n,e,i),m=t[a++]^bn(c,s,i,r,n,e);e=d,n=h,r=f,i=m}return{s0:t[a++]^Lt(o,e,i,r,n),s1:t[a++]^Lt(o,n,e,i,r),s2:t[a++]^Lt(o,r,n,e,i),s3:t[a++]^Lt(o,i,r,n,e)}}function nr(t,e){if(e===void 0)return new Uint8Array(t);if((0,we.bytes)(e),e.length<t)throw new Error(`aes: wrong destination length, expected at least ${t}, got: ${e.length}`);if(!(0,ee.isAligned32)(e))throw new Error("unaligned dst");return e}function Zd(t,e,n,r){(0,we.bytes)(e,rt),(0,we.bytes)(n);const i=n.length;r=nr(i,r);const o=e,c=(0,ee.u32)(o);let{s0:s,s1:a,s2:l,s3:u}=Ze(t,c[0],c[1],c[2],c[3]);const d=(0,ee.u32)(n),h=(0,ee.u32)(r);for(let m=0;m+4<=d.length;m+=4){h[m+0]=d[m+0]^s,h[m+1]=d[m+1]^a,h[m+2]=d[m+2]^l,h[m+3]=d[m+3]^u;let g=1;for(let w=o.length-1;w>=0;w--)g=g+(255&o[w])|0,o[w]=255&g,g>>>=8;({s0:s,s1:a,s2:l,s3:u}=Ze(t,c[0],c[1],c[2],c[3]))}const f=rt*Math.floor(d.length/4);if(f<i){const m=new Uint32Array([s,a,l,u]),g=(0,ee.u8)(m);for(let w=f,p=0;w<i;w++,p++)r[w]=n[w]^g[p];(0,ee.clean)(m)}return r}function Jn(t,e,n,r,i){(0,we.bytes)(n,rt),(0,we.bytes)(r),i=nr(r.length,i);const o=n,c=(0,ee.u32)(o),s=(0,ee.createView)(o),a=(0,ee.u32)(r),l=(0,ee.u32)(i),u=e?0:12,d=r.length;let h=s.getUint32(u,e),{s0:f,s1:m,s2:g,s3:w}=Ze(t,c[0],c[1],c[2],c[3]);for(let C=0;C+4<=a.length;C+=4)l[C+0]=a[C+0]^f,l[C+1]=a[C+1]^m,l[C+2]=a[C+2]^g,l[C+3]=a[C+3]^w,h=h+1>>>0,s.setUint32(u,h,e),{s0:f,s1:m,s2:g,s3:w}=Ze(t,c[0],c[1],c[2],c[3]);const p=rt*Math.floor(a.length/4);if(p<d){const C=new Uint32Array([f,m,g,w]),_=(0,ee.u8)(C);for(let O=p,L=0;O<d;O++,L++)i[O]=r[O]^_[L];(0,ee.clean)(C)}return i}function Zc(t){if((0,we.bytes)(t),t.length%rt!=0)throw new Error("aes/(cbc-ecb).decrypt ciphertext should consist of blocks with size 16")}function Jc(t,e,n){(0,we.bytes)(t);let r=t.length;const i=r%rt;if(!e&&i!==0)throw new Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");(0,ee.isAligned32)(t)||(t=(0,ee.copyBytes)(t));const o=(0,ee.u32)(t);if(e){let s=rt-i;s||(s=rt),r+=s}const c=nr(r,n);return{b:o,o:(0,ee.u32)(c),out:c}}function Xc(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 Qc(t){const e=new Uint8Array(16),n=(0,ee.u32)(e);e.set(t);const r=rt-t.length;for(let i=rt-r;i<rt;i++)e[i]=r;return n}function Jd(t,e,n,r,i){const o=i==null?0:i.length,c=t.create(n,r.length+o);i&&c.update(i),c.update(r);const s=new Uint8Array(16),a=(0,ee.createView)(s);i&&(0,ee.setBigUint64)(a,0,BigInt(8*o),e),(0,ee.setBigUint64)(a,8,BigInt(8*r.length),e),c.update(s);const l=c.digest();return(0,ee.clean)(s),l}Te.ctr=(0,ee.wrapCipher)({blockSize:16,nonceLength:16},(function(t,e){function n(r,i){if((0,we.bytes)(r),i!==void 0&&((0,we.bytes)(i),!(0,ee.isAligned32)(i)))throw new Error("unaligned destination");const o=Ct(t),c=(0,ee.copyBytes)(e),s=[o,c];
2(0,ee.isAligned32)(r)||s.push(r=(0,ee.copyBytes)(r));const a=Zd(o,c,r,i);return(0,ee.clean)(...s),a}return(0,we.bytes)(t),(0,we.bytes)(e,rt),{encrypt:(r,i)=>n(r,i),decrypt:(r,i)=>n(r,i)}})),Te.ecb=(0,ee.wrapCipher)({blockSize:16},(function(t,e={}){(0,we.bytes)(t);const n=!e.disablePadding;return{encrypt(r,i){const{b:o,o:c,out:s}=Jc(r,n,i),a=Ct(t);let l=0;for(;l+4<=o.length;){const{s0:u,s1:d,s2:h,s3:f}=Ze(a,o[l+0],o[l+1],o[l+2],o[l+3]);c[l++]=u,c[l++]=d,c[l++]=h,c[l++]=f}if(n){const u=Qc(r.subarray(4*l)),{s0:d,s1:h,s2:f,s3:m}=Ze(a,u[0],u[1],u[2],u[3]);c[l++]=d,c[l++]=h,c[l++]=f,c[l++]=m}return(0,ee.clean)(a),s},decrypt(r,i){Zc(r);const o=Nr(t),c=nr(r.length,i),s=[o];(0,ee.isAligned32)(r)||s.push(r=(0,ee.copyBytes)(r));const a=(0,ee.u32)(r),l=(0,ee.u32)(c);for(let u=0;u+4<=a.length;){const{s0:d,s1:h,s2:f,s3:m}=Dr(o,a[u+0],a[u+1],a[u+2],a[u+3]);l[u++]=d,l[u++]=h,l[u++]=f,l[u++]=m}return(0,ee.clean)(...s),Xc(c,n)}}})),Te.cbc=(0,ee.wrapCipher)({blockSize:16,nonceLength:16},(function(t,e,n={}){(0,we.bytes)(t),(0,we.bytes)(e,16);const r=!n.disablePadding;return{encrypt(i,o){const c=Ct(t),{b:s,o:a,out:l}=Jc(i,r,o);let u=e;const d=[c];(0,ee.isAligned32)(u)||d.push(u=(0,ee.copyBytes)(u));const h=(0,ee.u32)(u);let f=h[0],m=h[1],g=h[2],w=h[3],p=0;for(;p+4<=s.length;)f^=s[p+0],m^=s[p+1],g^=s[p+2],w^=s[p+3],{s0:f,s1:m,s2:g,s3:w}=Ze(c,f,m,g,w),a[p++]=f,a[p++]=m,a[p++]=g,a[p++]=w;if(r){const C=Qc(i.subarray(4*p));f^=C[0],m^=C[1],g^=C[2],w^=C[3],{s0:f,s1:m,s2:g,s3:w}=Ze(c,f,m,g,w),a[p++]=f,a[p++]=m,a[p++]=g,a[p++]=w}return(0,ee.clean)(...d),l},decrypt(i,o){Zc(i);const c=Nr(t);let s=e;const a=[c];(0,ee.isAligned32)(s)||a.push(s=(0,ee.copyBytes)(s));const l=(0,ee.u32)(s),u=nr(i.length,o);
2(0,ee.isAligned32)(i)||a.push(i=(0,ee.copyBytes)(i));const d=(0,ee.u32)(i),h=(0,ee.u32)(u);let f=l[0],m=l[1],g=l[2],w=l[3];for(let p=0;p+4<=d.length;){const C=f,_=m,O=g,L=w;f=d[p+0],m=d[p+1],g=d[p+2],w=d[p+3];const{s0:U,s1:q,s2:F,s3:B}=Dr(c,f,m,g,w);h[p++]=U^C,h[p++]=q^_,h[p++]=F^O,h[p++]=B^L}return(0,ee.clean)(...a),Xc(u,r)}}})),Te.cfb=(0,ee.wrapCipher)({blockSize:16,nonceLength:16},(function(t,e){function n(r,i,o){(0,we.bytes)(r);const c=r.length;o=nr(c,o);const s=Ct(t);let a=e;const l=[s];(0,ee.isAligned32)(a)||l.push(a=(0,ee.copyBytes)(a)),(0,ee.isAligned32)(r)||l.push(r=(0,ee.copyBytes)(r));const u=(0,ee.u32)(r),d=(0,ee.u32)(o),h=i?d:u,f=(0,ee.u32)(a);let m=f[0],g=f[1],w=f[2],p=f[3];for(let _=0;_+4<=u.length;){const{s0:O,s1:L,s2:U,s3:q}=Ze(s,m,g,w,p);d[_+0]=u[_+0]^O,d[_+1]=u[_+1]^L,d[_+2]=u[_+2]^U,d[_+3]=u[_+3]^q,m=h[_++],g=h[_++],w=h[_++],p=h[_++]}const C=rt*Math.floor(u.length/4);if(C<c){({s0:m,s1:g,s2:w,s3:p}=Ze(s,m,g,w,p));const _=(0,ee.u8)(new Uint32Array([m,g,w,p]));for(let O=C,L=0;O<c;O++,L++)o[O]=r[O]^_[L];(0,ee.clean)(_)}return(0,ee.clean)(...l),o}return(0,we.bytes)(t),(0,we.bytes)(e,16),{encrypt:(r,i)=>n(r,!0,i),decrypt:(r,i)=>n(r,!1,i)}})),Te.gcm=(0,ee.wrapCipher)({blockSize:16,nonceLength:12,tagLength:16},(function(t,e,n){if((0,we.bytes)(t),(0,we.bytes)(e),n!==void 0&&(0,we.bytes)(n),e.length<8)throw new Error("aes/gcm: invalid nonce length");const r=16;function i(c,s,a){const l=Jd(Vs.ghash,!1,c,a,n);for(let u=0;u<s.length;u++)l[u]^=s[u];return l}function o(){const c=Ct(t),s=pi.slice(),a=pi.slice();if(Jn(c,!1,a,a,s),e.length===12)a.set(e);else{const l=pi.slice(),u=(0,ee.createView)(l);(0,ee.setBigUint64)(u,8,BigInt(8*e.length),!1);const d=Vs.ghash.create(s).update(e).update(l);d.digestInto(a),d.destroy()}return{xk:c,authKey:s,counter:a,tagMask:Jn(c,!1,a,pi)}}return{encrypt(c){(0,we.bytes)(c);const{xk:s,authKey:a,counter:l,tagMask:u}=o(),d=new Uint8Array(c.length+r),h=[s,a,l,u];(0,ee.isAligned32)(c)||h.push(c=(0,ee.copyBytes)(c)),Jn(s,!1,l,c,d);const f=i(a,u,d.subarray(0,d.length-r));return h.push(f),d.set(f,c.length),(0,ee.clean)(...h),d},decrypt(c){if((0,we.bytes)(c),c.length<r)throw new Error("aes/gcm: ciphertext less than tagLen (16)");const{xk:s,authKey:a,counter:l,tagMask:u}=o(),d=[s,a,u,l];(0,ee.isAligned32)(c)||d.push(c=(0,ee.copyBytes)(c));const h=c.subarray(0,-16),f=c.subarray(-16),m=i(a,u,h);if(d.push(m),!(0,ee.equalBytes)(m,f))throw new Error("aes/gcm: invalid ghash tag");const g=Jn(s,!1,l,h);return(0,ee.clean)(...d),g}}}));const mi=(t,e,n)=>r=>{if(!Number.isSafeInteger(r)||e>r||r>n)throw new Error(`${t}: invalid value=${r}, must be [${e}..${n}]`)};function Xd(t){return t!=null&&typeof t=="object"&&(t instanceof Uint32Array||t.constructor.name==="Uint32Array")}function Qd(t,e){if((0,we.bytes)(e,16),!Xd(t))throw new Error("_encryptBlock accepts result of expandKeyLE");const n=(0,ee.u32)(e);let{s0:r,s1:i,s2:o,s3:c}=Ze(t,n[0],n[1],n[2],n[3]);return n[0]=r,n[1]=i,n[2]=o,n[3]=c,e}function eh(t,e){if((0,we.bytes)(e,16),!Xd(t))throw new Error("_decryptBlock accepts result of expandKeyLE");const n=(0,ee.u32)(e);let{s0:r,s1:i,s2:o,s3:c}=Dr(t,n[0],n[1],n[2],n[3]);return n[0]=r,n[1]=i,n[2]=o,n[3]=c,e}Te.siv=(0,ee.wrapCipher)({blockSize:16,nonceLength:12,tagLength:16},(function(t,e,n){const r=mi("AAD",0,68719476736),i=mi("plaintext",0,2**36),o=mi("nonce",12,12),c=mi("ciphertext",16,2**36+16);function s(){const u=Ct(t),d=new Uint8Array(t.length),h=new Uint8Array(16),f=[u,d];let m=e;(0,ee.isAligned32)(m)||f.push(m=(0,ee.copyBytes)(m));const g=(0,ee.u32)(m);let w=0,p=g[0],C=g[1],_=g[2],O=0;for(const U of[h,d].map(ee.u32)){const q=(0,ee.u32)(U);for(let F=0;F<q.length;F+=2){const{s0:B,s1:N}=Ze(u,w,p,C,_);q[F+0]=B,q[F+1]=N,w=++O}}const L={authKey:h,encKey:Ct(d)};return(0,ee.clean)(...f),L}function a(u,d,h){const f=Jd(Vs.polyval,!0,d,h,n);for(let _=0;_<12;_++)f[_]^=e[_];f[15]&=127;const m=(0,ee.u32)(f);let g=m[0],w=m[1],p=m[2],C=m[3];return{s0:g,s1:w,s2:p,s3:C}=Ze(u,g,w,p,C),m[0]=g,m[1]=w,m[2]=p,m[3]=C,f}function l(u,d,h){let f=(0,ee.copyBytes)(d);f[15]|=128;const m=Jn(u,!0,f,h);return(0,ee.clean)(f),m}return(0,we.bytes)(t,16,24,32),(0,we.bytes)(e),o(e.length),n!==void 0&&((0,we.bytes)(n),r(n.length)),{encrypt
2(u){(0,we.bytes)(u),i(u.length);const{encKey:d,authKey:h}=s(),f=a(d,h,u),m=[d,h,f];(0,ee.isAligned32)(u)||m.push(u=(0,ee.copyBytes)(u));const g=new Uint8Array(u.length+16);return g.set(f,u.length),g.set(l(d,f,u)),(0,ee.clean)(...m),g},decrypt(u){(0,we.bytes)(u),c(u.length);const d=u.subarray(-16),{encKey:h,authKey:f}=s(),m=[h,f];(0,ee.isAligned32)(u)||m.push(u=(0,ee.copyBytes)(u));const g=l(h,d,u.subarray(0,-16)),w=a(h,f,g);if(m.push(w),!(0,ee.equalBytes)(d,w))throw(0,ee.clean)(...m),new Error("invalid polyval tag");return(0,ee.clean)(...m),g}}}));const no={encrypt(t,e){if(e.length>=2**32)throw new Error("plaintext should be less than 4gb");const n=Ct(t);if(e.length===16)Qd(n,e);else{const r=(0,ee.u32)(e);let i=r[0],o=r[1];for(let c=0,s=1;c<6;c++)for(let a=2;a<r.length;a+=2,s++){const{s0:l,s1:u,s2:d,s3:h}=Ze(n,i,o,r[a],r[a+1]);i=l,o=u^to(s),r[a]=d,r[a+1]=h}r[0]=i,r[1]=o}n.fill(0)},decrypt(t,e){if(e.length-8>=2**32)throw new Error("ciphertext should be less than 4gb");const n=Nr(t),r=e.length/8-1;if(r===1)eh(n,e);else{const i=(0,ee.u32)(e);let o=i[0],c=i[1];for(let s=0,a=6*r;s<6;s++)for(let l=2*r;l>=1;l-=2,a--){c^=to(a);const{s0:u,s1:d,s2:h,s3:f}=Dr(n,o,c,i[l],i[l+1]);o=u,c=d,i[l]=h,i[l+1]=f}i[0]=o,i[1]=c}n.fill(0)}},el=new Uint8Array(8).fill(166);Te.aeskw=(0,ee.wrapCipher)({blockSize:8},(t=>({encrypt(e){if((0,we.bytes)(e),!e.length||e.length%8!=0)throw new Error("invalid plaintext length");if(e.length===8)throw new Error("8-byte keys not allowed in AESKW, use AESKWP instead");const n=(0,ee.concatBytes)(el,e);return no.encrypt(t,n),n},decrypt(e){if((0,we.bytes)(e),e.length%8!=0||e.length<24)throw new Error("invalid ciphertext length");const n=(0,ee.copyBytes)(e);if(no.decrypt(t,n),!(0,ee.equalBytes)(n.subarray(0,8),el))throw new Error("integrity check failed");return n.subarray(0,8).fill(0),n.subarray(8)}})));const tl=2790873510;Te.aeskwp=(0,ee.wrapCipher)({blockSize:8},(t=>({encrypt(e){if((0,we.bytes)(e),!e.length)throw new Error("invalid plaintext length");const n=8*Math.ceil(e.length/8),r=new Uint8Array(8+n);r.set(e,8);const i=(0,ee.u32)(r);return i[0]=tl,i[1]=to(e.length),no.encrypt(t,r),r},decrypt(e){if((0,we.bytes)(e),e.length<16)throw new Error("invalid ciphertext length");const n=(0,ee.copyBytes)(e),r=(0,ee.u32)(n);no.decrypt(t,n);const i=to(r[1])>>>0,o=8*Math.ceil(i/8);if(r[0]!==tl||n.length-8!==o)throw new Error("integrity check failed");for(let c=i;c<o;c++)if(n[8+c]!==0)throw new Error("integrity check failed");return n.subarray(0,8).fill(0),n.subarray(8,8+i)}}))),Te.unsafe={expandKeyLE:Ct,expandKeyDecLE:Nr,encrypt:Ze,decrypt:Dr,encryptBlock:Qd,decryptBlock:eh,ctrCounter:Zd,ctr32:Jn},Object.defineProperty(tr,"__esModule",{value:!0}),tr.aes256cbc=tr.aes256gcm=void 0;var th=Te;tr.aes256gcm=function(t,e,n){return(0,th.gcm)(t,e,n)};tr.aes256cbc=function(t,e,n){return(0,th.cbc)(t,e)};var ro={},nh={},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:c}=(0,pt.checkOpts)({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},e);if(typeof t!="function")throw new Error("core must be a function");return(0,Ft.number)(i),(0,Ft.number)(c),(0,Ft.bool)(o),(0,Ft.bool)(n),(s,a,l,u,d=0)=>{(0,Ft.bytes)(s),(0,Ft.bytes)(a),(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>=nl)throw new Error("arx: counter overflow");if(u.length<h)throw new Error(`arx: output (${u.length}) is shorter than data (${h})`);const f=[];let m,g,w=s.length;if(w===32)f.push(m=(0,pt.copyBytes)(s)),g=ih;else{if(w!==16||!n)throw new Error(`arx: invalid 32-byte key, got length=${w}`);
2m=new Uint8Array(32),m.set(s),m.set(s,16),g=z0,f.push(m)}as(a)||f.push(a=(0,pt.copyBytes)(a));const p=(0,pt.u32)(m);if(r){if(a.length!==24)throw new Error("arx: extended nonce must be 24 bytes");r(g,p,(0,pt.u32)(a.subarray(0,16)),p),a=a.subarray(16)}const C=16-i;if(C!==a.length)throw new Error(`arx: nonce must be ${C} or 16 bytes`);if(C!==12){const O=new Uint8Array(12);O.set(a,o?0:12-a.length),a=O,f.push(a)}const _=(0,pt.u32)(a);return(function(O,L,U,q,F,B,N,H){const $=F.length,P=new Uint8Array(gi),M=(0,pt.u32)(P),S=as(F)&&as(B),I=S?(0,pt.u32)(F):rl,j=S?(0,pt.u32)(B):rl;for(let y=0;y<$;N++){if(O(L,U,q,M,N,H),N>=nl)throw new Error("arx: counter overflow");const E=Math.min(gi,$-y);if(S&&E===gi){const A=y/4;if(y%4!=0)throw new Error("arx: invalid block position");for(let T,b=0;b<V0;b++)T=A+b,j[T]=I[T]^M[b];y+=gi}else{for(let A,T=0;T<E;T++)A=y+T,B[A]=F[A]^P[T];y+=E}}})(t,g,p,_,l,u,d,c),(0,pt.clean)(...f),u}};const Ft=ze,pt=ut,rh=t=>Uint8Array.from(t.split("").map((e=>e.charCodeAt(0)))),F0=rh("expand 16-byte k"),q0=rh("expand 32-byte k"),z0=(0,pt.u32)(F0),ih=(0,pt.u32)(q0);function as(t){return t.byteOffset%4==0}Xn.sigma=ih.slice();const gi=64,V0=16,nl=2**32-1,rl=new Uint32Array;var kr={};Object.defineProperty(kr,"__esModule",{value:!0}),kr.poly1305=void 0,kr.wrapConstructorWithKey=oh;const yi=ze,Er=ut,$e=(t,e)=>255&t[e++]|(255&t[e++])<<8;class W0{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,yi.bytes)(e,32);const n=$e(e,0),r=$e(e,2),i=$e(e,4),o=$e(e,6),c=$e(e,8),s=$e(e,10),a=$e(e,12),l=$e(e,14);this.r[0]=8191&n,this.r[1]=8191&(n>>>13|r<<3),this.r[2]=7939&(r>>>10|i<<6),this.r[3]=8191&(i>>>7|o<<9),this.r[4]=255&(o>>>4|c<<12),this.r[5]=c>>>1&8190,this.r[6]=8191&(c>>>14|s<<2),this.r[7]=8065&(s>>>11|a<<5),this.r[8]=8191&(a>>>8|l<<8),this.r[9]=l>>>5&127;for(let u=0;u<8;u++)this.pad[u]=$e(e,16+2*u)}process(e,n,r=!1){const i=r?0:2048,{h:o,r:c}=this,s=c[0],a=c[1],l=c[2],u=c[3],d=c[4],h=c[5],f=c[6],m=c[7],g=c[8],w=c[9],p=$e(e,n+0),C=$e(e,n+2),_=$e(e,n+4),O=$e(e,n+6),L=$e(e,n+8),U=$e(e,n+10),q=$e(e,n+12),F=$e(e,n+14);let B=o[0]+(8191&p),N=o[1]+(8191&(p>>>13|C<<3)),H=o[2]+(8191&(C>>>10|_<<6)),$=o[3]+(8191&(_>>>7|O<<9)),P=o[4]+(8191&(O>>>4|L<<12)),M=o[5]+(L>>>1&8191),S=o[6]+(8191&(L>>>14|U<<2)),I=o[7]+(8191&(U>>>11|q<<5)),j=o[8]+(8191&(q>>>8|F<<8)),y=o[9]+(F>>>5|i),E=0,A=E+B*s+N*(5*w)+H*(5*g)+$*(5*m)+P*(5*f);E=A>>>13,A&=8191,A+=M*(5*h)+S*(5*d)+I*(5*u)+j*(5*l)+y*(5*a),E+=A>>>13,A&=8191;let T=E+B*a+N*s+H*(5*w)+$*(5*g)+P*(5*m);E=T>>>13,T&=8191,T+=M*(5*f)+S*(5*h)+I*(5*d)+j*(5*u)+y*(5*l),E+=T>>>13,T&=8191;let b=E+B*l+N*a+H*s+$*(5*w)+P*(5*g);E=b>>>13,b&=8191,b+=M*(5*m)+S*(5*f)+I*(5*h)+j*(5*d)+y*(5*u),E+=b>>>13,b&=8191;let v=E+B*u+N*l+H*a+$*s+P*(5*w);E=v>>>13,v&=8191,v+=M*(5*g)+S*(5*m)+I*(5*f)+j*(5*h)+y*(5*d),E+=v>>>13,v&=8191;let k=E+B*d+N*u+H*l+$*a+P*s;E=k>>>13,k&=8191,k+=M*(5*w)+S*(5*g)+I*(5*m)+j*(5*f)+y*(5*h),E+=k>>>13,k&=8191;let x=E+B*h+N*d+H*u+$*l+P*a;E=x>>>13,x&=8191,x+=M*s+S*(5*w)+I*(5*g)+j*(5*m)+y*(5*f),E+=x>>>13,x&=8191;let R=E+B*f+N*h+H*d+$*u+P*l;E=R>>>13,R&=8191,R+=M*a+S*s+I*(5*w)+j*(5*g)+y*(5*m),E+=R>>>13,R&=8191;let D=E+B*m+N*f+H*h+$*d+P*u;E=D>>>13,D&=8191,D+=M*l+S*a+I*s+j*(5*w)+y*(5*g),E+=D>>>13,D&=8191;let K=E+B*g+N*m+H*f+$*h+P*d;E=K>>>13,K&=8191,K+=M*u+S*l+I*a+j*s+y*(5*w),E+=K>>>13,K&=8191;let z=E+B*w+N*g+H*m+$*f+P*h;E=z>>>13,z&=8191,z+=M*d+S*u+I*l+j*a+y*s,E+=z>>>13,z&=8191,E=(E<<2)+E|0,E=E+A|0,A=8191&E,E>>>=13,T+=E,o[0]=A,o[1]=T,o[2]=b,o[3]=v,o[4]=k,o[5]=x,o[6]=R,o[7]=D,o[8]=K,o[9]=z}finalize(){const{h:e,pad:n}=this,r=new Uint16Array(10);let i=e[1]>>>13;e[1]&=8191;for(let s=2;s<10;s++)e[s]+=i,i=e[s]>>>13,e[s]&=8191;e[0]+=5*i,i=e[0]>>>13,e[0]&=8191,e[1]+=i,i=e[1]>>>13,e[1]&=8191,e[2]+=i,r[0]=e[0]+5,i=r[0]>>>13,r[0]&=8191;for(let s=1;s<10;s++)r[s]=e[s]+i,i=r[s]>>>13,r[s]&=8191;r[9]-=8192;let o=(1^i)-1;for(let s=0;s<10;s++)r[s]&=o;o=~o;for(let s=0;s<10;s++)e[s]=e[s]&o|r[s];e[0]=65535&(e[0]|e[1]<<13),e[1]=65535&(e[1]>>>3|e[2]<<10),e[2]=65535&(e[2]>>>
26|e[3]<<7),e[3]=65535&(e[3]>>>9|e[4]<<4),e[4]=65535&(e[4]>>>12|e[5]<<1|e[6]<<14),e[5]=65535&(e[6]>>>2|e[7]<<11),e[6]=65535&(e[7]>>>5|e[8]<<8),e[7]=65535&(e[8]>>>8|e[9]<<5);let c=e[0]+n[0];e[0]=65535&c;for(let s=1;s<8;s++)c=(e[s]+n[s]|0)+(c>>>16)|0,e[s]=65535&c;(0,Er.clean)(r)}update(e){(0,yi.exists)(this);const{buffer:n,blockLen:r}=this,i=(e=(0,Er.toBytes)(e)).length;for(let o=0;o<i;){const c=Math.min(r-this.pos,i-o);if(c!==r)n.set(e.subarray(o,o+c),this.pos),this.pos+=c,o+=c,this.pos===r&&(this.process(n,0,!1),this.pos=0);else for(;r<=i-o;o+=r)this.process(e,o)}return this}destroy(){(0,Er.clean)(this.h,this.r,this.buffer,this.pad)}digestInto(e){(0,yi.exists)(this),(0,yi.output)(e,this),this.finished=!0;const{buffer:n,h:r}=this;let{pos:i}=this;if(i){for(n[i++]=1;i<16;i++)n[i]=0;this.process(n,0,!0)}this.finalize();let o=0;for(let c=0;c<8;c++)e[o++]=r[c]>>>0,e[o++]=r[c]>>>8;return e}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const r=e.slice(0,n);return this.destroy(),r}}function oh(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=oh((t=>new W0(t))),(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.xchacha20poly1305=t.chacha20poly1305=t._poly1305_aead=t.chacha12=t.chacha8=t.xchacha20=t.chacha20=t.chacha20orig=void 0,t.hchacha=c;const e=Xn,n=ze,r=kr,i=ut;function o(d,h,f,m,g,w=20){let p=d[0],C=d[1],_=d[2],O=d[3],L=h[0],U=h[1],q=h[2],F=h[3],B=h[4],N=h[5],H=h[6],$=h[7],P=g,M=f[0],S=f[1],I=f[2],j=p,y=C,E=_,A=O,T=L,b=U,v=q,k=F,x=B,R=N,D=H,K=$,z=P,V=M,Z=S,Q=I;for(let oe=0;oe<w;oe+=2)j=j+T|0,z=(0,e.rotl)(z^j,16),x=x+z|0,T=(0,e.rotl)(T^x,12),j=j+T|0,z=(0,e.rotl)(z^j,8),x=x+z|0,T=(0,e.rotl)(T^x,7),y=y+b|0,V=(0,e.rotl)(V^y,16),R=R+V|0,b=(0,e.rotl)(b^R,12),y=y+b|0,V=(0,e.rotl)(V^y,8),R=R+V|0,b=(0,e.rotl)(b^R,7),E=E+v|0,Z=(0,e.rotl)(Z^E,16),D=D+Z|0,v=(0,e.rotl)(v^D,12),E=E+v|0,Z=(0,e.rotl)(Z^E,8),D=D+Z|0,v=(0,e.rotl)(v^D,7),A=A+k|0,Q=(0,e.rotl)(Q^A,16),K=K+Q|0,k=(0,e.rotl)(k^K,12),A=A+k|0,Q=(0,e.rotl)(Q^A,8),K=K+Q|0,k=(0,e.rotl)(k^K,7),j=j+b|0,Q=(0,e.rotl)(Q^j,16),D=D+Q|0,b=(0,e.rotl)(b^D,12),j=j+b|0,Q=(0,e.rotl)(Q^j,8),D=D+Q|0,b=(0,e.rotl)(b^D,7),y=y+v|0,z=(0,e.rotl)(z^y,16),K=K+z|0,v=(0,e.rotl)(v^K,12),y=y+v|0,z=(0,e.rotl)(z^y,8),K=K+z|0,v=(0,e.rotl)(v^K,7),E=E+k|0,V=(0,e.rotl)(V^E,16),x=x+V|0,k=(0,e.rotl)(k^x,12),E=E+k|0,V=(0,e.rotl)(V^E,8),x=x+V|0,k=(0,e.rotl)(k^x,7),A=A+T|0,Z=(0,e.rotl)(Z^A,16),R=R+Z|0,T=(0,e.rotl)(T^R,12),A=A+T|0,Z=(0,e.rotl)(Z^A,8),R=R+Z|0,T=(0,e.rotl)(T^R,7);let ne=0;m[ne++]=p+j|0,m[ne++]=C+y|0,m[ne++]=_+E|0,m[ne++]=O+A|0,m[ne++]=L+T|0,m[ne++]=U+b|0,m[ne++]=q+v|0,m[ne++]=F+k|0,m[ne++]=B+x|0,m[ne++]=N+R|0,m[ne++]=H+D|0,m[ne++]=$+K|0,m[ne++]=P+z|0,m[ne++]=M+V|0,m[ne++]=S+Z|0,m[ne++]=I+Q|0}function c(d,h,f,m){let g=d[0],w=d[1],p=d[2],C=d[3],_=h[0],O=h[1],L=h[2],U=h[3],q=h[4],F=h[5],B=h[6],N=h[7],H=f[0],$=f[1],P=f[2],M=f[3];for(let I=0;I<20;I+=2)g=g+_|0,H=(0,e.rotl)(H^g,16),q=q+H|0,_=(0,e.rotl)(_^q,12),g=g+_|0,H=(0,e.rotl)(H^g,8),q=q+H|0,_=(0,e.rotl)(_^q,7),w=w+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+L|0,P=(0,e.rotl)(P^p,16),B=B+P|0,L=(0,e.rotl)(L^B,12),p=p+L|0,P=(0,e.rotl)(P^p,8),B=B+P|0,L=(0,e.rotl)(L^B,7),C=C+U|0,M=(0,e.rotl)(M^C,16),N=N+M|0,U=(0,e.rotl)(U^N,12),C=C+U|0,M=(0,e.rotl)(M^C,8),N=N+M|0,U=(0,e.rotl)(U^N,7),g=g+O|0,M=(0,e.rotl)(M^g,16),B=B+M|0,O=(0,e.rotl)(O^B,12),g=g+O|0,M=(0,e.rotl)(M^g,8),B=B+M|0,O=(0,e.rotl)(O^B,7),w=w+L|0,H=(0,e.rotl)(H^w,16),N=N+H|0,L=(0,e.rotl)(L^N,12),w=w+L|0,H=(0,e.rotl)(H^w,8),N=N+H|0,L=(0,e.rotl)(L^N,7),p=p+U|0,$=(0,e.rotl)($^p,16),q=q+$|0,U=(0,e.rotl)(U^q,12),p=p+U|0,$=(0,e.rotl)($^p,8),q=q+$|0,U=(0,e.rotl)(U^q,7),C=C+_|0,P=(0,e.rotl)(P^C,16),F=F+P|0,_=(0,e.rotl)(_^F,12),C=C+_|0,P=(0,e.rotl)(P^C,8),F=F+P|0,_=(0,e.rotl)(_^F,7);let S=0;m[S++]=g,m[S++]=w,m[S++]=p,m[S++]=C,m[S++]=H,m[S++]=$,m[S++]=P,m[S++]=M}t.chacha20orig=(0,e.createCipher)(o,{counterRight:!1,counterLength:8,allowShortKeys:!0}),t.chacha20=(0,e.createCipher)(o,{counterRight:!1,counterLength:4,allowShortKeys:!1}),t.xchacha20=(0,e.createCipher)(o,{counterRight:!1,counterLength:8,extendNonceFn:c,allowShortKeys:!1}),t.chacha8=(0,e.createCipher)(o,{counterRight:!1,counterLength:4,rounds:8}),t.chacha12=(0,e.createCipher)(o,{counterRight:!1,counterLength:4,rounds:12});const s=new Uint8Array(16),a=(d,h)=>{d.update(h);const f=h.length%16;f&&d.update(s.subarray(f))},l=new Uint8Array(32);function u(d,h,f,m,g){const w=d(h,f,l),p=r.poly1305.create(w);g&&a(p,g),a(p,m);const C=new Uint8Array(16),_=(0,i.createView)(C);(0,i.setBigUint64)(_,0,BigInt(g?g.length:0),!0),(0,i.setBigUint64)(_,8,BigInt(m.length),!0),p.update(C);const O=p.digest();return(0,i.clean)(w,C),O}t._poly1305_aead=d=>(h,f,m)=>
2((0,n.bytes)(h,32),(0,n.bytes)(f),{encrypt(w,p){const C=w.length,_=C+16;p?(0,n.bytes)(p,_):p=new Uint8Array(_),d(h,f,w,p,1);const O=u(d,h,f,p.subarray(0,-16),m);return p.set(O,C),(0,i.clean)(O),p},decrypt(w,p){const C=w.length,_=C-16;if(C<16)throw new Error("encrypted data must be at least 16 bytes");p?(0,n.bytes)(p,_):p=new Uint8Array(_);const O=w.subarray(0,-16),L=w.subarray(-16),U=u(d,h,f,O,m);if(!(0,i.equalBytes)(L,U))throw new Error("invalid tag");return d(h,f,O,p,1),(0,i.clean)(U),p}}),t.chacha20poly1305=(0,i.wrapCipher)({blockSize:64,nonceLength:12,tagLength:16},(0,t._poly1305_aead)(t.chacha20)),t.xchacha20poly1305=(0,i.wrapCipher)({blockSize:64,nonceLength:24,tagLength:16},(0,t._poly1305_aead)(t.xchacha20))})(nh),Object.defineProperty(ro,"__esModule",{value:!0}),ro.xchacha20=void 0;var Fn,il,gr,G0=nh;ro.xchacha20=function(t,e,n){return(0,G0.xchacha20poly1305)(t,e,n)},(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.aesDecrypt=t.aesEncrypt=t.symDecrypt=t.symEncrypt=void 0;var e=ut,n=Sa,r=tr,i=ro,o=Ir,c=Ne;t.symEncrypt=function(u,d,h){return s(a,u,d,h)};function s(u,d,h,f){var m=(0,o.symmetricAlgorithm)();if(m==="aes-256-gcm")return u(r.aes256gcm,d,h,(0,o.symmetricNonceLength)(),c.AEAD_TAG_LENGTH,f);if(m==="xchacha20")return u(i.xchacha20,d,h,c.XCHACHA20_NONCE_LENGTH,c.AEAD_TAG_LENGTH,f);if(m==="aes-256-cbc")return u(r.aes256cbc,d,h,16,0);throw new Error("Not implemented")}function a(u,d,h,f,m,g){var w=(0,n.randomBytes)(f),p=u(d,w,g).encrypt(h);if(m===0)return(0,e.concatBytes)(w,p);var C=p.length-m,_=p.subarray(0,C),O=p.subarray(C);return(0,e.concatBytes)(w,O,_)}function l(u,d,h,f,m,g){var w=h.subarray(0,f),p=u(d,Uint8Array.from(w),g),C=h.subarray(f);if(m===0)return p.decrypt(C);var _=C.subarray(0,m),O=C.subarray(m);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})(Gc),Fn=Ao,il=bt&&bt.__createBinding||(Object.create?function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]}),gr=bt&&bt.__exportStar||function(t,e){for(var n in t)n==="default"||Object.prototype.hasOwnProperty.call(e,n)||il(e,t,n)},Object.defineProperty(Fn,"__esModule",{value:!0}),gr(ad,Fn),gr(Hd,Fn),gr(qs,Fn),gr(Gc,Fn);var Br={};Object.defineProperty(Br,"__esModule",{value:!0}),Br.PublicKey=void 0;var ol=ut,vi=Ao,Y0=(function(){function t(e){this.data=(0,vi.convertPublicKeyFormat)(e,!0)}return t.fromHex=function(e){return new t((0,vi.hexToPublicKey)(e))},Object.defineProperty(t.prototype,"uncompressed",{get:function(){return X.from((0,vi.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,ol.bytesToHex)(e?this.data:this.uncompressed)}
2,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,vi.getSharedKey)(r,i)},t.prototype.equals=function(e){return(0,ol.equalBytes)(this.data,e.data)},t})();Br.PublicKey=Y0,Object.defineProperty(Ji,"__esModule",{value:!0}),Ji.PrivateKey=void 0;var sl=ut,qn=Ao,Z0=Br,J0=(function(){function t(e){if(e===void 0)this.data=(0,qn.getValidSecret)();else{if(!(0,qn.isValidPrivateKey)(e))throw new Error("Invalid private key");this.data=e}this.publicKey=new Z0.PublicKey((0,qn.getPublicKey)(this.data))}return t.fromHex=function(e){return new t((0,qn.decodeHex)(e))},Object.defineProperty(t.prototype,"secret",{get:function(){return X.from(this.data)},enumerable:!1,configurable:!0}),t.prototype.toHex=function(){return(0,sl.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,qn.getSharedKey)(r,i)},t.prototype.multiply=function(e,n){return n===void 0&&(n=!1),(0,qn.getSharedPoint)(this.data,e.compressed,n)},t.prototype.equals=function(e){return(0,sl.equalBytes)(this.data,e.data)},t})();Ji.PrivateKey=J0,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.PublicKey=t.PrivateKey=void 0;var e=Ji;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}})})(Vo),(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.utils=t.PublicKey=t.PrivateKey=t.ECIES_CONFIG=void 0,t.encrypt=function(s,a){var l=new r.PrivateKey,u=s instanceof Uint8Array?new r.PublicKey(s):r.PublicKey.fromHex(s),d=l.encapsulate(u,(0,n.isHkdfKeyCompressed)()),h=(0,n.isEphemeralKeyCompressed)()?l.publicKey.compressed:l.publicKey.uncompressed,f=(0,i.symEncrypt)(d,a);return X.from((0,e.concatBytes)(h,f))},t.decrypt=function(s,a){var l=s instanceof Uint8Array?new r.PrivateKey(s):r.PrivateKey.fromHex(s),u=(0,n.ephemeralKeySize)(),d=new r.PublicKey(a.subarray(0,u)),h=a.subarray(u),f=d.decapsulate(l,(0,n.isHkdfKeyCompressed)());return X.from((0,i.symDecrypt)(f,h))};var e=ut,n=Ir,r=Vo,i=Ao,o=Ir;Object.defineProperty(t,"ECIES_CONFIG",{enumerable:!0,get:function(){return o.ECIES_CONFIG}});var c=Vo;Object.defineProperty(t,"PrivateKey",{enumerable:!0,get:function(){return c.PrivateKey}}),Object.defineProperty(t,"PublicKey",{enumerable:!0,get:function(){return c.PublicKey}}),t.utils={aesEncrypt:i.aesEncrypt,aesDecrypt:i.aesDecrypt,symEncrypt:i.symEncrypt,symDecrypt:i.symDecrypt,decodeHex:i.decodeHex,getValidSecret:i.getValidSecret,remove0x:i.remove0x}})(Vn);const sh=Je("KeyExchange:Layer"),ah=Je("SocketService:Layer"),ch=Je("Ecies:Layer"),lh=Je("RemoteCommunication:Layer");sh.color="##95c44e",ah.color="#f638d7",ch.color="#465b9c",lh.color="#47a2be";const W={KeyExchange:sh,SocketService:ah,Ecies:ch,RemoteCommunication:lh};let yr,bi=[],cs=[];const Qt=(t,e)=>J(void 0,void 0,void 0,(function*(){yr=e,cs.push(t),(function(n){return J(this,void 0,void 0,(function*(){if(!yr||!n)return;(function(){const c=cs;cs=bi,bi=c})();const r=yr.endsWith("/")?`${yr}evt`:`${yr}/evt`,i=Object.assign({},n);if(delete i.params,n.params)for(const[c,s]of Object.entries(n.params))i[c]=s;const o=JSON.stringify(i);W.RemoteCommunication(`[sendBufferedEvents] Sending ${bi.length} analytics events to ${r}`);try{const c=yield Ou(r,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:o}),s=yield c.text();W.RemoteCommunication(`[sendBufferedEvents] Response: ${s}`),bi.length=0}catch{}}))})(t).catch((()=>{}))}));class ls{constructor(e){this.enabled=!0,e?.debug&&Je.enable("Ecies:Layer"),this.ecies=e?.privateKey?Vn.PrivateKey.fromHex(e.privateKey):new Vn.PrivateKey,W.Ecies("[ECIES constructor()] initialized secret: ",this.ecies.toHex()),W.Ecies("[ECIES constructor()] initialized public: ",this.ecies.publicKey.toHex()),W.Ecies("[ECIES constructor()] init with",this)}generateECIES(){this.ecies=new Vn.PrivateKey}getPublicKey(){return this.ecies.publicKey.toHex()}encrypt(e,n){let r=e;if(this.enabled)try{W.Ecies("[ECIES: encrypt()] using otherPublicKey",n);
2const i=X.from(e),o=Vn.encrypt(n,i);r=X.from(o).toString("base64")}catch(i){throw W.Ecies("[ECIES: encrypt()] error encrypt:",i),W.Ecies("[ECIES: encrypt()] private: ",this.ecies.toHex()),W.Ecies("[ECIES: encrypt()] data: ",e),W.Ecies("[ECIES: encrypt()] otherkey: ",n),i}return r}decrypt(e){let n=e;if(this.enabled)try{W.Ecies("[ECIES: decrypt()] using privateKey",this.ecies.toHex());const r=X.from(e.toString(),"base64");n=Vn.decrypt(this.ecies.toHex(),r).toString()}catch(r){throw W.Ecies("[ECIES: decrypt()] error decrypt",r),W.Ecies("[ECIES: decrypt()] private: ",this.ecies.toHex()),W.Ecies("[ECIES: decrypt()] encryptedData: ",e),r}return n}getKeyInfo(){return{private:this.ecies.toHex(),public:this.ecies.publicKey.toHex()}}toString(){W.Ecies("[ECIES: toString()]",this.getKeyInfo())}}var Cn={version:"0.33.1"};const sr="https://metamask-sdk.api.cx.metamask.io/",X0=["websocket"],ar=6048e5,Q0=3e3,Fe={METAMASK_CONNECTSIGN:"metamask_connectSign",METAMASK_CONNECTWITH:"metamask_connectWith",METAMASK_OPEN:"metamask_open",METAMASK_BATCH:"metamask_batch",PERSONAL_SIGN:"personal_sign",WALLET_REQUESTPERMISSIONS:"wallet_requestPermissions",WALLET_REVOKEPERMISSIONS:"wallet_revokePermissions",WALLET_WATCHASSET:"wallet_watchAsset",ETH_REQUESTACCOUNTS:"eth_requestAccounts",ETH_SENDTRANSACTION:"eth_sendTransaction",ETH_SIGNTYPEDDATA:"eth_signTypedData",ETH_SIGNTYPEDDATA_V3:"eth_signTypedData_v3",ETH_SIGNTYPEDDATA_V4:"eth_signTypedData_v4",ETH_SIGNTRANSACTION:"eth_signTransaction",ETH_SIGN:"eth_sign",PERSONAL_EC_RECOVER:"personal_ecRecover"},em=[Fe.METAMASK_CONNECTSIGN,Fe.METAMASK_CONNECTWITH,Fe.METAMASK_OPEN,Fe.METAMASK_BATCH,Fe.PERSONAL_SIGN,Fe.WALLET_REQUESTPERMISSIONS,Fe.WALLET_REVOKEPERMISSIONS,Fe.WALLET_WATCHASSET,Fe.ETH_SENDTRANSACTION,Fe.ETH_SIGNTYPEDDATA,Fe.ETH_SIGNTYPEDDATA_V3,Fe.ETH_SIGNTYPEDDATA_V4,Fe.ETH_SIGNTRANSACTION,Fe.ETH_SIGN,Fe.PERSONAL_EC_RECOVER];function Zr(t){return em.includes(t)}function uh(t){const{context:e}=t;W.RemoteCommunication(`[RemoteCommunication: clean()] context=${e}`),t.channelConfig=void 0,t.ready=!1,t.originatorConnectStarted=!1}var Ue,te,io,Se,xe,Oe,zn;(zn=Ue||(Ue={})).DISCONNECTED="disconnected",zn.WAITING="waiting",zn.TIMEOUT="timeout",zn.LINKED="linked",zn.PAUSED="paused",zn.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
2aiting",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={})),(io||(io={})).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 tm extends Eo.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?.privateKey&&n&&(W.KeyExchange(`[KeyExchange: constructor()] otherPubKey=${n} set keysExchanged to true!`,i),this.keysExchanged=!0),this.myECIES=new ls(Object.assign(Object.assign({},i),{debug:o?.eciesLayer})),this.communicationLayer.state.eciesInstance=this.myECIES,this.myPublicKey=this.myECIES.getPublicKey(),this.debug=o?.keyExchangeLayer===!0,n&&this.setOtherPublicKey(n),this.communicationLayer.on(io.KEY_EXCHANGE,this.onKeyExchangeMessage.bind(this))}onKeyExchangeMessage(e){const{relayPersistence:n}=this.communicationLayer.remote.state;if(W.KeyExchange(`[KeyExchange: onKeyExchangeMessage()] context=${this.context} keysExchanged=${this.keysExchanged} relayPersistence=${n}`,e),n)return void W.KeyExchange("[KeyExchange: onKeyExchangeMessage()] Ignoring key exchange message because relay persistence is activated");const{message:r}=e;this.keysExchanged&&W.KeyExchange(`[KeyExchange: onKeyExchangeMessage()] context=${this.context} received handshake while already exchanged. step=${this.step} otherPubKey=${this.otherPublicKey}`),this.emit(te.KEY_INFO,r.type),r.type===Se.KEY_HANDSHAKE_SYN?(this.checkStep([Se.KEY_HANDSHAKE_NONE,Se.KEY_HANDSHAKE_ACK]),W.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_SYN",r),r.pubkey&&this.setOtherPublicKey(r.pubkey),this.communicationLayer.sendMessage({type:Se.KEY_HANDSHAKE_SYNACK,pubkey:this.myPublicKey}).catch((i=>{W.KeyExchange("[KeyExchange: onKeyExchangeMessage()] Error sending KEY_HANDSHAKE_SYNACK",i)})),this.setStep(Se.KEY_HANDSHAKE_ACK)):r.type===Se.KEY_HANDSHAKE_SYNACK?(this.checkStep([Se.KEY_HANDSHAKE_SYNACK,Se.KEY_HANDSHAKE_ACK,Se.KEY_HANDSHAKE_NONE]),W.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_SYNACK"),r.pubkey&&this.setOtherPublicKey(r.pubkey),this.communicationLayer.sendMessage({type:Se.KEY_HANDSHAKE_ACK}).catch((i=>{W.KeyExchange("[KeyExchange: onKeyExchangeMessage()] Error sending KEY_HANDSHAKE_ACK",i)})),this.keysExchanged=!0,this.setStep(Se.KEY_HANDSHAKE_ACK),this.emit(te.KEYS_EXCHANGED)):r.type===Se.KEY_HANDSHAKE_ACK&&(W.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_ACK set keysExchanged to true!"),this.checkStep([Se.KEY_HANDSHAKE_ACK,Se.KEY_HANDSHAKE_NONE]),this.keysExchanged=!0,this.setStep(Se.KEY_HANDSHAKE_ACK),this.emit(te.KEYS_EXCHANGED))}resetKeys(e){this.clean(),this.myECIES=new ls(e)}clean(){W.KeyExchange(`[KeyExchange: clean()] context=${this.context} reset handshake state`),this.setStep(Se.KEY_HANDSHAKE_NONE),this.emit(te.KEY_INFO,this.step),this.keysExchanged=!1}start({isOriginator:e,force:n}){const{relayPersistence:r,protocolVersion:i}=this.communicationLayer.remote.state,o=i>=2;r?W.KeyExchange("[KeyExchange: start()] Ignoring key exchange message because relay persistence is activated"):(W.KeyExchange(`[KeyExchange: start()] context=${this.context} protocolVersion=${i} isOriginator=${e} step=${this.step} force=${n} relayPersistence=${r} keysExchanged=${this.keysExchanged}`),e?!(this.keysExchanged||this.step!==Se.KEY_HANDSHAKE_NONE&&this.step!==Se.KEY_HANDSHAKE_SYNACK)||n?(W.KeyExchange(`[KeyExchange: start()] context=${this.context} -- start key exchange (force=${n}) -- step=${this.step}`,this.step),this.clean(),this.setStep(Se.KEY_HANDSHAKE_SYNACK),this.communicationLayer.sendMessage({type:Se.KEY_HANDSHAKE_SYN,pubkey:this.myPublicKey,v:2}).catch((c=>{W.KeyExchange("[KeyExchange: start()] Error sending KEY_HANDSHAKE_SYN",c)}))):W.KeyExchange(`[KeyExchange: start()] context=${this.context} -- key exchange already ${this.keysExchanged?"done":"in progress"} -- aborted.`,this.step):this.keysExchanged&&n!==!0?W.KeyExchange("[KeyExchange: start()] don't send KEY_HANDSHAKE_START -- exchange already done."):o?this.communicationLayer.sendMessage({type:Se.KEY_HANDSHAKE_SYNACK,pubkey:this.myPublicKey,v:2}).catch((c=>{W.KeyExchange("[KeyExchange: start()] Error sending KEY_HANDSHAKE_SYNACK",c)})):(this.communicationLayer.sendMessage({type:Se.KEY_HANDSHAKE_START}).catch((c=>{W.KeyExchange("[KeyExchange: start()] Error sending KEY_HANDSHAKE_START",c)})),this.clean()))}
2setStep(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 ls({privateKey:e,debug:this.debug}),this.keysExchanged=!0}setKeysExchanged(e){this.keysExchanged=e}areKeysExchanged(){return this.keysExchanged}getMyPublicKey(){return this.myPublicKey}getOtherPublicKey(){return this.otherPublicKey}setOtherPublicKey(e){W.KeyExchange("[KeyExchange: setOtherPubKey()]",e),this.otherPublicKey=e}encryptMessage(e){if(!this.otherPublicKey)throw new Error("encryptMessage: Keys not exchanged - missing otherPubKey");return this.myECIES.encrypt(e,this.otherPublicKey)}decryptMessage(e){if(!this.otherPublicKey)throw new Error("decryptMessage: Keys not exchanged - missing otherPubKey");return this.myECIES.decrypt(e)}getKeyInfo(){return{ecies:Object.assign(Object.assign({},this.myECIES.getKeyInfo()),{otherPubKey:this.otherPublicKey}),step:this.step,keysExchanged:this.areKeysExchanged()}}toString(){const e={keyInfo:this.getKeyInfo(),keysExchanged:this.keysExchanged,step:this.step};return JSON.stringify(e)}}(function(t){t.TERMINATE="terminate",t.ANSWER="answer",t.OFFER="offer",t.CANDIDATE="candidate",t.JSONRPC="jsonrpc",t.WALLET_INFO="wallet_info",t.WALLET_INIT="wallet_init",t.ORIGINATOR_INFO="originator_info",t.PAUSE="pause",t.OTP="otp",t.AUTHORIZED="authorized",t.PING="ping",t.READY="ready"})(xe||(xe={})),(function(t){t.REQUEST="sdk_connect_request_started",t.REQUEST_MOBILE="sdk_connect_request_started_mobile",t.RECONNECT="sdk_reconnect_request_started",t.CONNECTED="sdk_connection_established",t.CONNECTED_MOBILE="sdk_connection_established_mobile",t.AUTHORIZED="sdk_connection_authorized",t.REJECTED="sdk_connection_rejected",t.TERMINATED="sdk_connection_terminated",t.DISCONNECTED="sdk_disconnected",t.SDK_USE_EXTENSION="sdk_use_extension",t.SDK_RPC_REQUEST="sdk_rpc_request",t.SDK_RPC_REQUEST_RECEIVED="sdk_rpc_request_received",t.SDK_RPC_REQUEST_DONE="sdk_rpc_request_done",t.SDK_EXTENSION_UTILIZED="sdk_extension_utilized",t.SDK_USE_INAPP_BROWSER="sdk_use_inapp_browser"})(Oe||(Oe={}));const Li=(t,e,n)=>J(void 0,void 0,void 0,(function*(){var r,i,o,c,s,a;const{remote:l,state:u}=t,{channelId:d,isOriginator:h}=u;if(e==="error_terminated")return W.SocketService(`handleJoinChannelResults: Channel ${d} terminated`),void t.emit(te.TERMINATE);if(!n)return void W.SocketService(`handleJoinChannelResults: No result for channel ${d}`);const{persistence:f,walletKey:m,rejected:g}=n;if(W.SocketService(`handleJoinChannelResults: Channel ${d} persistence=${f} walletKey=${m} rejected=${g}`),g)return W.SocketService(`handleJoinChannelResults: Channel ${d} rejected`),yield t.remote.disconnect({terminate:!0}),t.remote.emit(te.REJECTED,{channelId:d}),void t.remote.emitServiceStatusEvent();if(m&&!(!((r=l.state.channelConfig)===null||r===void 0)&&r.otherKey)){t.getKeyExchange().setOtherPublicKey(m),(i=t.state.keyExchange)===null||i===void 0||i.setKeysExchanged(!0),l.state.ready=!0,l.state.authorized=!0,l.emit(te.AUTHORIZED);const{communicationLayer:w,storageManager:p}=l.state,C=Object.assign(Object.assign({},l.state.channelConfig),{channelId:(o=l.state.channelId)!==null&&o!==void 0?o:"",validUntil:Date.now()+ar,localKey:w?.getKeyInfo().ecies.private,otherKey:m});t.sendMessage({type:Se.KEY_HANDSHAKE_ACK}).catch((_=>{})),(c=t.state.socket)===null||c===void 0||c.emit(xe.PING,{id:d,clientType:h?"dapp":"wallet",context:"on_channel_reconnect",message:""}),yield p?.persistChannelConfig(C),l.emitServiceStatusEvent(),l.setConnectionStatus(Ue.LINKED)}f&&(t.emit(te.CHANNEL_PERSISTENCE),(s=t.state.keyExchange)===null||s===void 0||s.setKeysExchanged(!0),l.state.ready=!0,l.state.authorized=!0,l.emit(te.AUTHORIZED),Qt(Object.assign(Object.assign({id:d??"",event:h?Oe.CONNECTED:Oe.CONNECTED_MOBILE},t.remote.state.originatorInfo),{sdkVersion:t.remote.state.sdkVersion,commLayer:t.state.communicationLayerPreference,commLayerVersion:Cn.version,walletVersion:(a=t.remote.state.walletInfo)===null||a===void 0?void 0:a.version}),u.communicationServerUrl).catch((w=>{})))})),rr=t=>new Promise((e=>{setTimeout(e,t)})),al=(t,e,...n)=>J(void 0,[t,e,...n],void 0,(function*(r,i,o=200){let c;const s=Date.now();let a=!1;for(;!a;){if(a=Date.now()-s>3e5,c=i[r],c.elapsedTime!==void 0)return c;yield rr(o)}throw new Error(`RPC ${r}
2 timed out`)})),Gs=t=>J(void 0,void 0,void 0,(function*(){const{state:e}=t,{socket:n,channelId:r,context:i,isOriginator:o,isReconnecting:c}=e;if(c)return W.SocketService("[SocketService: reconnectSocket()] Reconnection already in progress, skipping",t),!1;if(!n)return W.SocketService("[SocketService: reconnectSocket()] socket is not defined",t),!1;if(!r)return!1;const{connected:s}=n;e.isReconnecting=!0,e.reconnectionAttempts=0,W.SocketService(`[SocketService: reconnectSocket()] connected=${s} trying to reconnect after socketio disconnection`,t);try{for(;3>e.reconnectionAttempts;){if(W.SocketService(`[SocketService: reconnectSocket()] Attempt ${e.reconnectionAttempts+1} of 3`,t),yield rr(200),n.connected)return W.SocketService("Socket already connected --- ping to retrieve messages"),n.emit(xe.PING,{id:r,clientType:o?"dapp":"wallet",context:"on_channel_config",message:""}),!0;e.resumed=!0,n.connect(),t.emit(te.SOCKET_RECONNECT);try{if(yield new Promise(((a,l)=>{n.emit(te.JOIN_CHANNEL,{channelId:r,context:`${i}connect_again`,clientType:o?"dapp":"wallet"},((u,d)=>J(void 0,void 0,void 0,(function*(){try{yield Li(t,u,d),a()}catch(h){l(h)}}))))})),yield rr(100),n.connected)return W.SocketService(`Reconnection successful on attempt ${e.reconnectionAttempts+1}`),!0}catch(a){W.SocketService(`Error during reconnection attempt ${e.reconnectionAttempts+1}:`,a)}e.reconnectionAttempts+=1,3>e.reconnectionAttempts&&(yield rr(200))}return W.SocketService("Failed to reconnect after 3 attempts"),!1}finally{e.isReconnecting=!1,e.reconnectionAttempts=0}}));function dh(t,e){return J(this,void 0,void 0,(function*(){var n;const r=(n=t.state.keyExchange)===null||n===void 0?void 0:n.encryptMessage(JSON.stringify(e)),i={id:t.state.channelId,context:t.state.context,clientType:t.state.isOriginator?"dapp":"wallet",message:r,plaintext:t.state.hasPlaintext?JSON.stringify(e):void 0};return W.SocketService(`[SocketService: encryptAndSendMessage()] context=${t.state.context}`,i),e.type===xe.TERMINATE&&(t.state.manualDisconnect=!0),new Promise(((o,c)=>{var s;(s=t.state.socket)===null||s===void 0||s.emit(te.MESSAGE,i,((a,l)=>{var u;a&&(W.SocketService(`[SocketService: encryptAndSendMessage()] error=${a}`),c(a)),W.SocketService("[encryptAndSendMessage] response",l),o((u=l?.success)!==null&&u!==void 0&&u)}))}))}))}var Qn;(function(t){t.RPC_CHECK="rpcCheck",t.SKIPPED_RPC="skippedRpc"})(Qn||(Qn={}));const hh=["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())),nm=[{event:te.CLIENTS_CONNECTED,handler:function(t,e){return n=>J(this,void 0,void 0,(function*(){var r,i,o,c,s,a,l,u,d,h,f;const m=(i=(r=t.remote.state.channelConfig)===null||r===void 0?void 0:r.relayPersistence)!==null&&i!==void 0&&i;if(W.SocketService(`[SocketService: handleClientsConnected()] context=${t.state.context} on 'clients_connected-${e}' relayPersistence=${m} resumed=${t.state.resumed}  clientsPaused=${t.state.clientsPaused} keysExchanged=${(o=t.state.keyExchange)===null||o===void 0?void 0:o.areKeysExchanged()} isOriginator=${t.state.isOriginator}`),t.emit(te.CLIENTS_CONNECTED,{isOriginator:t.state.isOriginator,keysExchanged:(c=t.state.keyExchange)===null||c===void 0?void 0:c.areKeysExchanged(),context:t.state.context}),t.state.resumed)t.state.isOriginator||(W.SocketService(`[SocketService: handleClientsConnected()] context=${t.state.context} 'clients_connected' / keysExchanged=${(s=t.state.keyExchange)===null||s===void 0?void 0:s.areKeysExchanged()} -- backward compatibility`),(a=t.state.keyExchange)===null||a===void 0||a.start({isOriginator:(l=t.state.isOriginator)!==null&&l!==void 0&&l})),t.state.resumed=!1;else if(t.state.clientsPaused)W.SocketService("[SocketService: handleClientsConnected()] 'clients_connected' skip sending originatorInfo on pause");else if(!t.state.isOriginator){const g=!m;W.SocketService(`[SocketService: handleClientsConnected()] context=${t.state.context} on 'clients_connected' / keysExchanged=${(u=t.state.keyExchange)===null||u===void 0?void 0:u.areKeysExchanged()} -- force=${g} -- backward compatibility`),W.SocketService(`[SocketService: handleClientsConnected()] context=${t.state.context} on 'clients_connected' / keysExchanged=${(d=t.state.keyExchange)===null||d===void 0?void 0:d.areKeysExchanged()} -- force=${g} -- backward compatibility`),(h=t.state.keyExchange)===null||h===void 0||h.start({isOriginator:(f=t.state.isOriginator)!==null&&f!==void 0&&f,force:g})}t.state.clientsConnected=!0,t.state.clientsPaused=!1}))}},{event:te.CHANNEL_CREATED,handler:function(t,e){return n=>{W.SocketService(`[SocketService: handleChannelCreated()] context=${t.state.context} on 'channel_created-${e}'`,n),t.emit(te.CHANNEL_CREATED,n)}}},{event:te.CLIENTS_DISCONNECTED,handler:function(t,e){return()=>{var n;t.state.clientsConnected=!1,W.SocketService(`[SocketService: handlesClientsDisconnected()] context=${t.state.context} on 'clients_disconnected-${e}'`),t.remote.state.relayPersistence?W.SocketService(`[SocketService: handlesClientsDisconnected()] context=${t.state.context} on 'clients_disconnected-${e}' - relayPersistence enabled, skipping key exchange cleanup.`):(t.state.isOriginator&&!t.state.clientsPaused&&((n=t.state.keyExchange)===null||n===void 0||n.clean()),t.emit(te.CLIENTS_DISCONNECTED,e))}}},{event:te.CONFIG,handler:function(t,e){return n=>J(this,void 0,void 0,(function*(){var r,i,o;W.SocketService(`[SocketService: handleChannelConfig()] update relayPersistence on 'config-${e}'`,n);const{persistence:c,walletKey:s}=n;t.state.isOriginator&&t.remote.state.channelConfig?(n.walletKey&&!t.remote.state.channelConfig.otherKey&&(W.SocketService(`Setting wallet key ${s}`),t.remote.state.channelConfig.otherKey=s,t.getKeyExchange().setOtherPublicKey(n.walletKey),(r=t.state.keyExchange)===null||r===void 0||r.setKeysExchanged(!0),yield t.remote.sendMessage({type:Se.KEY_HANDSHAKE_ACK}),yield t.remote.sendMessage({type:xe.PING}),yield(i=t.remote.state.storageManager)===null||i===void 0?void 0:i.persist
2ChannelConfig(t.remote.state.channelConfig)),c!==!0||t.remote.state.channelConfig.relayPersistence||(W.SocketService(`Setting relay persistence ${c}`),t.remote.state.channelConfig.relayPersistence=c,t.remote.state.relayPersistence=!0,t.remote.emit(te.CHANNEL_PERSISTENCE),t.remote.state.authorized=!0,t.remote.state.ready=!0,t.remote.emit(te.AUTHORIZED),yield(o=t.remote.state.storageManager)===null||o===void 0?void 0:o.persistChannelConfig(t.remote.state.channelConfig))):t.state.isOriginator||n.persistence&&(t.remote.state.relayPersistence=!0,t.remote.emit(te.CHANNEL_PERSISTENCE))}))}},{event:te.MESSAGE,handler:function(t,e){return n=>{var r,i,o,c,s,a,l,u,d,h,f,m,g,w,p,C,_,O;const{ackId:L,message:U,error:q}=n,F=(r=t.remote.state.relayPersistence)!==null&&r!==void 0&&r;if(W.SocketService(`[SocketService handleMessage()]  relayPersistence=${F}  context=${t.state.context} on 'message' ${e} keysExchanged=${(i=t.state.keyExchange)===null||i===void 0?void 0:i.areKeysExchanged()}`,n),q)throw W.SocketService(`
3      [SocketService handleMessage()] context=${t.state.context}::on 'message' error=${q}`),new Error(q);const B=typeof U=="string";if(!B&&U?.type===Se.KEY_HANDSHAKE_START)return F?void 0:(W.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' received HANDSHAKE_START isOriginator=${t.state.isOriginator}`,U),void((o=t.state.keyExchange)===null||o===void 0||o.start({isOriginator:(c=t.state.isOriginator)!==null&&c!==void 0&&c,force:!0})));if(!B&&(!((s=U?.type)===null||s===void 0)&&s.startsWith("key_handshake")))return F?void 0:(W.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' emit KEY_EXCHANGE`,U),void t.emit(io.KEY_EXCHANGE,{message:U,context:t.state.context}));if(B&&!(!((a=t.state.keyExchange)===null||a===void 0)&&a.areKeysExchanged())){let $=!1;try{W.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' trying to decrypt message`),(l=t.state.keyExchange)===null||l===void 0||l.decryptMessage(U),$=!0}catch(P){W.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' error`,P)}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((P=>{})),void W.SocketService(`Message ignored because invalid key exchange status. step=${(f=t.state.keyExchange)===null||f===void 0?void 0:f.getKeyInfo().step}`,(m=t.state.keyExchange)===null||m===void 0?void 0:m.getKeyInfo(),U);W.SocketService("Invalid key exchange status detected --- updating it."),(u=t.state.keyExchange)===null||u===void 0||u.setKeysExchanged(!0)}else if(!B&&U?.type)return void t.emit(te.MESSAGE,U);if(!B)return void t.emit(te.MESSAGE,U);const N=(g=t.state.keyExchange)===null||g===void 0?void 0:g.decryptMessage(U),H=JSON.parse(N??"{}");if(L&&L?.length>0&&(W.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' ackid=${L} channelId=${e}`),(w=t.state.socket)===null||w===void 0||w.emit(te.MESSAGE_ACK,{ackId:L,channelId:e,clientType:t.state.isOriginator?"dapp":"wallet"})),t.state.clientsPaused=H?.type===xe.PAUSE,t.state.isOriginator&&H.data){const $=H.data,P=t.state.rpcMethodTracker[$.id];if(P){const M=Date.now()-P.timestamp;W.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' received answer for id=${$.id} method=${P.method} responseTime=${M}`,H),t.remote.state.analytics&&hh.includes(P.method.toLowerCase())&&Qt(Object.assign(Object.assign({id:(p=t.remote.state.channelId)!==null&&p!==void 0?p:"",event:Oe.SDK_RPC_REQUEST_DONE,sdkVersion:t.remote.state.sdkVersion,commLayerVersion:Cn.version},t.remote.state.originatorInfo),{walletVersion:(C=t.remote.state.walletInfo)===null||C===void 0?void 0:C.version,params:{method:P.method,from:"mobile"}}),t.remote.state.communicationServerUrl).catch((I=>{})),Zr(P.method)&&Re.analytics.track($.error?$.error.code===4001?"sdk_action_rejected":"sdk_action_failed":"sdk_action_succeeded",{action:P.method});const S=Object.assign(Object.assign({},P),{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:M});t.state.rpcMethodTracker[$.id]=S,t.emit(te.RPC_UPDATE,S)}}t.emit(te.MESSAGE,{message:H})}}},{event:te.REJECTED,handler:function(t,e){return n=>J(this,void 0,void 0,(function*(){var r;t.state.isOriginator&&!t.remote.state.ready?(W.SocketService(`[SocketService: handleChannelRejected()] context=${t.state.context} channelId=${e} isOriginator=${t.state.isOriginator} ready=${t.remote.state.ready}`,t.remote.state.originatorInfo),Qt(Object.assign(Object.assign({id:e,event:Oe.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=>{})),Re.analytics.track("sdk_connection_rejected",{transport_type:"websocket"}),yield t.remote.disconnect({terminate:!0}
3),t.remote.emit(te.REJECTED,{channelId:e}),t.remote.setConnectionStatus(Ue.DISCONNECTED)):W.SocketService(`[SocketService: handleChannelRejected()] SKIP -- channelId=${e} isOriginator=${t.state.isOriginator} ready=${t.remote.state.ready}`)}))}},{event:"clients_waiting_to_join",handler:function(t,e){return n=>{W.SocketService(`[SocketService: handleClientsWaitingToJoin()] context=${t.state.context} on 'clients_waiting_to_join-${e}'`,n),t.emit(te.CLIENTS_WAITING,n)}}}],rm=[{event:te.KEY_INFO,handler:function(t){return e=>{W.SocketService("[SocketService: handleKeyInfo()] on 'KEY_INFO'",e),t.emit(te.KEY_INFO,e)}}},{event:te.KEYS_EXCHANGED,handler:function(t){return()=>{var e,n,r;W.SocketService(`[SocketService: handleKeysExchanged()] on 'keys_exchanged' keyschanged=${(e=t.state.keyExchange)===null||e===void 0?void 0:e.areKeysExchanged()}`);const{channelConfig:i}=t.remote.state;if(i){const c=t.getKeyExchange().getKeyInfo().ecies;i.localKey=c.private,i.otherKey=c.otherPubKey,t.remote.state.channelConfig=i,(n=t.remote.state.storageManager)===null||n===void 0||n.persistChannelConfig(i).catch((s=>{}))}t.emit(te.KEYS_EXCHANGED,{keysExchanged:(r=t.state.keyExchange)===null||r===void 0?void 0:r.areKeysExchanged(),isOriginator:t.state.isOriginator});const o={keyInfo:t.getKeyInfo()};t.emit(te.SERVICE_STATUS,o)}}}];function cl(t,e){W.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} setting socket listeners for channel ${e}...`);const{socket:n}=t.state,{keyExchange:r}=t.state;n&&t.state.isOriginator&&(t.state.debug&&(n?.io.on("error",(i=>{W.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} socket event=error`,i)})),n?.io.on("reconnect",(i=>{W.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} socket event=reconnect`,i),Gs(t).catch((o=>{}))})),n?.io.on("reconnect_error",(i=>{W.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} socket event=reconnect_error`,i)})),n?.io.on("reconnect_failed",(()=>{W.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} socket event=reconnect_failed`)}))),n?.on("disconnect",(i=>(W.SocketService(`[SocketService: setupChannelListener()] on 'disconnect' -- MetaMaskSDK socket disconnected '${i}' begin recovery...`),(function(o){return c=>{W.SocketService(`[SocketService: handleDisconnect()] on 'disconnect' manualDisconnect=${o.state.manualDisconnect}`,c),o.state.manualDisconnect||(o.emit(te.SOCKET_DISCONNECTED),Gs(o).catch((s=>{})))}})(t)(i))))),nm.forEach((({event:i,handler:o})=>{n?.on(`${i}-${e}`,o(t,e))})),rm.forEach((({event:i,handler:o})=>{r?.on(i,o(t))})),t.state.setupChannelListeners=!0}class im extends Eo.EventEmitter2{constructor(e){super(),this.state={clientsConnected:!1,clientsPaused:!1,manualDisconnect:!1,lastRpcId:void 0,rpcMethodTracker:{},hasPlaintext:!1,communicationServerUrl:"",focusListenerAdded:!1,removeFocusListener:void 0,isReconnecting:!1,reconnectionAttempts:0},this.options=e;const{reconnect:n,communicationLayerPreference:r,communicationServerUrl:i,context:o,remote:c,logging:s}=e;this.state.resumed=n,this.state.context=o,this.state.isOriginator=c.state.isOriginator,this.state.communicationLayerPreference=r,this.state.debug=s?.serviceLayer===!0,this.remote=c,s?.serviceLayer===!0&&Je.enable("SocketService:Layer"),this.state.communicationServerUrl=i,this.state.hasPlaintext=this.state.communicationServerUrl!==sr&&s?.plaintext===!0,W.SocketService(`[SocketService: constructor()] Socket IO url: ${this.state.communicationServerUrl}`),this.initSocket()}initSocket(){var e;const{otherPublicKey:n,ecies:r,logging:i}=this.options,o={autoConnect:!1,transports:X0,withCredentials:!0},c=this.state.communicationServerUrl;W.SocketService(`[SocketService: initSocket()] Socket IO url: ${c}`),this.state.socket=Ri(c,o),(function(a){if(typeof window<"u"&&typeof document<"u"&&(W.SocketService(`[SocketService: setupSocketFocusListener()] hasFocus=${document.hasFocus()}`,a),!a.state.focusListenerAdded)){const l=()=>{W.SocketService("Document has focus --- reconnecting socket"),Gs(a).catch((u=>{}))};window.addEventListener("focus",l),a.state.focusListenerAdded=!0,a.state.removeFocusListener=()=>{window.removeEventListener("focus",l),a.state.focusListenerAdded=!1}}})(this);const s={communicationLayer:this,otherPublicKey:n,sendPublicKey:!1,context:(e=this.state.context)!==null&&e!==void 0?e:"",ecies:r,logging:i};this.state.keyExchange=new tm(s)}resetKeys(){return W.SocketService("[SocketService: resetKeys()] Resetting keys."),void((e=this.state.keyExchange)===null||e===void 0||e.resetKeys());var e}createChannel(){return J(this,void 0,void 0,(function*(){return(function(e){return J(this,void 0,void 0,(function*(){var n,r,i;if(W.SocketService(`[SocketService: createChannel()] context=${e.state.context}`),e.state.socket||e.initSocket(),(n=e.state.socket)===null||n===void 0?void 0:n.connected)throw new Error("socket already connected");(r=e.state.socket)===null||r===void 0||r.connect(),e.state.manualDisconnect=!1,e.state.isOriginator=!0;const o=gn();e.state.channelId=o,cl(e,o),yield new Promise(((s,a)=>{var l;(l=e.state.socket)===null||l===void 0||l.emit(te.JOIN_CHANNEL,{channelId:o,context:`${e.state.context}createChannel`,clientType:"dapp"},((u,d)=>J(this,void 0,void 0,(function*(){try{yield Li(e,u,d),s()}catch(h){a(h)}}))))}
3));const c=(i=e.state.keyExchange)===null||i===void 0?void 0:i.getKeyInfo();return{channelId:o,pubKey:c?.ecies.public||"",privKey:c?.ecies.private||""}}))})(this)}))}connectToChannel({channelId:e,withKeyExchange:n=!1,authorized:r}){return(function(i){return J(this,arguments,void 0,(function*({options:o,instance:c}){const{channelId:s,authorized:a,withKeyExchange:l}=o,{state:u,remote:d}=c,{isOriginator:h=!1,socket:f,keyExchange:m}=u,{channelConfig:g}=d.state;if(f?.connected)throw new Error("socket already connected");if(h&&g?.relayPersistence){const{localKey:w,otherKey:p}=g;w&&p&&m?.setRelayPersistence({localKey:w,otherKey:p})}return Object.assign(u,{manualDisconnect:!1,withKeyExchange:l,isOriginator:h,channelId:s}),f?.connect(),cl(c,s),!h&&a&&(m?.setKeysExchanged(!0),Object.assign(d.state,{ready:!0,authorized:!0})),new Promise((w=>{var p;const C=(p=m?.getKeyInfo())===null||p===void 0?void 0:p.ecies.public;f?.emit(te.JOIN_CHANNEL,{channelId:s,context:`${u.context}_connectToChannel`,clientType:h?"dapp":"wallet",publicKey:a&&!h?C:void 0},((_,O)=>J(this,void 0,void 0,(function*(){yield Li(c,_,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 J(this,void 0,void 0,(function*(){return(function(n,r){return J(this,void 0,void 0,(function*(){var i,o,c;if(!n.state.channelId)throw W.SocketService("handleSendMessage: no channelId - Create a channel first"),new Error("Create a channel first");
3if(W.SocketService(`[SocketService: handleSendMessage()] context=${n.state.context} areKeysExchanged=${(i=n.state.keyExchange)===null||i===void 0?void 0:i.areKeysExchanged()}`,r),(o=r?.type)===null||o===void 0?void 0:o.startsWith("key_handshake"))return(function(a,l){var u;W.SocketService(`[SocketService: handleKeyHandshake()] context=${a.state.context}`,l),(u=a.state.socket)===null||u===void 0||u.emit(te.MESSAGE,{id:a.state.channelId,context:a.state.context,clientType:a.state.isOriginator?"dapp":"wallet",message:l})})(n,r),!0;(function(a,l){var u;if(!(!((u=a.state.keyExchange)===null||u===void 0)&&u.areKeysExchanged())&&!a.remote.state.relayPersistence)throw W.SocketService(`[SocketService: validateKeyExchange()] context=${a.state.context} ERROR keys not exchanged`,l),new Error("Keys not exchanged BBB")})(n,r),(function(a,l){var u;const d=(u=l?.method)!==null&&u!==void 0?u:"",h=l?.id;a.state.isOriginator&&h&&(a.state.rpcMethodTracker[h]={id:h,timestamp:Date.now(),method:d},a.emit(te.RPC_UPDATE,a.state.rpcMethodTracker[h]))})(n,r);const s=yield dh(n,r);return n.remote.state.analytics&&n.remote.state.isOriginator&&r.method&&hh.includes(r.method.toLowerCase())&&Qt({id:(c=n.remote.state.channelId)!==null&&c!==void 0?c:"",event:Oe.SDK_RPC_REQUEST,params:{method:r.method,from:"mobile"}},n.remote.state.communicationServerUrl).catch((a=>{})),n.remote.state.isOriginator&&r.method&&Zr(r.method)&&Re.analytics.track("sdk_action_requested",{action:r.method}),(function(a,l){return J(this,void 0,void 0,(function*(){var u;const d=l?.id,h=(u=l?.method)!==null&&u!==void 0?u:"";if(a.state.isOriginator&&d)try{const f=al(d,a.state.rpcMethodTracker,200).then((w=>({type:Qn.RPC_CHECK,result:w}))),m=J(this,void 0,void 0,(function*(){const w=yield(C=>J(void 0,[C],void 0,(function*({rpcId:_,instance:O}){for(;O.state.lastRpcId===_||O.state.lastRpcId===void 0;)yield rr(200);return O.state.lastRpcId})))({instance:a,rpcId:d}),p=yield al(w,a.state.rpcMethodTracker,200);return{type:Qn.SKIPPED_RPC,result:p}})),g=yield Promise.race([f,m]);if(g.type===Qn.RPC_CHECK){const w=g.result;W.SocketService(`[SocketService:handleRpcReplies()] id=${l.id} ${h} ( ${w.elapsedTime} ms)`,w.result)}else{if(g.type!==Qn.SKIPPED_RPC)throw new Error(`Error handling RPC replies for ${d}`);{const w=Object.assign(Object.assign({},a.state.rpcMethodTracker[d]),{error:new Error("SDK_CONNECTION_ISSUE")});a.emit(te.RPC_UPDATE,w);const p={data:Object.assign(Object.assign({},w),{jsonrpc:"2.0"}),name:"metamask-provider"};a.emit(te.MESSAGE,{message:p})}}}catch(f){throw f}}))})(n,r).catch((a=>{})),s}))})(this,e)}))}ping(){return(function(e){return J(this,void 0,void 0,(function*(){var n,r;W.SocketService(`[SocketService: ping()] context=${e.state.context} originator=${e.state.isOriginator} keysExchanged=${(n=e.state.keyExchange)===null||n===void 0?void 0:n.areKeysExchanged()}`),(r=e.state.socket)===null||r===void 0||r.emit(xe.PING,{id:e.state.channelId,context:"ping",clientType:e.remote.state.isOriginator?"dapp":"wallet",message:""})}))})(this)}pause(){return(function(e){return J(this,void 0,void 0,(function*(){var n,r;W.SocketService(`[SocketService: pause()] context=${e.state.context}`),e.state.manualDisconnect=!0,!((n=e.state.keyExchange)===null||n===void 0)&&n.areKeysExchanged()&&(yield e.sendMessage({type:xe.PAUSE})),(r=e.state.socket)===null||r===void 0||r.disconnect()}))})(this)}isConnected(){var e;return(e=this.state.socket)===null||e===void 0?void 0:e.connected}resume(){return(function(e){return J(this,void 0,void 0,(function*(){const{state:n,remote:r}=e,{socket:i,channelId:o,context:c,keyExchange:s,isOriginator:a}=n,{isOriginator:l}=r.state;if(W.SocketService(`[SocketService: resume()] channelId=${o} context=${c} connected=${i?.connected} manualDisconnect=${n.manualDisconnect} resumed=${n.resumed} keysExchanged=${s?.areKeysExchanged()}`),!o)throw W.SocketService("[SocketService: resume()] channelId is not defined"),new Error("ChannelId is not defined");i?.connected?(W.SocketService("[SocketService: resume()] already connected."),i.emit(xe.PING,{id:o,clientType:l?"dapp":"wallet",context:"on_channel_c
3onfig",message:""}),r.hasRelayPersistence()||s?.areKeysExchanged()||(a?yield e.sendMessage({type:xe.READY}):s?.start({isOriginator:!1}))):(i?.connect(),W.SocketService(`[SocketService: resume()] after connecting socket --> connected=${i?.connected}`),i?.emit(te.JOIN_CHANNEL,{channelId:o,context:`${c}_resume`,clientType:l?"dapp":"wallet"},((u,d)=>J(this,void 0,void 0,(function*(){try{yield Li(e,u,d)}catch{}}))))),n.manualDisconnect=!1,n.resumed=!0}))})(this)}getRPCMethodTracker(){return this.state.rpcMethodTracker}disconnect(e){return(function(n,r){var i,o,c,s,a;W.SocketService(`[SocketService: disconnect()] context=${n.state.context}`,r),r?.terminate&&((o=(i=n.state).removeFocusListener)===null||o===void 0||o.call(i),n.state.channelId=r.channelId,(c=n.state.socket)===null||c===void 0||c.removeAllListeners(),(s=n.state.keyExchange)===null||s===void 0||s.clean(),n.remote.state.ready=!1,n.state.socket=void 0,n.state.rpcMethodTracker={}),n.state.manualDisconnect=!0,(a=n.state.socket)===null||a===void 0||a.disconnect()})(this,e)}}var Dn,Ve,ll;function om(t){return()=>J(this,void 0,void 0,(function*(){var e,n,r;const{state:i}=t;if(i.authorized)return;yield J(this,void 0,void 0,(function*(){for(;!i.walletInfo;)yield rr(500)}));const o="7.3".localeCompare(((e=i.walletInfo)===null||e===void 0?void 0:e.version)||"");if(W.RemoteCommunication(`[RemoteCommunication: handleAuthorizedEvent()] HACK 'authorized' version=${(n=i.walletInfo)===null||n===void 0?void 0:n.version} compareValue=${o}`),o!==1)return;const c=i.platformType===Ve.MobileWeb||i.platformType===Ve.ReactNative||i.platformType===Ve.MetaMaskMobileWebview;W.RemoteCommunication(`[RemoteCommunication: handleAuthorizedEvent()] HACK 'authorized' platform=${i.platformType} secure=${c} channel=${i.channelId} walletVersion=${(r=i.walletInfo)===null||r===void 0?void 0:r.version}`),c&&(i.authorized=!0,t.emit(te.AUTHORIZED))}))}function sm(t){return e=>{const{state:n}=t;W.RemoteCommunication(`[RemoteCommunication: handleChannelCreatedEvent()] context=${n.context} on 'channel_created' channelId=${e}`),t.emit(te.CHANNEL_CREATED,e)}}function am(t,e){return()=>{var n,r,i,o;const{state:c}=t;W.RemoteCommunication(`[RemoteCommunication: handleClientsConnectedEvent()] on 'clients_connected' channel=${c.channelId} keysExchanged=${(r=(n=c.communicationLayer)===null||n===void 0?void 0:n.getKeyInfo())===null||r===void 0?void 0:r.keysExchanged}`),c.analytics&&Qt(Object.assign(Object.assign({id:(i=c.channelId)!==null&&i!==void 0?i:"",event:c.reconnection?Oe.RECONNECT:c.isOriginator?Oe.REQUEST:Oe.REQUEST_MOBILE},c.originatorInfo),{commLayer:e,sdkVersion:c.sdkVersion,walletVersion:(o=c.walletInfo)===null||o===void 0?void 0:o.version,commLayerVersion:Cn.version}),c.communicationServerUrl).catch((s=>{})),c.isOriginator&&!c.reconnection&&Re.analytics.track("sdk_connection_established",{transport_type:"websocket"}),c.clientsConnected=!0,c.originatorInfoSent=!1,t.emit(te.CLIENTS_CONNECTED)}}function cm(t){return e=>{const{state:n}=t;W.RemoteCommunication(`[RemoteCommunication: handleClientsDisconnectedEvent()] context=${n.context} on 'clients_disconnected' channelId=${e}`),n.relayPersistence||(n.clientsConnected=!1,n.ready=!1,n.authorized=!1),t.emit(te.CLIENTS_DISCONNECTED,n.channelId),t.setConnectionStatus(Ue.DISCONNECTED)}}function lm(t){return e=>{var n;const{state:r}=t;if(W.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] context=${r.context} on 'clients_waiting' numberUsers=${e} ready=${r.ready} autoStarted=${r.originatorConnectStarted}`),t.setConnectionStatus(Ue.WAITING),t.emit(te.CLIENTS_WAITING,e),r.originatorConnectStarted){W.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] on 'clients_waiting' watch autoStarted=${r.originatorConnectStarted} timeout`,r.autoConnectOptions);const i=((n=r.autoConnectOptions)===null||n===void 0?void 0:n.timeout)||3e3,o=setTimeout((()=>{W.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] setTimeout(${i}) terminate channelConfig`,r.autoConnectOptions),r.originatorConnectStarted=!1,r.ready||t.setConnectionStatus(Ue.TIMEOUT),clearTimeout(o)}),i)}}}function um(t,e){return n=>{var r,i,o,c,s,a,l,u;const{state:d}=t;if(W.RemoteCommunication(`[RemoteCommunication: handleKeysExchangedEvent()] context=${d.context} on commLayer.'keys_exchanged' channel=${d.channelId}`,n),(i=(r=d.communicationLayer)===null||r===void 0?void 0:r.getKeyInfo())===null||i===void 0?void 0:i.keysExchanged){const h=Object.assign(Object.assign({},d.channelConfig),{channelId:(o=d.channelId)!==null&&o!==void 0?o:"",validUntil:((c=d.channelConfig)===null||c===void 0?void 0:c.validUntil)||ar,localKey:d.communicationLayer.getKeyInfo().ecies.private,otherKey:d.communicationLayer.getKeyInfo().ecies.otherPubKey});
3(s=d.storageManager)===null||s===void 0||s.persistChannelConfig(h).catch((f=>{})),t.setConnectionStatus(Ue.LINKED)}(function(h,f){var m,g,w,p,C,_,O,L;const{state:U}=h;W.RemoteCommunication(`[RemoteCommunication: setLastActiveDate()] channel=${U.channelId}`,f);const q=Object.assign(Object.assign({},U.channelConfig),{channelId:(m=U.channelId)!==null&&m!==void 0?m:"",validUntil:(w=(g=U.channelConfig)===null||g===void 0?void 0:g.validUntil)!==null&&w!==void 0?w:0,relayPersistence:U.relayPersistence,localKey:(C=(p=U.communicationLayer)===null||p===void 0?void 0:p.state.keyExchange)===null||C===void 0?void 0:C.getKeyInfo().ecies.private,otherKey:(O=(_=U.communicationLayer)===null||_===void 0?void 0:_.state.keyExchange)===null||O===void 0?void 0:O.getKeyInfo().ecies.otherPubKey,lastActive:f.getTime()});(L=U.storageManager)===null||L===void 0||L.persistChannelConfig(q)})(t,new Date),d.analytics&&d.channelId&&Qt(Object.assign(Object.assign({id:d.channelId,event:n.isOriginator?Oe.CONNECTED:Oe.CONNECTED_MOBILE},d.originatorInfo),{sdkVersion:d.sdkVersion,commLayer:e,commLayerVersion:Cn.version,walletVersion:(a=d.walletInfo)===null||a===void 0?void 0:a.version}),d.communicationServerUrl).catch((h=>{})),d.isOriginator=n.isOriginator,n.isOriginator||((l=d.communicationLayer)===null||l===void 0||l.sendMessage({type:xe.READY}),d.ready=!0,d.paused=!1),n.isOriginator&&!d.originatorInfoSent&&((u=d.communicationLayer)===null||u===void 0||u.sendMessage({type:xe.ORIGINATOR_INFO,originatorInfo:d.originatorInfo,originator:d.originatorInfo}),d.originatorInfoSent=!0)}}function dm(t){return e=>{let n=e;e.message&&(n=n.message),(function(r,i){const{state:o}=i;if(W.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] context=${o.context} on 'message' typeof=${typeof r}`,r),i.state.ready=!0,o.isOriginator||r.type!==xe.ORIGINATOR_INFO)if(o.isOriginator&&r.type===xe.WALLET_INFO)(function(c,s){const{state:a}=c;a.walletInfo=s.walletInfo,a.paused=!1})(i,r);else{if(o.isOriginator&&r.type===xe.WALLET_INIT)(function(c,s){return J(this,void 0,void 0,(function*(){var a,l,u;const{state:d}=c;if(d.isOriginator){const h=s.data||{};if(typeof h=="object"&&"accounts"in h&&"chainId"in h&&"walletKey"in h)try{const{channelConfig:f}=c.state;if(W.RemoteCommunication("WALLET_INIT: channelConfig",JSON.stringify(f,null,2)),f){const m=h.accounts,g=h.chainId,w=h.walletKey;let p,C=!1;"deeplinkProtocol"in h&&(C=!!h.deeplinkProtocol,c.state.deeplinkProtocolAvailable=C),"walletVersion"in h&&(p=h.walletVersion),yield(a=c.state.storageManager)===null||a===void 0?void 0:a.persistChannelConfig(Object.assign(Object.assign({},f),{otherKey:w,walletVersion:p,deeplinkProtocolAvailable:C,relayPersistence:!0})),yield(l=c.state.storageManager)===null||l===void 0?void 0:l.persistAccounts(m),yield(u=c.state.storageManager)===null||u===void 0?void 0:u.persistChainId(g)}c.emit(te.WALLET_INIT,{accounts:h.accounts,chainId:h.chainId})}catch{}}}))})(i,r).catch((c=>{W.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] error=${c}`)}));else if(r.type===xe.TERMINATE)(function(c){return J(this,void 0,void 0,(function*(){const{state:s}=c;s.isOriginator&&(yield fh({options:{terminate:!0,sendMessage:!1},instance:c}),c.emit(te.TERMINATE))}))})(i).catch((c=>{W.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] error=${c}`)}));else if(r.type===xe.PAUSE)(function(c){const{state:s}=c;s.paused=!0,c.setConnectionStatus(Ue.PAUSED)})(i);else if(r.type===xe.READY&&o.isOriginator)(function(c){const{state:s}=c;c.setConnectionStatus(Ue.LINKED);const a=s.paused;s.paused=!1,c.emit(te.CLIENTS_READY,{isOriginator:s.isOriginator,walletInfo:s.walletInfo}),a&&(s.authorized=!0,c.emit(te.AUTHORIZED))})(i);else{if(r.type===xe.OTP&&o.isOriginator)return void(function(c,s){var a;const{state:l}=c;c.emit(te.OTP,s.otpAnswer),"6.6".localeCompare(((a=l.walletInfo)===null||a===void 0?void 0:a.version)||"")===1&&c.emit(te.SDK_RPC_CALL,{method:Fe.ETH_REQUESTACCOUNTS,params:[]})})(i,r);r.type===xe.AUTHORIZED&&o.isOriginator&&(function(c){const{state:s}=c;s.authorized=!0,c.emit(te.AUTHORIZED)})(i)}i.emit(te.MESSAGE,r)}else(function(c,s){var a;const{state:l}=c;(a=l.communicationLayer)===null||a===void 0||a.sendMessage({type:xe.WALLET_INFO,walletInfo:l.walletInfo}),l.originatorInfo=s.originatorInfo||s.originator,c.emit(te.CLIENTS_READY,{isOriginator:l.isOriginator,originatorInfo:l.originatorInfo}),l.paused=!1})(i,r)})(n,t)}}function hm(t){return()=>{const{state:e}=t;W.RemoteCommunication("[RemoteCommunication: handleSocketReconnectEvent()] on 'socket_reconnect' -- reset key exchange status / set ready to fal
3se"),e.ready=!1,e.authorized=!1,uh(e),t.emitServiceStatusEvent({context:"socket_reconnect"})}}function fm(t){return()=>{const{state:e}=t;W.RemoteCommunication("[RemoteCommunication: handleSocketDisconnectedEvent()] on 'socket_Disconnected' set ready to false"),e.ready=!1}}function pm(t){return()=>J(this,void 0,void 0,(function*(){var e,n,r,i,o,c,s;const{state:a}=t;W.RemoteCommunication(`[RemoteCommunication: handleFullPersistenceEvent()] context=${a.context}`),t.state.ready=!0,t.state.clientsConnected=!0,t.state.authorized=!0,t.state.relayPersistence=!0,(e=t.state.communicationLayer)===null||e===void 0||e.getKeyExchange().setKeysExchanged(!0),t.emit(te.KEYS_EXCHANGED,{keysExchanged:!0,isOriginator:!0}),t.emit(te.AUTHORIZED),t.emit(te.CLIENTS_READY),t.emit(te.CHANNEL_PERSISTENCE);try{a.channelConfig=Object.assign(Object.assign({},a.channelConfig),{localKey:(n=a.communicationLayer)===null||n===void 0?void 0:n.getKeyExchange().getKeyInfo().ecies.private,otherKey:(r=a.communicationLayer)===null||r===void 0?void 0:r.getKeyExchange().getOtherPublicKey(),channelId:(i=a.channelId)!==null&&i!==void 0?i:"",validUntil:(c=(o=a.channelConfig)===null||o===void 0?void 0:o.validUntil)!==null&&c!==void 0?c:ar,relayPersistence:!0}),yield(s=a.storageManager)===null||s===void 0?void 0:s.persistChannelConfig(a.channelConfig)}catch{}}))}function ul({communicationLayerPreference:t,otherPublicKey:e,reconnect:n,ecies:r,communicationServerUrl:i=sr,instance:o}){var c,s,a,l,u,d,h,f,m,g,w;const{state:p}=o;if(W.RemoteCommunication("[initCommunicationLayer()] ",JSON.stringify(p,null,2)),t!==Dn.SOCKET)throw new Error("Invalid communication protocol");p.communicationLayer=new im({communicationLayerPreference:t,otherPublicKey:e,reconnect:n,transports:p.transports,communicationServerUrl:i,context:p.context,ecies:r,logging:p.logging,remote:o});let C=typeof document<"u"&&document.URL||"",_=typeof document<"u"&&document.title||"";!((c=p.dappMetadata)===null||c===void 0)&&c.url&&(C=p.dappMetadata.url),!((s=p.dappMetadata)===null||s===void 0)&&s.name&&(_=p.dappMetadata.name);const O=(d=(l=(a=p.dappMetadata)===null||a===void 0?void 0:a.name)!==null&&l!==void 0?l:(u=p.dappMetadata)===null||u===void 0?void 0:u.url)!==null&&d!==void 0?d:"N/A",L=typeof window<"u"&&window.location!==void 0&&(h=window.location.hostname)!==null&&h!==void 0?h:O,U={url:C,title:_,source:(f=p.dappMetadata)===null||f===void 0?void 0:f.source,dappId:L,anonId:p.anonId,icon:((m=p.dappMetadata)===null||m===void 0?void 0:m.iconUrl)||((g=p.dappMetadata)===null||g===void 0?void 0:g.base64Icon),platform:p.platformType,apiVersion:Cn.version,connector:(w=p.dappMetadata)===null||w===void 0?void 0:w.connector};p.originatorInfo=U;const q={[te.AUTHORIZED]:om(o),[te.MESSAGE]:dm(o),[te.CHANNEL_PERSISTENCE]:pm(o),[te.CLIENTS_CONNECTED]:am(o,t),[te.KEYS_EXCHANGED]:um(o,t),[te.SOCKET_DISCONNECTED]:fm(o),[te.SOCKET_RECONNECT]:hm(o),[te.CLIENTS_DISCONNECTED]:cm(o),[te.KEY_INFO]:()=>{},[te.CHANNEL_CREATED]:sm(o),[te.CLIENTS_WAITING]:lm(o),[te.RPC_UPDATE]:F=>{o.emit(te.RPC_UPDATE,F)}};for(const[F,B]of Object.entries(q))try{p.communicationLayer.on(F,B)}catch{}}function fh(t){return J(this,arguments,void 0,(function*({options:e,instance:n}){const{state:r}=n;return W.RemoteCommunication(`[RemoteCommunication: disconnect()] channel=${r.channelId}`,e),new Promise(((i,o)=>{var c,s,a,l,u,d;e?.terminate?(n.state.ready&&Qt({id:(c=n.state.channelId)!==null&&c!==void 0?c:"",event:Oe.TERMINATED},n.state.communicationServerUrl).catch((h=>{})),r.ready=!1,r.paused=!1,(s=r.storageManager)===null||s===void 0||s.terminate((a=r.channelId)!==null&&a!==void 0?a:""),n.state.terminated=!0,e.sendMessage?!((l=r.communicationLayer)===null||l===void 0)&&l.getKeyInfo().keysExchanged&&n.state.communicationLayer&&dh(n.state.communicationLayer,{type:xe.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(Ue.TERMINATED)):((d=r.communicationLayer)===null||d===void 0||d.disconnect(e),n.setConnectionStatus(Ue.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"})(Ve||(Ve={}));
3class mm extends Eo.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:Ue.DISCONNECTED},this._options=e;const{anonId:n,platformType:r,communicationLayerPreference:i,otherPublicKey:o,reconnect:c,walletInfo:s,dappMetadata:a,protocolVersion:l,transports:u,context:d,relayPersistence:h,ecies:f,analytics:m=!1,storage:g,sdkVersion:w,communicationServerUrl:p=sr,logging:C,autoConnect:_={timeout:Q0}}=e;this.state.anonId=n,this.state.otherPublicKey=o,this.state.dappMetadata=a,this.state.walletInfo=s,this.state.transports=u,this.state.platformType=r,this.state.analytics=m,this.state.protocolVersion=l??1,this.state.isOriginator=!o,this.state.relayPersistence=h,this.state.communicationServerUrl=p,this.state.context=d,this.state.terminated=!1,this.state.sdkVersion=w,this.setMaxListeners(50),this.setConnectionStatus(Ue.DISCONNECTED),g?.duration&&(this.state.sessionDuration=ar),this.state.storageOptions=g,this.state.autoConnectOptions=_,this.state.debug=C?.remoteLayer===!0,C?.remoteLayer===!0&&Je.enable("RemoteCommunication:Layer"),C?.serviceLayer===!0&&Je.enable("SocketService:Layer"),C?.eciesLayer===!0&&Je.enable("ECIES:Layer"),C?.keyExchangeLayer===!0&&Je.enable("KeyExchange:Layer"),this.state.logging=C,g?.storageManager&&(this.state.storageManager=g.storageManager),W.RemoteCommunication(`[RemoteCommunication: constructor()] protocolVersion=${l} relayPersistence=${h} isOriginator=${this.state.isOriginator} communicationLayerPreference=${i} otherPublicKey=${o} reconnect=${c}`),this.state.isOriginator||ul({communicationLayerPreference:i,otherPublicKey:o,reconnect:c,ecies:f,communicationServerUrl:p,instance:this}),this.emitServiceStatusEvent({context:"constructor"})}initFromDappStorage(){return J(this,void 0,void 0,(function*(){var e;if(this.state.storageManager){const n=yield this.state.storageManager.getPersistedChannelConfig({});n&&(this.state.channelConfig=n,this.state.channelId=n.channelId,this.state.deeplinkProtocolAvailable=(e=n.deeplinkProtocolAvailable)!==null&&e!==void 0&&e,n.relayPersistence&&(this.state.authorized=!0,this.state.ready=!0,this.setConnectionStatus(Ue.LINKED),yield this.connectToChannel({channelId:n.channelId})))}ul({communicationLayerPreference:Dn.SOCKET,otherPublicKey:this.state.otherPublicKey,reconnect:this._options.reconnect,ecies:this._options.ecies,communicationServerUrl:this.state.communicationServerUrl,instance:this})}))}originatorSessionConnect(){return J(this,void 0,void 0,(function*(){return yield(function(e){return J(this,void 0,void 0,(function*(){var n;const{state:r}=e;if(!r.storageManager)return void W.RemoteCommunication("[RemoteCommunication: originatorSessionConnect()] no storage manager defined - skip");const i=yield r.storageManager.getPersistedChannelConfig({});if(W.RemoteCommunication(`[RemoteCommunication: originatorSessionConnect()] autoStarted=${r.originatorConnectStarted} channelConfig`,i),(n=r.communicationLayer)===null||n===void 0?void 0:n.isConnected())return W.RemoteCommunication("[RemoteCommunication: originatorSessionConnect()] socket already connected - skip"),i;if(i){if(i.validUntil>Date.now())return r.channelConfig=i,r.originatorConnectStarted=!0,r.channelId=i?.channelId,r.reconnection=!0,i;W.RemoteCommunication("[RemoteCommunication: autoConnect()] Session has expired")}r.originatorConnectStarted=!1}))})(this)}))}generateChannelIdConnect(){return J(this,void 0,void 0,(function*(){return(function(e){return J(this,void 0,void 0,(function*(){var n,r,i,o,c,s;if(!e.communicationLayer)throw new Error("communication layer not initialized");if(e.ready)throw new Error("Channel already connected");if(e.channelId&&(!((n=e.communicationLayer)===null||n===void 0)&&n.isConnected()))return e.channelConfig=Object.assign(Object.assign({},e.channelConfig),{channelId:e.channelId,validUntil:Date.now()+e.sessionDuration}),(r=e.storageManager)===null||r===void 0||r.persistChannelConfig(e.channelConfig),{channelId:e.channelId,privKey:(o=(i=e.communicationLayer)===null||i===void 0?void 0:i.getKeyInfo())===null||o===void 0?void 0:o.ecies.private,pubKey:(s=(c=e.communicationLayer)===null||c===void 0?void 0:c.getKeyInfo())===null||s===void 0?void 0:s.ecies.public};W.RemoteCommunication("[RemoteCommunication: generateChannelId()]");const a=yield e.communicationLayer.createChannel();W.RemoteCommunication("[RemoteCommunication: generateChannelId()] channel created",a);const l=Object.assign(Object.assign({},e.channelConfig),{channelId:a.channelId,localKey:a.privKey,validUntil:Date.now()+e.sessionDuration});return e.channelId=a.channelId,e.channelConfig=l,{channelId:e.channelId,pubKey:a.pubKey,privKey:a.privKey}}))})(this.state)}))}clean(){return uh(this.state)}
3connectToChannel({channelId:e,withKeyExchange:n,authorized:r}){return(function(i){return J(this,arguments,void 0,(function*({channelId:o,withKeyExchange:c,authorized:s,state:a}){var l,u,d;if(!Rs(o))throw W.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${a.context} invalid channel channelId=${o}`),new Error(`Invalid channel ${o}`);if(W.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${a.context} channelId=${o} withKeyExchange=${c}`),(l=a.communicationLayer)===null||l===void 0?void 0:l.isConnected())return void W.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${a.context} already connected - interrupt connection.`);a.channelId=o,yield(u=a.communicationLayer)===null||u===void 0?void 0:u.connectToChannel({channelId:o,authorized:s,withKeyExchange:c});const h=Object.assign(Object.assign({},a.channelConfig),{channelId:o,validUntil:Date.now()+a.sessionDuration});a.channelConfig=h,(d=a.storageManager)===null||d===void 0||d.persistChannelConfig(h)}))})({channelId:e,authorized:r,withKeyExchange:n,state:this.state})}sendMessage(e){return J(this,void 0,void 0,(function*(){const n=this.state.isOriginator&&e.method&&Zr(e.method);n&&Re.analytics.track("sdk_action_requested",{action:e.method});try{return yield(function(r,i){return J(this,void 0,void 0,(function*(){var o,c;const{state:s}=r;W.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${s.context} paused=${s.paused} ready=${s.ready} relayPersistence=${s.relayPersistence} authorized=${s.authorized} socket=${(o=s.communicationLayer)===null||o===void 0?void 0:o.isConnected()} clientsConnected=${s.clientsConnected} status=${s._connectionStatus}`,i),s.relayPersistence||s.ready&&(!((c=s.communicationLayer)===null||c===void 0)&&c.isConnected())&&s.clientsConnected||(W.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${s.context}  SKIP message waiting for MM mobile readiness.`),yield new Promise((a=>{r.once(te.CLIENTS_READY,a)})),W.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${s.context}  AFTER SKIP / READY -- sending pending message`));try{return yield(function(l,u){return J(this,void 0,void 0,(function*(){return new Promise((d=>{var h;const{state:f}=l;W.RemoteCommunication(`[RemoteCommunication: handleAuthorization()] context=${f.context} ready=${f.ready} authorized=${f.authorized} method=${u.method}`),!f.isOriginator||f.authorized||f.relayPersistence?(h=f.communicationLayer)===null||h===void 0||h.sendMessage(u).then((m=>{d(m)})).catch((m=>{d(!1)})):l.once(te.AUTHORIZED,(()=>{var m;W.RemoteCommunication(`[RemoteCommunication: handleAuthorization()] context=${f.context}  AFTER SKIP / AUTHORIZED -- sending pending message`),(m=f.communicationLayer)===null||m===void 0||m.sendMessage(u).then((g=>{d(g)})).catch((g=>{d(!1)}))}))}))}))})(r,i)}catch(a){throw a}}))})(this,e)}catch(r){throw n&&Re.analytics.track("sdk_action_failed",{action:e.method}),r}}))}testStorage(){return J(this,void 0,void 0,(function*(){return(function(e){return J(this,void 0,void 0,(function*(){var n;const r=yield(n=e.storageManager)===null||n===void 0?void 0:n.getPersistedChannelConfig();W.RemoteCommunication("[RemoteCommunication: testStorage()] res",r)}))})(this.state)}))}hasDeeplinkProtocol(){return this.state.deeplinkProtocolAvailable}getChannelConfig(){return this.state.channelConfig}isReady(){return this.state.ready}isConnected(){var e;return(e=this.state.communicationLayer)===null||e===void 0?void 0:e.isConnected()}isAuthorized(){return this.state.authorized}isPaused(){return this.state.paused}getCommunicationLayer(){return this.state.communicationLayer}ping(){return J(this,void 0,void 0,(function*(){var e;W.RemoteCommunication(`[RemoteCommunication: ping()] channel=${this.state.channelId}`),yield(e=this.state.communicationLayer)===null||e===void 0?void 0:e.ping()}))}testLogger(){W.RemoteCommunication(`testLogger() channel=${this.state.channelId}`),W.SocketService(`testLogger() channel=${this.state.channelId}`),W.Ecies(`testLogger() channel=${this.state.channelId}`),W.KeyExchange(`testLogger() channel=${this.state.channelId}`)}keyCheck(){var e;W.RemoteCommunication(`[RemoteCommunication: keyCheck()] channel=${this.state.channelId}`),(e=this.state.communicationLayer)===null||e===void 0||e.keyCheck()}setConnectionStatus(e){this.state._connectionStatus!==e&&(this.state._connectionStatus=e,this.emit
3(te.CONNECTION_STATUS,e),this.emitServiceStatusEvent({context:"setConnectionStatus"}))}emitServiceStatusEvent(e={}){this.emit(te.SERVICE_STATUS,this.getServiceStatus())}getConnectionStatus(){return this.state._connectionStatus}getServiceStatus(){return{originatorInfo:this.state.originatorInfo,keyInfo:this.getKeyInfo(),connectionStatus:this.state._connectionStatus,channelConfig:this.state.channelConfig,channelId:this.state.channelId}}getKeyInfo(){var e;return(e=this.state.communicationLayer)===null||e===void 0?void 0:e.getKeyInfo()}resetKeys(){var e;(e=this.state.communicationLayer)===null||e===void 0||e.resetKeys()}setOtherPublicKey(e){var n;const r=(n=this.state.communicationLayer)===null||n===void 0?void 0:n.getKeyExchange();if(!r)throw new Error("KeyExchange is not initialized.");r.getOtherPublicKey()!==e&&r.setOtherPublicKey(e)}pause(){return J(this,void 0,void 0,(function*(){var e;W.RemoteCommunication(`[RemoteCommunication: pause()] channel=${this.state.channelId}`),yield(e=this.state.communicationLayer)===null||e===void 0?void 0:e.pause(),this.setConnectionStatus(Ue.PAUSED)}))}getVersion(){return Cn.version}hasRelayPersistence(){var e;return(e=this.state.relayPersistence)!==null&&e!==void 0&&e}resume(){return J(this,void 0,void 0,(function*(){return(function(e){return J(this,void 0,void 0,(function*(){var n;const{state:r}=e;W.RemoteCommunication(`[RemoteCommunication: resume()] channel=${r.channelId}`),yield(n=r.communicationLayer)===null||n===void 0?void 0:n.resume(),e.setConnectionStatus(Ue.LINKED)}))})(this)}))}encrypt(e){var n,r,i;const o=(n=this.state.communicationLayer)===null||n===void 0?void 0:n.getKeyExchange(),c=o?.getOtherPublicKey();if(!c)throw new Error("KeyExchange not completed");return(i=(r=this.state.communicationLayer)===null||r===void 0?void 0:r.state.eciesInstance)===null||i===void 0?void 0:i.encrypt(e,c)}decrypt(e){var n,r,i;if(!(!((n=this.state.communicationLayer)===null||n===void 0)&&n.state.eciesInstance))throw new Error("ECIES instance is not initialized");return(i=(r=this.state.communicationLayer)===null||r===void 0?void 0:r.state.eciesInstance)===null||i===void 0?void 0:i.decrypt(e)}getChannelId(){return this.state.channelId}getRPCMethodTracker(){var e;return(e=this.state.communicationLayer)===null||e===void 0?void 0:e.getRPCMethodTracker()}reject({channelId:e}){return(function(n){return J(this,arguments,void 0,(function*({channelId:r,state:i}){var o,c,s;if(!Rs(r))throw W.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${i.context} invalid channel channelId=${r}`),new Error(`Invalid channel ${r}`);if(i.isOriginator)return void W.RemoteCommunication(`[RemoteCommunication: reject()] context=${i.context} isOriginator=${i.isOriginator} channelId=${r}`);const{socket:a}=(c=(o=i.communicationLayer)===null||o===void 0?void 0:o.state)!==null&&c!==void 0?c:{};a?.connected||(W.RemoteCommunication(`[RemoteCommunication: reject()] context=${i.context} socket already connected`),a?.connect()),Qt(Object.assign(Object.assign({id:r,event:Oe.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)=>{a?.emit(te.REJECTED,{channelId:r},((d,h)=>{W.RemoteCommunication(`[RemoteCommunication: reject()] context=${i.context} socket=${a?.id}`,{error:d,response:h}),d?u(d):l(h)}))}))}))})({channelId:e,state:this.state})}disconnect(e){return J(this,void 0,void 0,(function*(){return fh({options:e,instance:this})}))}}(function(t){t.RENEW="renew",t.LINK="link"})(ll||(ll={}));var gm="ERC721",ym="ERC1155",Me={errors:{disconnected:()=>"MetaMask: Disconnected from chain. Attempting to connect.",permanentlyDisconnected:()=>"MetaMask: Disconnected from MetaMask background. Page reload required.",sendSiteMetadata:()=>"MetaMask: Failed to send site metadata. This is an internal error, please report this bug.",unsupportedSync:t=>`MetaMask: The MetaMask Ethereum provider does not support synchronous methods like ${t}
3 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.
4For 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.
5For 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.
6For 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.
7For 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.
8For 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.
9For 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.
10For 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.
11For 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.
12For 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.
13For 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.
14For 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.
15For 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 vm(t){const e={ethDecryptDeprecation:!1,ethGetEncryptionPublicKeyDeprecation:!1,walletWatchAssetNFTExperimental:!1};return(n,r,i)=>{e.ethDecryptDeprecation||n.method!=="eth_decrypt"?e.ethGetEncryptionPublicKeyDeprecation||n.method!=="eth_getEncryptionPublicKey"?!e.walletWatchAssetNFTExperimental&&n.method==="wallet_watchAsset"&&[gm,ym].includes(n.params?.type||"")&&(t.warn(Me.warnings.rpc.walletWatchAssetNFTExperimental),e.walletWatchAssetNFTExperimental=!0):(t.warn(Me.warnings.rpc.ethGetEncryptionPublicKeyDeprecation),e.ethGetEncryptionPublicKeyDeprecation=!0):(t.warn(Me.warnings.rpc.ethDecryptDeprecation),e.ethDecryptDeprecation=!0),i()}}var ph=4294967295,dl=Math.floor(Math.random()*ph);function bm(){return(t,e,n,r)=>{const i=t.id,o=dl=(dl+1)%ph;t.id=o,e.id=o,n((c=>{t.id=i,e.id=i,c()}))}}var Pa=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},vn=(t,e,n)=>(Pa(t,e,"read from private field"),n?n.call(t):e.get(t)),St=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},wi=(t,e,n,r)=>(Pa(t,e,"write to private field"),e.set(t,n),n),Ge=(t,e,n)=>(Pa(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},hl={"-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 fl(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}var oo=(t,e)=>Object.hasOwnProperty.call(t,e);class wm extends TypeError{constructor(e,n){let r;const{message:i,explanation:o,...c}=e,{path:s}=e,a=s.length===0?i:`At path: ${s.join(".")} -- ${i}`;super(o??a),o!=null&&(this.cause=a),Object.assign(this,c),this.name=this.constructor.name,this.failures=()=>r??(r=[e,...n()])}}function Xt(t){return typeof t=="object"&&t!=null}function Ut(t){return typeof t=="symbol"?t.toString():typeof t=="string"?JSON.stringify(t):`${t}`}function Em(t,e,n,r){if(t===!0)return;t===!1?t={}:typeof t=="string"&&(t={message:t});const{path:i,branch:o}=e,{type:c}=n,{refinement:s,message:a=`Expected a value of type \`${c}\`${s?` with refinement \`${s}\``:""}, but received: \`${Ut(r)}\``}=t;return{value:r,type:c,refinement:s,key:i[i.length-1],path:i,branch:o,...t,message:a}}function*pl(t,e,n,r){(function(i){return Xt(i)&&typeof i[Symbol.iterator]=="function"})(t)||(t=[t]);for(const i of t){const o=Em(i,e,n,r);o&&(yield o)}}function*Ia(t,e,n={}){const{path:r=[],branch:i=[t],coerce:o=!1,mask:c=!1}=n,s={path:r,branch:i};if(o&&(t=e.coercer(t,s),c&&e.type!=="type"&&Xt(e.schema)&&Xt(t)&&!Array.isArray(t)))for(const l in t)e.schema[l]===void 0&&delete t[l];let a="valid";for(const l of e.validator(t,s))l.explanation=n.message,a="not_val
15id",yield[l,void 0];for(let[l,u,d]of e.entries(t,s)){const h=Ia(u,d,{path:l===void 0?r:[...r,l],branch:l===void 0?i:[...i,u],coerce:o,mask:c,message:n.message});for(const f of h)f[0]?(a=f[0].refinement!=null?"not_refined":"not_valid",yield[f[0],void 0]):o&&(u=f[1],l===void 0?t=u:t instanceof Map?t.set(l,u):t instanceof Set?t.add(u):Xt(t)&&(u!==void 0||l in t)&&(t[l]=u))}if(a!=="not_valid")for(const l of e.refiner(t,s))l.explanation=n.message,a="not_refined",yield[l,void 0];a==="valid"&&(yield[void 0,t])}class At{constructor(e){const{type:n,schema:r,validator:i,refiner:o,coercer:c=(a=>a),entries:s=function*(){}}=e;this.type=n,this.schema=r,this.entries=s,this.coercer=c,this.validator=i?(a,l)=>pl(i(a,l),l,this,a):()=>[],this.refiner=o?(a,l)=>pl(o(a,l),l,this,a):()=>[]}assert(e,n){return mh(e,this,n)}create(e,n){return gh(e,this,n)}is(e){return dr(e,this)}mask(e,n){return(function(r,i,o){const c=$r(r,i,{coerce:!0,mask:!0,message:o});if(c[0])throw c[0];return c[1]})(e,this,n)}validate(e,n={}){return $r(e,this,n)}}function mh(t,e,n){const r=$r(t,e,{message:n});if(r[0])throw r[0]}function gh(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=Ia(t,e,n),i=(function(o){const{done:c,value:s}=o.next();return c?void 0:s})(r);return i[0]?[new wm(i[0],(function*(){for(const c of r)c[0]&&(yield c[0])})),void 0]:[void 0,i[1]]}function kn(t,e){return new At({type:t,schema:null,validator:e})}function ml(t){let e;return new At({type:"lazy",schema:null,*entries(n,r){e??(e=t()),yield*e.entries(n,r)},validator:(n,r)=>(e??(e=t()),e.validator(n,r)),coercer:(n,r)=>(e??(e=t()),e.coercer(n,r)),refiner:(n,r)=>(e??(e=t()),e.refiner(n,r))})}function yh(t){return new At({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(const[n,r]of e.entries())yield[n,r,t]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${Ut(e)}`})}function vh(t){const e=Ut(t),n=typeof t;return new At({type:"literal",schema:n==="string"||n==="number"||n==="boolean"?t:null,validator:r=>r===t||`Expected the literal \`${e}\`, but received: ${Ut(r)}`})}function bh(){return kn("number",(t=>typeof t=="number"&&!isNaN(t)||`Expected a number, but received: ${Ut(t)}`))}function wh(t){const e=t?Object.keys(t):[],n=kn("never",(()=>!1));return new At({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: ${Ut(r)}`,coercer:r=>Xt(r)?{...r}:r})}function gl(t){return new At({...t,validator:(e,n)=>e===void 0||t.validator(e,n),refiner:(e,n)=>e===void 0||t.refiner(e,n)})}function Eh(t,e){return new At({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: ${Ut(n)}`})}function An(){return kn("string",(t=>typeof t=="string"||`Expected a string, but received: ${Ut(t)}`))}function xo(t){const e=t.map((n=>n.type)).join(" | ");return new At({type:"union",schema:null,coercer(n){for(const r of t){const[i,o]=r.validate(n,{coerce:!0});if(!i)return o}return n},validator(n,r){const i=[];for(const o of t){const[...c]=Ia(n,o,r),[s]=c;if(!s[0])return[];for(const[a]of c)a&&i.push(a)}return[`Expected the value to satisfy a union of \`${e}\`, but received: ${Ut(n)}`,...i]}})}function _m(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 Sm(t,e){return n=t,typeof n?.prototype?.constructor?.name=="string"?new t({message:e}):t({message:e});var n}var Cm=class extends Error{constructor(t){super(t.message),this.code="ERR_ASSERTION"}};function _h(){throw new Error("setTimeout has not been defined")}function Sh(){throw new Error("clearTimeout has not been defined")}var an=_h,cn=Sh;function Ch(t){if(an===setTimeout)return setTimeout(t,0);if((an===_h||!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 Xe.setTimeout=="function"&&(an=setTimeout),typeof Xe.clearTimeout=="function"&&(cn=clearTimeout);var In,Jt=[],ir=!1,Ni=-1;function km(){ir&&In&&(ir=!1,In.length?Jt=In.concat(Jt):Ni=-1,Jt.length&&kh())}function kh(){if(!ir){var t=Ch(km);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===Sh||!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 Ah(t,e){this.fun=t,this.array=e}Ah.prototype.run=function(){this.fun.apply(null,this.array)};function $n(){}var Am=$n,xm=$n,Tm=$n,Mm=$n,Rm=$n,Om=$n,Pm=$n,Wn=Xe.performance||{},Im=Wn.now||Wn.mozNow||Wn.msNow||Wn.oNow||Wn.webkitNow||function(){return new Date().getTime()},Lm=new Date,Ee={nextTick:function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];Jt.push(new Ah(t,e)),Jt.length!==1||ir||Ch(kh)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:Am,addListener:xm,once:Tm,off:Mm,removeListener:Rm,removeAllListeners:Om,emit:Pm,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}
15,hrtime:function(t){var e=.001*Im.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-Lm)/1e3}},Kr=t=>wh(t);function yl({path:t,branch:e}){const n=t[t.length-1];return oo(e[e.length-2],n)}function so(t){return new At({...t,type:`optional ${t.type}`,validator:(e,n)=>!yl(n)||t.validator(e,n),refiner:(e,n)=>!yl(n)||t.refiner(e,n)})}var Ei,vl,bl,ao=xo([vh(null),kn("boolean",(t=>typeof t=="boolean")),kn("finite number",(t=>dr(t,bh())&&Number.isFinite(t))),An(),yh(ml((()=>ao))),Eh(An(),ml((()=>ao)))]),jr=(Ei=ao,vl=kn("any",(()=>!0)),bl=t=>((function(e,n,r="Assertion failed",i=Cm){try{mh(e,n)}catch(o){throw Sm(i,`${r}: ${_m(o)}.`)}})(t,ao),JSON.parse(JSON.stringify(t,((e,n)=>{if(e!=="__proto__"&&e!=="constructor")return n})))),new At({...Ei,coercer:(t,e)=>dr(t,vl)?Ei.coercer(bl(t,e),e):Ei.coercer(t,e)}));function Ys(t){try{return(function(e){gh(e,jr)})(t),!0}catch{return!1}}var Ar=vh("2.0"),Di=(function(t){return new At({...t,validator:(e,n)=>e===null||t.validator(e,n),refiner:(e,n)=>e===null||t.refiner(e,n)})})(xo([bh(),An()])),Zs=Kr({code:kn("integer",(t=>typeof t=="number"&&!isNaN(t)&&Number.isInteger(t)||`Expected an integer, but received: ${Ut(t)}`)),message:An(),data:so(jr),stack:so(An())}),xh=xo([Eh(An(),jr),yh(jr)]),Nm=Kr({id:Di,jsonrpc:Ar,method:An(),params:so(xh)}),Dm=Kr({jsonrpc:Ar,method:An(),params:so(xh)});function wl(t){return dr(t,Nm)}function El(t){return dr(t,Zs)}wh({id:Di,jsonrpc:Ar,result:gl(kn("unknown",(()=>!0))),error:gl(Zs)}),xo([Kr({id:Di,jsonrpc:Ar,result:jr}),Kr({id:Di,jsonrpc:Ar,error:Zs})]);var _l=fn.internal,Bm="Unspecified error message. This is a bug, please report it.",$m={code:_l,message:Th(_l)},Km="Unspecified server error.";function Th(t,e=Bm){if((function(n){return Number.isInteger(n)})(t)){const n=t.toString();if(oo(hl,n))return hl[n].message;if((function(r){return r>=-32099&&r<=-32e3})(t))return Km}return e}function Sl(t,{fallbackError:e=$m,shouldIncludeStack:n=!0}={}
15){if(!El(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(El(i))return i;const c=Mh(i);return{...o,data:{cause:c}}})(t,e);return n||delete r.stack,r}function Mh(t){return Array.isArray(t)?t.map((e=>Ys(e)?e:fl(e)?Cl(e):null)):fl(t)?Cl(t):Ys(t)?t:null}function Cl(t){return Object.getOwnPropertyNames(t).reduce(((e,n)=>{const r=t[n];return Ys(r)&&(e[n]=r),e}),{})}var Rh=_r;_r.default=_r,_r.stable=kl,_r.stableStringify=kl;var co="[...]",Oh="[Circular]",Bn=[],Ln=[];function Ph(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function _r(t,e,n,r){var i;r===void 0&&(r=Ph()),Js(t,"",0,[],void 0,0,r);try{i=Ln.length===0?JSON.stringify(t,e,n):JSON.stringify(t,Ih(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])):Ln.push([e,n,t]):(r[n]=t,Bn.push([r,n,e]))}function Js(t,e,n,r,i,o,c){var s;if(o+=1,typeof t=="object"&&t!==null){for(s=0;s<r.length;s++)if(r[s]===t)return void or(Oh,t,e,i);if(c.depthLimit!==void 0&&o>c.depthLimit||c.edgesLimit!==void 0&&n+1>c.edgesLimit)return void or(co,t,e,i);if(r.push(t),Array.isArray(t))for(s=0;s<t.length;s++)Js(t[s],s,s,r,t,o,c);else{var a=Object.keys(t);for(s=0;s<a.length;s++){var l=a[s];Js(t[l],l,s,r,t,o,c)}}r.pop()}}function jm(t,e){return t<e?-1:t>e?1:0}function kl(t,e,n,r){r===void 0&&(r=Ph());var i,o=Xs(t,"",0,[],void 0,0,r)||t;try{i=Ln.length===0?JSON.stringify(o,e,n):JSON.stringify(o,Ih(e),n)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;Bn.length!==0;){var c=Bn.pop();c.length===4?Object.defineProperty(c[0],c[1],c[3]):c[0][c[1]]=c[2]}}return i}function Xs(t,e,n,r,i,o,c){var s;if(o+=1,typeof t=="object"&&t!==null){for(s=0;s<r.length;s++)if(r[s]===t)return void or(Oh,t,e,i);try{if(typeof t.toJSON=="function")return}catch{return}if(c.depthLimit!==void 0&&o>c.depthLimit||c.edgesLimit!==void 0&&n+1>c.edgesLimit)return void or(co,t,e,i);if(r.push(t),Array.isArray(t))for(s=0;s<t.length;s++)Xs(t[s],s,s,r,t,o,c);else{var a={},l=Object.keys(t).sort(jm);for(s=0;s<l.length;s++){var u=l[s];Xs(t[u],u,s,r,t,o,c),a[u]=t[u]}if(i===void 0)return a;Bn.push([i,e,t]),i[e]=a}r.pop()}}function Ih(t){return t=t!==void 0?t:function(e,n){return n},function(e,n){if(Ln.length>0)for(var r=0;r<Ln.length;r++){var i=Ln[r];if(i[1]===e&&i[0]===n){n=i[2],Ln.splice(r,1);break}}return t.call(this,e,n)}}var Um=ko(Rh),zt=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=Mh(this.data.cause))),this.stack&&(t.stack=this.stack),t}toString(){return Um(this.serialize(),Hm,2)}};function Hm(t,e){if(e!=="[Circular]")return e}var xr=t=>Fm(fn.invalidRequest,t);function Fm(t,e){const[n,r]=(function(i){if(i){if(typeof i=="string")return[i];if(typeof i=="object"&&!Array.isArray(i)){const{message:o,data:c}=i;
15if(o&&typeof o!="string")throw new Error("Must specify string message.");return[o??void 0,c]}}return[]})(e);return new zt(t,n??Th(t),r)}var Lh={};function ln(){}function _e(){_e.init.call(this)}function Nh(t){return t._maxListeners===void 0?_e.defaultMaxListeners:t._maxListeners}function Al(t,e,n,r){var i,o,c;if(typeof n!="function")throw new TypeError('"listener" argument must be a function');if((o=t._events)?(o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),c=o[e]):(o=t._events=new ln,t._eventsCount=0),c){if(typeof c=="function"?c=o[e]=r?[n,c]:[c,n]:r?c.unshift(n):c.push(n),!c.warned&&(i=Nh(t))&&i>0&&c.length>i){c.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+c.length+" "+e+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=t,s.type=e,s.count=c.length,(function(a){typeof console.warn=="function"?console.warn(a):console.log(a)})(s)}}else c=o[e]=n,++t._eventsCount;return t}function xl(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 Tl(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 Nh(this)},_e.prototype.emit=function(t){var e,n,r,i,o,c,s,a=t==="error";if(c=this._events)a=a&&c.error==null;else if(!a)return!1;if(s=this.domain,a){if(e=arguments[1],!s){if(e instanceof Error)throw e;var l=new Error('Uncaught, unspecified "error" event. ('+e+")");throw l.context=e,l}return e||(e=new Error('Uncaught, unspecified "error" event')),e.domainEmitter=this,e.domain=s,e.domainThrown=!1,s.emit("error",e),!1}if(!(n=c[t]))return!1;var u=typeof n=="function";switch(r=arguments.length){case 1:(function(d,h,f){if(h)d.call(f);else for(var m=d.length,g=vr(d,m),w=0;w<m;++w)g[w].call(f)})(n,u,this);break;case 2:(function(d,h,f,m){if(h)d.call(f,m);else for(var g=d.length,w=vr(d,g),p=0;p<g;++p)w[p].call(f,m)})(n,u,this,arguments[1]);break;case 3:(function(d,h,f,m,g){if(h)d.call(f,m,g);else for(var w=d.length,p=vr(d,w),C=0;C<w;++C)p[C].call(f,m,g)})(n,u,this,arguments[1],arguments[2]);break;case 4:(function(d,h,f,m,g,w){if(h)d.call(f,m,g,w);else for(var p=d.length,C=vr(d,p),_=0;_<p;++_)C[_].call(f,m,g,w)})(n,u,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),o=1;o<r;o++)i[o-1]=arguments[o];(function(d,h,f,m){if(h)d.apply(f,m);else for(var g=d.length,w=vr(d,g),p=0;p<g;++p)w[p].apply(f,m)})(n,u,this,i)}return!0},_e.prototype.addListener=function(t,e){return Al(this,t,e,!1)},_e.prototype.on=_e.prototype.addListener,_e.prototype.prependListener=function(t,e){return Al(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,xl(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,xl(this,t,e)),this},_e.prototype.removeListener=function(t,e){var n,r,i,o,c;if(typeof e!="function")throw new TypeError('"listener" argument must be a function');if(!(r=this._events))return this;if(!(n=r[t]))return this;if(n===e||n.listener&&n.listener===e)--this._eventsCount==0?this._events=new 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){c=n[o].listener,i=o;break}if(i<0)return this;if(n.length===1){if(n[0]=void 0,--this._eventsCount==0)return this._events=new ln,this;delete r[t]}else(function(s,a){for(var l=a,u=l+1,d=s.length;u<d;l+=1,u+=1)s[l]=s[u];s.pop()})(n,i);
15r.removeListener&&this.emit("removeListener",t,c||e)}return this},_e.prototype.off=function(t,e){return this.removeListener(t,e)},_e.prototype.removeAllListeners=function(t){var e,n;if(!(n=this._events))return this;if(!n.removeListener)return arguments.length===0?(this._events=new 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),c=0;c<o.length;++c)o[c]=i[c].listener||i[c];return o})(e):[],n},_e.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Tl.call(t,e)},_e.prototype.listenerCount=Tl,_e.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var La=Gr(Object.freeze({__proto__:null,EventEmitter:_e,default:_e}));Object.defineProperty(Lh,"__esModule",{value:!0});const qm=La;function Ml(t,e,n){try{Reflect.apply(t,e,n)}catch(r){setTimeout((()=>{throw r}))}}let zm=class extends qm.EventEmitter{emit(t,...e){let n=t==="error";const r=this._events;if(r!==void 0)n=n&&r.error===void 0;else if(!n)return!1;if(n){let o;if(e.length>0&&([o]=e),o instanceof Error)throw o;const c=new Error("Unhandled error."+(o?` (${o.message})`:""));throw c.context=o,c}const i=r[t];if(i===void 0)return!1;if(typeof i=="function")Ml(i,this,e);else{const o=i.length,c=(function(s){const a=s.length,l=new Array(a);for(let u=0;u<a;u+=1)l[u]=s[u];return l})(i);for(let s=0;s<o;s+=1)Ml(c[s],this,e)}return!0}};var lo,pn,er,Sr,Bi,$i,Qs,Ki,ea,us,Rl,ji,ta,ds,Ol,Tr,uo,hs,Pl,Dh=Lh.default=zm,Et=class Ui extends Dh{constructor({notificationHandler:e}={}){super(),St(this,Sr),St(this,$i),St(this,Ki),St(this,lo,!1),St(this,pn,void 0),St(this,er,void 0),wi(this,pn,[]),wi(this,er,e)}destroy(){vn(this,pn).forEach((e=>{"destroy"in e&&typeof e.destroy=="function"&&e.destroy()})),wi(this,pn,[]),wi(this,lo,!0)}push(e){Ge(this,Sr,Bi).call(this),vn(this,pn).push(e)}handle(e,n){if(Ge(this,Sr,Bi).call(this),n&&typeof n!="function")throw new Error('"callback" must be a function if provided.');return Array.isArray(e)?n?Ge(this,$i,Qs).call(this,e,n):Ge(this,$i,Qs).call(this,e):n?Ge(this,Ki,ea).call(this,e,n):this._promiseHandle(e)}asMiddleware(){return Ge(this,Sr,Bi).call(this),async(e,n,r,i)=>{var o,c;try{const[s,a,l]=await Ge(o=Ui,ji,ta).call(o,e,n,vn(this,pn));return a?(await Ge(c=Ui,Tr,uo).call(c,l),i(s)):r((async u=>{var d;try{await Ge(d=Ui,Tr,uo).call(d,l)}catch(h){return u(h)}return u()}))}catch(s){return i(s)}}}async _promiseHandle(e){return new Promise(((n,r)=>{Ge(this,Ki,ea).call(this,e,((i,o)=>{i&&o===void 0?r(i):n(o)})).catch(r)}))}};lo=new WeakMap,pn=new WeakMap,er=new WeakMap,Sr=new WeakSet,Bi=function(){if(vn(this,lo))throw new Error("This engine is destroyed and can no longer be used.")},$i=new WeakSet,Qs=async function(t,e){try{if(t.length===0){const r=[{id:null,jsonrpc:"2.0",error:new zt(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}},Ki=new WeakSet,ea=async function(t,e){var n;if(!t||Array.isArray(t)||typeof t!="object"){const c=new zt(fn.invalidRequest,"Requests must be plain objects. Received: "+typeof t,{request:t});return e(c,{id:null,jsonrpc:"2.0",error:c})}if(typeof t.method!="string"){const c=new zt(fn.invalidRequest,"Must specify a string method. Received: "+typeof t.method,{request:t});return vn(this,er)&&!wl(t)?e(null):e(c,{id:t.id??null,jsonrpc:"2.0",error:c})}if(vn(this,er)&&dr(t,Dm)&&!wl(t)){try{await vn(this,er).call(this,t)}catch(c){return e(c)}return e(null)}let r=null;const i={...t},o={id:i.id,jsonrpc:i.jsonrpc};try{await Ge(n=Et,us,Rl).call(n,i,o,vn(this,pn))}catch(c){r=c}return r&&(delete o.result,o.error||(o.error=Sl(r))),e(r,o)},us=new WeakSet,Rl=async function(t,e,n){var r,i,o;const[c,s,a]=await Ge(r=Et,ji,ta).call(r,t,e,n);if(Ge(i=Et,hs,Pl).call(i,t,e,s),await Ge(o=Et,Tr,uo).call(o,a),c)throw c},ji=new WeakSet,ta=async function(t,e,n){var r;const i=[];let o=null,c=!1;for(const s of n)if([o,c]=await Ge(r=Et,ds,Ol).call(r,t,e,s,i),c)break;return[o,c,i.reverse()]},ds=new WeakSet,Ol=async function(t,e,n,r){return new Promise((i=>{const o=s=>{const a=s||e.error;a&&(e.error=Sl(a)),i([a,!0])},c=s=>{e.error?o(e.error):(s&&(typeof s!="function"&&o(new zt(fn.internal,`JsonRpcEngine: "next" return handlers must be functions. Received "${typeof s}" for request:
16${fs(t)}`,{request:t})),r.push(s)),i([null,!1]))};try{n(t,e,c,o)}catch(s){o(s)}}))},Tr=new WeakSet,uo=async function(t){for(const e of t)await new Promise(((n,r)=>{e((i=>
16i?r(i):n()))}))},hs=new WeakSet,Pl=function(t,e,n){if(!oo(e,"result")&&!oo(e,"error"))throw new zt(fn.internal,`JsonRpcEngine: Response has no error or result for request:
17${fs(t)}`,{request:t});if(!n)throw new zt(fn.internal,`JsonRpcEngine: Nothing ended request:
18${fs(t)}`,{request:t})},St(Et,us),St(Et,ji),St(Et,ds),St(Et,Tr),St(Et,hs);var Vm=Et;function fs(t){return JSON.stringify(t,null,2)}var Bh=Object.freeze(["eth_subscription"]),Wm=(t=console)=>[bm(),Gm(t),vm(t)];function Gm(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 Hi=(t,e,n=!0)=>(r,i)=>{r||i.error?e(r||i.error):!n||Array.isArray(i)?t(i):t(i.result)},$h=t=>!!t&&typeof t=="string"&&t.startsWith("0x"),Kh=()=>{};async function Il(t,e){try{const n=await(async function(){return{name:Ym(window),icon:await Zm(window)}})();t.handle({jsonrpc:"2.0",id:1,method:"metamask_sendDomainMetadata",params:n},Kh)}catch(n){e.error({message:Me.errors.sendSiteMetadata(),originalError:n})}}function Ym(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 Zm(t){const{document:e}=t,n=e.querySelectorAll('head > link[rel~="icon"]');for(const r of Array.from(n))if(r&&await Jm(r.href))return r.href;return null}async function Jm(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 jh=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},It=(t,e,n)=>(jh(t,e,"read from private field"),n?n.call(t):e.get(t)),na=(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)=>(jh(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 Xm extends _e{emit(e,...n){let r=e==="error";const i=this._events;if(i!==void 0)r=r&&i.error===void 0;else if(!r)return!1;if(r){let c;if(n.length>0&&([c]=n),c instanceof Error)throw c;const s=new Error("Unhandled error."+(c?` (${c.message})`:""));throw s.context=c,s}const o=i[e];if(o===void 0)return!1;if(typeof o=="function")Ll(o,this,n);else{const c=o.length,s=(function(a){const l=a.length,u=new Array(l);for(let d=0;d<l;d+=1)u[d]=a[d];return u})(o);for(let a=0;a<c;a+=1)Ll(s[a],this,n)}return!0}}var un,Mn,Qm=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,i,o;if(Array.isArray(e)){if((r=e.length)!=n.length)return!1;for(i=r;i--!=0;)if(!t(e[i],n[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if((r=(o=Object.keys(e)).length)!==Object.keys(n).length)return!1;for(i=r;i--!=0;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=r;i--!=0;){var c=o[i];if(!t(e[c],n[c]))return!1}return!0}return e!=e&&n!=n},eg=ko(Qm),Uh=class Hh extends Xm{constructor({logger:e=console,maxEventListeners:n=100,rpcMiddleware:r=[]}={}){super(),na(this,un,void 0),na(this,Mn,void 0),this._log=e,this.setMaxListeners(n),this._state={...Hh._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 Vm;r.forEach((o=>i.push(o))),this._rpcEngine=i}get chainId(){return It(this,un)}get selectedAddress(){return It(this,Mn)}isConnected(){return this._state.isConnected}async request(e){if(!e||typeof e!="object"||Array.isArray(e))throw xr({message:Me.errors.invalidRequestArgs(),data:e});const{method:n,params:r}=e;
18if(typeof n!="string"||n.length===0)throw xr({message:Me.errors.invalidRequestMethod(),data:e});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw xr({message:Me.errors.invalidRequestParams(),data:e});const i=r==null?{method:n}:{method:n,params:r};return new Promise(((o,c)=>{this._rpcRequest(i,Hi(o,c))}))}_initializeState(e){if(this._state.initialized)throw new Error("Provider already initialized.");if(e){const{accounts:n,chainId:r,isUnlocked:i,networkVersion:o}=e;this._handleConnect(r),this._handleChainChanged({chainId:r,networkVersion:o}),this._handleUnlockStateChanged({accounts:n,isUnlocked:i}),this._handleAccountsChanged(n)}this._state.initialized=!0,this.emit("_initialized")}_rpcRequest(e,n){let r=n;return Array.isArray(e)||(e.jsonrpc||(e.jsonrpc="2.0"),e.method!=="eth_accounts"&&e.method!=="eth_requestAccounts"||(r=(i,o)=>{this._handleAccountsChanged(o.result??[],e.method==="eth_accounts"),n(i,o)})),this._rpcEngine.handle(e,r)}_handleConnect(e){this._state.isConnected||(this._state.isConnected=!0,this.emit("connect",{chainId:e}),this._log.debug(Me.info.connected(e)))}_handleDisconnect(e,n){if(this._state.isConnected||!this._state.isPermanentlyDisconnected&&!e){let r;this._state.isConnected=!1,e?(r=new zt(1013,n??Me.errors.disconnected()),this._log.debug(r)):(r=new zt(1011,n??Me.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}={}){$h(e)?(this._handleConnect(e),e!==It(this,un)&&(Vt(this,un,e),this._state.initialized&&this.emit("chainChanged",It(this,un)))):this._log.error(Me.errors.invalidNetworkParams(),{chainId:e})}_handleAccountsChanged(e,n=!1){let r=e;Array.isArray(e)||(this._log.error("MetaMask: Received invalid accounts parameter. Please report this bug.",e),r=[]);for(const i of e)if(typeof i!="string"){this._log.error("MetaMask: Received non-string account. Please report this bug.",e),r=[];break}if(!eg(this._state.accounts,r)&&(n&&this._state.accounts!==null&&this._log.error("MetaMask: 'eth_accounts' unexpectedly updated accounts. Please report this bug.",r),this._state.accounts=r,It(this,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,Uh._defaultState={accounts:null,isConnected:!1,isUnlocked:!1,initialized:!1,isPermanentlyDisconnected:!1};var Na,tg=Uh,ra={exports:{}},Fh=La.EventEmitter,Da=Gr(g0);Na=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 qh=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},ng=/%[sdj%]/g;function To(t){if(!Ur(t)){for(var e=[],n=0;n<arguments.length;n++)e.push($t(arguments[n]));return e.join(" ")}n=1;for(var r=arguments,i=r.length,o=String(t).replace(ng,(function(s){if(s==="%%")return"%";if(n>=i)return s;switch(s){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch{return"[Circular]"}default:return s}})),c=r[n];n<i;
18c=r[++n])Jr(c)||!Kn(c)?o+=" "+c:o+=" "+$t(c);return o}function Ba(t,e){if(Nt(Xe.process))return function(){return Ba(t,e).apply(this,arguments)};if(Ee.noDeprecation===!0)return t;var n=!1;return function(){if(!n){if(Ee.throwDeprecation)throw new Error(e);Ee.traceDeprecation?console.trace(e):console.error(e),n=!0}return t.apply(this,arguments)}}var ps,_i={};function zh(t){return Nt(ps)&&(ps=Ee.env.NODE_DEBUG||""),t=t.toUpperCase(),!_i[t]&&(new RegExp("\\b"+t+"\\b","i").test(ps)?_i[t]=function(){var e=To.apply(null,arguments);console.error("%s %d: %s",t,0,e)}:_i[t]=function(){}),_i[t]}function $t(t,e){var n={seen:[],stylize:ig};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),Mo(e)?n.showHidden=e:e&&Ua(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=rg),ho(n,t,n.depth)}function rg(t,e){var n=$t.styles[e];return n?"\x1B["+$t.colors[n][0]+"m"+t+"\x1B["+$t.colors[n][1]+"m":t}function ig(t,e){return t}function ho(t,e,n){if(t.customInspect&&e&&Or(e.inspect)&&e.inspect!==$t&&(!e.constructor||e.constructor.prototype!==e)){var r=e.inspect(n,t);return Ur(r)||(r=ho(t,r,n)),r}var i=(function(h,f){if(Nt(f))return h.stylize("undefined","undefined");if(Ur(f)){var m="'"+JSON.stringify(f).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return h.stylize(m,"string")}if(Ka(f))return h.stylize(""+f,"number");if(Mo(f))return h.stylize(""+f,"boolean");if(Jr(f))return h.stylize("null","null")})(t,e);if(i)return i;var o=Object.keys(e),c=(function(h){var f={};return h.forEach((function(m,g){f[m]=!0})),f})(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),Rr(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return ms(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(fo(e))return t.stylize(Date.prototype.toString.call(e),"date");if(Rr(e))return ms(e)}var a,l="",u=!1,d=["{","}"];return $a(e)&&(u=!0,d=["[","]"]),Or(e)&&(l=" [Function"+(e.name?": "+e.name:"")+"]"),Mr(e)&&(l=" "+RegExp.prototype.toString.call(e)),fo(e)&&(l=" "+Date.prototype.toUTCString.call(e)),Rr(e)&&(l=" "+ms(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),a=u?(function(h,f,m,g,w){for(var p=[],C=0,_=f.length;C<_;++C)Jh(f,String(C))?p.push(gs(h,f,m,g,String(C),!0)):p.push("");return w.forEach((function(O){O.match(/^\d+$/)||p.push(gs(h,f,m,g,O,!0))})),p})(t,e,n,c,o):o.map((function(h){return gs(t,e,n,c,h,u)})),t.seen.pop(),(function(h,f,m){var g=h.reduce((function(w,p){return p.indexOf(`
19`),w+p.replace(/\u001b\[\d\d?m/g,"").length+1}),0);return g>60?m[0]+(f===""?"":f+`
20 `)+" "+h.join(`,
21  `)+" "+m[1]:m[0]+f+" "+h.join(", ")+" "+m[1]})(a,l,d)):d[0]+l+d[1]}function ms(t){return"["+Error.prototype.toString.call(t)+"]"}function gs(t,e,n,r,i,o){var c,s,a;if((a=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?s=a.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):a.set&&(s=t.stylize("[Setter]","special")),Jh(r,i)||(c="["+i+"]"),s||(t.seen.indexOf(a.value)<0?(s=Jr(n)?ho(t,a.value,null):ho(t,a.value,n-1)).indexOf(`
22`)>-1&&(s=o?s.split(`
23`).map((function(l){return"  "+l})).join(`
24`).substr(2):`
25`+s.split(`
26`).map((function(l){return"   "+l})).join(`
27`)):s=t.stylize("[Circular]","special")),Nt(c)){if(o&&i.match(/^\d+$/))return s;(c=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(c=c.substr(1,c.length-2),c=t.stylize(c,"name")):(c=c.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),c=t.stylize(c,"string"))}return c+": "+s}function $a(t){return Array.isArray(t)}function Mo(t){return typeof t=="boolean"}function Jr(t){return t===null}function Vh(t){return t==null}function Ka(t){return typeof t=="number"}function Ur(t){return typeof t=="string"}function Wh(t){return typeof t=="symbol"}function Nt(t){return t===void 0}function Mr(t){return Kn(t)&&ja(t)==="[object RegExp]"}function Kn(t){return typeof t=="object"&&t!==null}function fo(t){return Kn(t)&&ja(t)==="[object Date]"}function Rr(t){return Kn(t)&&(ja(t)==="[object Error]"||t instanceof Error)}function Or(t){return typeof t=="function"}function Gh(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||typeof t=="symbol"||t===void 0}function Yh(t){return X.isBuffer(t)}function ja(t){return Object.prototype.toString.call(t)}function ys(t){return t<10?"0"+t.toString(10):t.toString(10)}$t.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},$t.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var og=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Zh(){var t,e;console.log("%s - %s",(t=new Date,e=[ys(t.getHours()),ys(t.getMinutes()),ys(t.getSeconds())].join(":"),[t.getDate(),og[t.getMonth()],e].join(" ")),To.apply(null,arguments))}function Ua(t,e){if(!e||!Kn(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t}function Jh(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var Rn=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;function Ha(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,
27configurable:!0}),e}function e(){for(var n,r,i=new Promise((function(s,a){n=s,r=a})),o=[],c=0;c<arguments.length;c++)o.push(arguments[c]);o.push((function(s,a){s?r(s):n(a)}));try{t.apply(this,o)}catch(s){r(s)}return i}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Rn&&Object.defineProperty(e,Rn,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,qh(t))}function sg(t,e){if(!t){var n=new Error("Promise was rejected with a falsy value");n.reason=t,t=n}return e(t)}function Xh(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');function e(){for(var n=[],r=0;r<arguments.length;r++)n.push(arguments[r]);var i=n.pop();if(typeof i!="function")throw new TypeError("The last argument must be of type Function");var o=this,c=function(){return i.apply(o,arguments)};t.apply(this,n).then((function(s){Ee.nextTick(c.bind(null,null,s))}),(function(s){Ee.nextTick(sg.bind(null,s,c))}))}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Object.defineProperties(e,qh(t)),e}Ha.custom=Rn;var vs,Nl,ag={inherits:Na,_extend:Ua,log:Zh,isBuffer:Yh,isPrimitive:Gh,isFunction:Or,isError:Rr,isDate:fo,isObject:Kn,isRegExp:Mr,isUndefined:Nt,isSymbol:Wh,isString:Ur,isNumber:Ka,isNullOrUndefined:Vh,isNull:Jr,isBoolean:Mo,isArray:$a,inspect:$t,deprecate:Ba,format:To,debuglog:zh,promisify:Ha,callbackify:Xh},Qh=Gr(Object.freeze({__proto__:null,_extend:Ua,callbackify:Xh,debuglog:zh,default:ag,deprecate:Ba,format:To,inherits:Na,inspect:$t,isArray:$a,isBoolean:Mo,isBuffer:Yh,isDate:fo,isError:Rr,isFunction:Or,isNull:Jr,isNullOrUndefined:Vh,isNumber:Ka,isObject:Kn,isPrimitive:Gh,isRegExp:Mr,isString:Ur,isSymbol:Wh,isUndefined:Nt,log:Zh,promisify:Ha}));function cg(){if(Nl)return vs;function t(a,l){var u=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);l&&(d=d.filter((function(h){return Object.getOwnPropertyDescriptor(a,h).enumerable}))),u.push.apply(u,d)}return u}function e(a){for(var l=1;l<arguments.length;l++){var u=arguments[l]!=null?arguments[l]:{};l%2?t(Object(u),!0).forEach((function(d){n(a,d,u[d])})):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(u)):t(Object(u)).forEach((function(d){Object.defineProperty(a,d,Object.getOwnPropertyDescriptor(u,d))}))}return a}function n(a,l,u){return(l=i(l))in a?Object.defineProperty(a,l,{value:u,enumerable:!0,configurable:!0,writable:!0}):a[l]=u,a}function r(a,l,u){return l&&(function(d,h){for(var f=0;f<h.length;f++){var m=h[f];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(d,i(m.key),m)}})(a.prototype,l),Object.defineProperty(a,"prototype",{writable:!1}),a}function i(a){var l=(function(u,d){if(typeof u!="object"||u===null)return u;var h=u[Symbol.toPrimitive];if(h!==void 0){var f=h.call(u,d);if(typeof f!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(u)})(a,"string");return typeof l=="symbol"?l:String(l)}Nl=1;var o=Da.Buffer,c=Qh.inspect,s=c&&c.custom||"inspect";return vs=(function(){function a(){(function(l,u){if(!(l instanceof u))throw new TypeError("Cannot call a class as a function")})(this,a),this.head=null,this.tail=null,this.length=0}return r(a,[{key:"push",value:function(l){var u={data:l,next:null};this.length>0?this.tail.next=u:this.head=u,this.tail=u,++this.length}},{key:"unshift",value:function(l){var u={data:l,next:this.head};this.length===0&&(this.tail=u),this.head=u,++this.length}},{key:"shift",value:function(){if(this.length!==0){var l=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,l}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(l){if(this.length===0)return"";for(var u=this.head,d=""+u.data;u=u.next;)d+=l+u.data;return d}},{key:"concat",value:function(l){if(this.length===0)return o.alloc(0);for(var u,d,h,f=o.allocUnsafe(l>>>0),m=this.head,g=0;m;)u=m.data,d=f,h=g,o.prototype.copy.call(u,d,h),g+=m.data.length,m=m.next;return f}},{key:"consume",value:function(l,u){var d;return l<this.head.data.length?(d=this.head.data.slice(0,l),this.head.data=this.head.data.slice(l)):d=l===this.head.data.length?this.shift():u?this._getString(l):this._getBuffer(l),d}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(l){var u=this.head,d=1,h=u.data;for(l-=h.length;u=u.next;){var f=u.data,m=l>f.length?f.length:l;if(m===f.length?h+=f:h+=f.slice(0,l),(l-=m)===0){m===f.length?(++d,u.next?this.head=u.next:this.head=this.tail=null):(this.head=u,u.data=f.slice(m));break}++d}return this.length-=d,h}},{key:"_getBuffer",value:function(l){var u=o.allocUnsafe(l),d=this.head,h=1;for(d.data.copy(u),l-=d.data.length;d=d.next;){var f=d.data,m=l>f.length?f.length:l;if(f.copy(u,u.length-l,0,m),(l-=m)===0){m===f.length?(++h,d.next?this.head=d.next:this.head=this.tail=null):(this.head=d,d.data=f.slice(m));break}++h}return this.length-=h,u}},{key:s,value:function(l,u){return c(this,e(e({},u),{},{depth:0,customInspect:!1}))}}]),a})(),vs}function Dl(t,e){ia(t,e),Fi(t)}function Fi(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function ia(t,e){t.emit("error",e)}
27var ef={destroy:function(t,e){var n=this,r=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return r||i?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,Ee.nextTick(ia,this,t)):Ee.nextTick(ia,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(o){!e&&o?n._writableState?n._writableState.errorEmitted?Ee.nextTick(Fi,n):(n._writableState.errorEmitted=!0,Ee.nextTick(Dl,n,o)):Ee.nextTick(Dl,n,o):e?(Ee.nextTick(Fi,n),e(o)):Ee.nextTick(Fi,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)}},jn={},tf={};function dt(t,e,n){n||(n=Error);var r=(function(i){var o,c;function s(a,l,u){return i.call(this,(function(d,h,f){return typeof e=="string"?e:e(d,h,f)})(a,l,u))||this}return c=i,(o=s).prototype=Object.create(c.prototype),o.prototype.constructor=o,o.__proto__=c,s})(n);r.prototype.name=n.name,r.prototype.code=t,tf[t]=r}function Bl(t,e){if(Array.isArray(t)){var n=t.length;return t=t.map((function(r){return String(r)})),n>2?"one of ".concat(e," ").concat(t.slice(0,n-1).join(", "),", or ")+t[n-1]:n===2?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}dt("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),dt("ERR_INVALID_ARG_TYPE",(function(t,e,n){var r,i,o;if(typeof e=="string"&&(i="not ",e.substr(0,i.length)===i)?(r="must not be",e=e.replace(/^not /,"")):r="must be",(function(s,a,l){return(l===void 0||l>s.length)&&(l=s.length),s.substring(l-a.length,l)===a})(t," argument"))o="The ".concat(t," ").concat(r," ").concat(Bl(e,"type"));else{var c=(function(s,a,l){return typeof l!="number"&&(l=0),!(l+a.length>s.length)&&s.indexOf(a,l)!==-1})(t,".")?"property":"argument";o='The "'.concat(t,'" ').concat(c," ").concat(r," ").concat(Bl(e,"type"))}return o+=". Received type ".concat(typeof n)}),TypeError),dt("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),dt("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),dt("ERR_STREAM_PREMATURE_CLOSE","Premature close"),dt("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),dt("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),dt("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),dt("ERR_STREAM_WRITE_AFTER_END","write after end"),dt("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),dt("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),dt("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),jn.codes=tf;var lg=jn.codes.ERR_INVALID_OPT_VALUE,bs,$l,ws,Kl,nf={getHighWaterMark:function(t,e,n,r){var i=(function(o,c,s){return o.highWaterMark!=null?o.highWaterMark:c?o[s]:null})(e,r,n);if(i!=null){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new lg(r?n:"highWaterMark",i);return Math.floor(i)}return t.objectMode?16:16384}},ug=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},Xr=Gr(Object.freeze({__proto__:null,default:ug})),dg=function(t,e){if(Es("noDeprecation"))return t;var n=!1;return function(){if(!n){if(Es("throwDeprecation"))throw new Error(e);Es("traceDeprecation")?console.trace(e):console.warn(e),n=!0}return t.apply(this,arguments)}};function Es(t){try{if(!bt.localStorage)return!1}catch{return!1}var e=bt.localStorage[t];return e!=null&&String(e).toLowerCase()==="true"}function rf(){if($l)return bs;function t($){var P=this;this.next=null,this.entry=null,this.finish=function(){(function(M,S,I){var j=M.entry;for(M.entry=null;j;){var y=j.callback;S.pendingcb--,y(I),j=j.next}
27S.corkedRequestsFree.next=M})(P,$)}}var e;$l=1,bs=L,L.WritableState=O;var n={deprecate:dg},r=Fh,i=Da.Buffer,o=(bt!==void 0?bt:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){},c,s=ef,a=nf.getHighWaterMark,l=jn.codes,u=l.ERR_INVALID_ARG_TYPE,d=l.ERR_METHOD_NOT_IMPLEMENTED,h=l.ERR_MULTIPLE_CALLBACK,f=l.ERR_STREAM_CANNOT_PIPE,m=l.ERR_STREAM_DESTROYED,g=l.ERR_STREAM_NULL_VALUES,w=l.ERR_STREAM_WRITE_AFTER_END,p=l.ERR_UNKNOWN_ENCODING,C=s.errorOrDestroy;function _(){}function O($,P,M){e=e||cr(),$=$||{},typeof M!="boolean"&&(M=P instanceof e),this.objectMode=!!$.objectMode,M&&(this.objectMode=this.objectMode||!!$.writableObjectMode),this.highWaterMark=a(this,$,"writableHighWaterMark",M),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var S=$.decodeStrings===!1;this.decodeStrings=!S,this.defaultEncoding=$.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(I){(function(j,y){var E=j._writableState,A=E.sync,T=E.writecb;if(typeof T!="function")throw new h;if((function(v){v.writing=!1,v.writecb=null,v.length-=v.writelen,v.writelen=0})(E),y)(function(v,k,x,R,D){--k.pendingcb,x?(Ee.nextTick(D,R),Ee.nextTick(H,v,k),v._writableState.errorEmitted=!0,C(v,R)):(D(R),v._writableState.errorEmitted=!0,C(v,R),H(v,k))})(j,E,A,y,T);else{var b=B(E)||j.destroyed;b||E.corked||E.bufferProcessing||!E.bufferedRequest||F(j,E),A?Ee.nextTick(q,j,E,b,T):q(j,E,b,T)}})(P,I)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=$.emitClose!==!1,this.autoDestroy=!!$.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}function L($){var P=this instanceof(e=e||cr());if(!P&&!c.call(L,this))return new L($);this._writableState=new O($,this,P),this.writable=!0,$&&(typeof $.write=="function"&&(this._write=$.write),typeof $.writev=="function"&&(this._writev=$.writev),typeof $.destroy=="function"&&(this._destroy=$.destroy),typeof $.final=="function"&&(this._final=$.final)),r.call(this)}function U($,P,M,S,I,j,y){P.writelen=S,P.writecb=y,P.writing=!0,P.sync=!0,P.destroyed?P.onwrite(new m("write")):M?$._writev(I,P.onwrite):$._write(I,j,P.onwrite),P.sync=!1}function q($,P,M,S){M||(function(I,j){j.length===0&&j.needDrain&&(j.needDrain=!1,I.emit("drain"))})($,P),P.pendingcb--,S(),H($,P)}function F($,P){P.bufferProcessing=!0;var M=P.bufferedRequest;if($._writev&&M&&M.next){var S=P.bufferedRequestCount,I=new Array(S),j=P.corkedRequestsFree;j.entry=M;for(var y=0,E=!0;M;)I[y]=M,M.isBuf||(E=!1),M=M.next,y+=1;I.allBuffers=E,U($,P,!0,P.length,I,"",j.finish),P.pendingcb++,P.lastBufferedRequest=null,j.next?(P.corkedRequestsFree=j.next,j.next=null):P.corkedRequestsFree=new t(P),P.bufferedRequestCount=0}else{for(;M;){var A=M.chunk,T=M.encoding,b=M.callback;if(U($,P,!1,P.objectMode?1:A.length,A,T,b),M=M.next,P.bufferedRequestCount--,P.writing)break}M===null&&(P.lastBufferedRequest=null)}P.bufferedRequest=M,P.bufferProcessing=!1}function B($){return $.ending&&$.length===0&&$.bufferedRequest===null&&!$.finished&&!$.writing}function N($,P){$._final((function(M){P.pendingcb--,M&&C($,M),P.prefinished=!0,$.emit("prefinish"),H($,P)}))}function H($,P){var M=B(P);if(M&&((function(I,j){j.prefinished||j.finalCalled||(typeof I._final!="function"||j.destroyed?(j.prefinished=!0,I.emit("prefinish")):(j.pendingcb++,j.finalCalled=!0,Ee.nextTick(N,I,j)))})($,P),P.pendingcb===0&&(P.finished=!0,$.emit("finish"),P.autoDestroy))){var S=$._readableState;(!S||S.autoDestroy&&S.endEmitted)&&$.destroy()}return M}return Xr(L,r),O.prototype.getBuffer=function(){for(var $=this.bufferedRequest,P=[];$;)P.push($),$=$.next;return P},(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"?(c=Function.prototype[Symbol.hasInstance],Object.defineProperty(L,Symbol.hasInstance,{value:function($){return!!c.call(this,$)||this===L&&$&&$._writableState instanceof O}})):c=function($){return $ instanceof this},L.prototype.pipe=function(){C(this,new f)},L.prototype.write=function($,P,M){var S,I=this._writableState,j=!1,y=!I.objectMode&&(S=$,i.isBuffer(S)||S instanceof o);return y&&!i.isBuffer($)&&($=(function(E){return i.from(E)})($)),typeof P=="function"&&(M=P,P=null),y?P="buffer":P||(P=I.defaultEncoding),typeof M!="function"&&(M=_),I.ending?(function(E,A){var T=new w;C(E,T),Ee.nextTick(A,T)})(this,M):(y||(function(E,A,T,b){var v;return T===null?v=new g:typeof T=="string"||A.objectMode||(v=new u("chunk",["string","Buffer"],T)),!v||(C(E,v),Ee.nextTick(b,v),!1)}
27)(this,I,$,M))&&(I.pendingcb++,j=(function(E,A,T,b,v,k){if(!T){var x=(function(z,V,Z){return z.objectMode||z.decodeStrings===!1||typeof V!="string"||(V=i.from(V,Z)),V})(A,b,v);b!==x&&(T=!0,v="buffer",b=x)}var R=A.objectMode?1:b.length;A.length+=R;var D=A.length<A.highWaterMark;if(D||(A.needDrain=!0),A.writing||A.corked){var K=A.lastBufferedRequest;A.lastBufferedRequest={chunk:b,encoding:v,isBuf:T,callback:k,next:null},K?K.next=A.lastBufferedRequest:A.bufferedRequest=A.lastBufferedRequest,A.bufferedRequestCount+=1}else U(E,A,!1,R,b,v,k);return D})(this,I,y,$,P,M)),j},L.prototype.cork=function(){this._writableState.corked++},L.prototype.uncork=function(){var $=this._writableState;$.corked&&($.corked--,$.writing||$.corked||$.bufferProcessing||!$.bufferedRequest||F(this,$))},L.prototype.setDefaultEncoding=function($){if(typeof $=="string"&&($=$.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf(($+"").toLowerCase())>-1))throw new p($);return this._writableState.defaultEncoding=$,this},Object.defineProperty(L.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(L.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),L.prototype._write=function($,P,M){M(new d("_write()"))},L.prototype._writev=null,L.prototype.end=function($,P,M){var S=this._writableState;return typeof $=="function"?(M=$,$=null,P=null):typeof P=="function"&&(M=P,P=null),$!=null&&this.write($,P),S.corked&&(S.corked=1,this.uncork()),S.ending||(function(I,j,y){j.ending=!0,H(I,j),y&&(j.finished?Ee.nextTick(y):I.once("finish",y)),j.ended=!0,I.writable=!1})(this,S,M),this},Object.defineProperty(L.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(L.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function($){this._writableState&&(this._writableState.destroyed=$)}}),L.prototype.destroy=s.destroy,L.prototype._undestroy=s.undestroy,L.prototype._destroy=function($,P){P($)},bs}function cr(){if(Kl)return ws;Kl=1;var t=Object.keys||function(l){var u=[];for(var d in l)u.push(d);return u};ws=c;var e=of(),n=rf();Xr(c,e);for(var r=t(n.prototype),i=0;i<r.length;i++){var o=r[i];c.prototype[o]||(c.prototype[o]=n.prototype[o])}function c(l){if(!(this instanceof c))return new c(l);e.call(this,l),n.call(this,l),this.allowHalfOpen=!0,l&&(l.readable===!1&&(this.readable=!1),l.writable===!1&&(this.writable=!1),l.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",s)))}function s(){this._writableState.ended||Ee.nextTick(a,this)}function a(l){l.end()}return Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(c.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(c.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._writableState!==void 0&&this._readableState.destroyed&&this._writableState.destroyed},set:function(l){this._readableState!==void 0&&this._writableState!==void 0&&(this._readableState.destroyed=l,this._writableState.destroyed=l)}}),ws}var hg=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 qi(t){switch(this.encoding=(t||"utf8").toLowerCase().replace(/[-_]/,""),(function(e){if(e&&!hg(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=pg;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=mg;break;default:return void(this.write=fg)}this.charBuffer=new X(6),this.charReceived=0,this.charLength=0}function fg(t){return t.toString(this.encoding)}function pg(t){this.charReceived=t.length%2,this.charLength=this.charReceived?2:0}function mg(t){this.charReceived=t.length%3,this.charLength=this.charReceived?3:0}qi.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"";
27if(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},qi.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},qi.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 jl=Gr(Object.freeze({__proto__:null,StringDecoder:qi})),Ul=jn.codes.ERR_STREAM_PREMATURE_CLOSE;function gg(){}var _s,Hl,Fl,ql,Ss,zl,Fa=function t(e,n,r){if(typeof n=="function")return t(e,null,n);n||(n={}),r=(function(m){var g=!1;return function(){if(!g){g=!0;for(var w=arguments.length,p=new Array(w),C=0;C<w;C++)p[C]=arguments[C];m.apply(this,p)}}})(r||gg);var i=n.readable||n.readable!==!1&&e.readable,o=n.writable||n.writable!==!1&&e.writable,c=function(){e.writable||a()},s=e._writableState&&e._writableState.finished,a=function(){o=!1,s=!0,i||r.call(e)},l=e._readableState&&e._readableState.endEmitted,u=function(){i=!1,l=!0,o||r.call(e)},d=function(m){r.call(e,m)},h=function(){var m;return i&&!l?(e._readableState&&e._readableState.ended||(m=new Ul),r.call(e,m)):o&&!s?(e._writableState&&e._writableState.ended||(m=new Ul),r.call(e,m)):void 0},f=function(){e.req.on("finish",a)};return(function(m){return m.setHeader&&typeof m.abort=="function"})(e)?(e.on("complete",a),e.on("abort",h),e.req?f():e.on("request",f)):o&&!e._writableState&&(e.on("end",c),e.on("close",c)),e.on("end",u),e.on("finish",a),n.error!==!1&&e.on("error",d),e.on("close",h),function(){e.removeListener("complete",a),e.removeListener("abort",h),e.removeListener("request",f),e.req&&e.req.removeListener("finish",a),e.removeListener("end",c),e.removeListener("close",c),e.removeListener("finish",a),e.removeListener("end",u),e.removeListener("error",d),e.removeListener("close",h)}};function yg(){if(Hl)return _s;var t;function e(g,w,p){return(w=(function(C){var _=(function(O,L){if(typeof O!="object"||O===null)return O;var U=O[Symbol.toPrimitive];if(U!==void 0){var q=U.call(O,L);if(typeof q!="object")return q;throw new TypeError("@@toPrimitive must return a primitive value.")}return(L==="string"?String:Number)(O)})(C,"string");return typeof _=="symbol"?_:String(_)})(w))in g?Object.defineProperty(g,w,{value:p,enumerable:!0,configurable:!0,writable:!0}):g[w]=p,g}Hl=1;var n=Fa,r=Symbol("lastResolve"),i=Symbol("lastReject"),o=Symbol("error"),c=Symbol("ended"),s=Symbol("lastPromise"),a=Symbol("handlePromise"),l=Symbol("stream");function u(g,w){return{value:g,done:w}}function d(g){var w=g[r];if(w!==null){var p=g[l].read();p!==null&&(g[s]=null,g[r]=null,g[i]=null,w(u(p,!1)))}}function h(g){Ee.nextTick(d,g)}var f=Object.getPrototypeOf((function(){})),m=Object.setPrototypeOf((e(t={get stream(){return this[l]},next:function(){var g=this,w=this[o];if(w!==null)return Promise.reject(w);if(this[c])return Promise.resolve(u(void 0,!0));if(this[l].destroyed)return new Promise((function(O,L){Ee.nextTick((function(){g[o]?L(g[o]):O(u(void 0,!0))}))}));var p,C=this[s];if(C)p=new Promise((function(O,L){return function(U,q){O.then((function(){L[c]?U(u(void 0,!0)):L[a](U,q)}),q)}})(C,this));else{var _=this[l].read();if(_!==null)return Promise.resolve(u(_,!1));p=new Promise(this[a])}return this[s]=p,p}},Symbol.asyncIterator,(function(){return this})),e(t,"return",(function(){var g=this;return new Promise((function(w,p){g[l].destroy(null,(function(C){C?p(C):w(u(void 0,!0))}))}))})),t),f);return _s=function(g){var w,p=Object.create(m,(e(w={},l,{value:g,writable:!0}),e(w,r,{value:null,writable:!0}),e(w,i,{value:null,writable:!0}),e(w,o,{value:null,writable:!0}),e(w,c,{value:g._readableState.endEmitted,writable:!0}),e(w,a,{value:function(C,_){var O=p[l].read();O?(p[s]=null,p[r]=null,p[i]=null,C(u(O,!1))):(p[r]=C,p[i]=_)},writable:!0}),w));return p[s]=null,n(g,(function(C){if(C&&C.code!=="ERR_STREAM_PREMATURE_CLOSE"){var _=p[i];return _!==null&&(p[s]=null,p[r]=null,p[i]=null,_(C)),void(p[o]=C)}var O=p[r];O!==null&&(p[s]=null,p[r]=null,p[i]=null,O(u(void 0,!0))),p[c]=!0})),g.on("readable",h.bind(null,p)),p},_s}function of(){if(zl)return Ss;var t;zl=1,Ss=L,L.ReadableState=O,La.EventEmitter;var e=function(b,v){return b.listeners(v).length},n=Fh,r=Da.Buffer,i=(bt!==void 0?bt:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){},o,c=Qh;o=c&&c.debuglog?c.debuglog("stream"):function(){};
27var s,a,l,u=cg(),d=ef,h=nf.getHighWaterMark,f=jn.codes,m=f.ERR_INVALID_ARG_TYPE,g=f.ERR_STREAM_PUSH_AFTER_EOF,w=f.ERR_METHOD_NOT_IMPLEMENTED,p=f.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;Xr(L,n);var C=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=jl.StringDecoder),this.decoder=new s(b.encoding),this.encoding=b.encoding)}function L(b){if(t=t||cr(),!(this instanceof L))return new L(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 U(b,v,k,x,R){o("readableAddChunk",v);var D,K=b._readableState;if(v===null)K.reading=!1,(function(z,V){if(o("onEofChunk"),!V.ended){if(V.decoder){var Z=V.decoder.end();Z&&Z.length&&(V.buffer.push(Z),V.length+=V.objectMode?1:Z.length)}V.ended=!0,V.sync?N(z):(V.needReadable=!1,V.emittedReadable||(V.emittedReadable=!0,H(z)))}})(b,K);else if(R||(D=(function(z,V){var Z;Q=V,r.isBuffer(Q)||Q instanceof i||typeof V=="string"||V===void 0||z.objectMode||(Z=new m("chunk",["string","Buffer","Uint8Array"],V));var Q;return Z})(K,v)),D)C(b,D);else if(K.objectMode||v&&v.length>0)if(typeof v=="string"||K.objectMode||Object.getPrototypeOf(v)===r.prototype||(v=(function(z){return r.from(z)})(v)),x)K.endEmitted?C(b,new p):q(b,K,v,!0);else if(K.ended)C(b,new g);else{if(K.destroyed)return!1;K.reading=!1,K.decoder&&!k?(v=K.decoder.write(v),K.objectMode||v.length!==0?q(b,K,v,!1):$(b,K)):q(b,K,v,!1)}else x||(K.reading=!1,$(b,K));return!K.ended&&(K.length<K.highWaterMark||K.length===0)}function q(b,v,k,x){v.flowing&&v.length===0&&!v.sync?(v.awaitDrain=0,b.emit("data",k)):(v.length+=v.objectMode?1:k.length,x?v.buffer.unshift(k):v.buffer.push(k),v.needReadable&&N(b)),$(b,v)}Object.defineProperty(L.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._readableState.destroyed},set:function(b){this._readableState&&(this._readableState.destroyed=b)}}),L.prototype.destroy=d.destroy,L.prototype._undestroy=d.undestroy,L.prototype._destroy=function(b,v){v(b)},L.prototype.push=function(b,v){var k,x=this._readableState;return x.objectMode?k=!0:typeof b=="string"&&((v=v||x.defaultEncoding)!==x.encoding&&(b=r.from(b,v),v=""),k=!0),U(this,b,v,!1,k)},L.prototype.unshift=function(b){return U(this,b,null,!0,!1)},L.prototype.isPaused=function(){return this._readableState.flowing===!1},L.prototype.setEncoding=function(b){s||(s=jl.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 B(b,v){return b<=0||v.length===0&&v.ended?0:v.objectMode?1:b!=b?v.flowing&&v.length?v.buffer.head.data.length:v.length:(b>v.highWaterMark&&(v.highWaterMark=(function(k){return k>=F?k=F:(k--,k|=k>>>1,k|=k>>>2,k|=k>>>4,k|=k>>>8,k|=k>>>16,k++),k})(b)),b<=v.length?b:v.ended?v.length:(v.needReadable=!0,0))}function N(b){var v=b._readableState;o("emitReadable",v.needReadable,v.emittedReadable),v.needReadable=!1,v.emittedReadable||(o("emitReadable",v.flowing),v.emittedReadable=!0,Ee.nextTick(H,b))}function H(b){var v=b._readableState;o("emitReadable_",v.destroyed,v.length,v.ended),v.destroyed||!v.length&&!v.ended||(b.emit("readable"),v.emittedReadable=!1),v.needReadable=!v.flowing&&!v.ended&&v.length<=v.highWaterMark,j(b)}function $(b,v){v.readingMore||(v.readingMore=!0,Ee.nextTick(P,b,v))}function P(b,v){for(;!v.reading&&!v.ended&&(v.length<v.highWaterMark||v.flowing&&v.length===0);){var k=v.length;if(o("maybeReadMore read 0"),b.read(0),k===v.length)break}v.readingMore=!1}function M(b){var v=b._readableState;v.readableListening=b.listenerCount("readable")>0,v.resumeScheduled&&!v.paused?v.flowing=!0:b.listenerCount("data")>0&&b.resume()}function S(b){o("readable nexttick read 0"),b.read(0)}function I(b,v){o("resume",v.reading),v.reading||b.read(0),v.resumeScheduled=!1,b.emit("resume"),j(b),v.flowing&&!v.reading&&b.read(0)}function j(b){var v=b._readableState;for(o("flow",v.flowing);v.flowing&&b.read()!==null;);}function y(b,v){return v.length===0?null:(v.objectMode?k=v.buffer.shift():!b||b>=v.length?(k=v.decoder?v.buffer.join(""):v.buffer.length===1?v.buffer.first():v.buffer.concat(v.length),v.buffer.clear()):k=v.buffer.consume(b,v.decoder),k
27);var k}function E(b){var v=b._readableState;o("endReadable",v.endEmitted),v.endEmitted||(v.ended=!0,Ee.nextTick(A,v,b))}function A(b,v){if(o("endReadableNT",b.endEmitted,b.length),!b.endEmitted&&b.length===0&&(b.endEmitted=!0,v.readable=!1,v.emit("end"),b.autoDestroy)){var k=v._writableState;(!k||k.autoDestroy&&k.finished)&&v.destroy()}}function T(b,v){for(var k=0,x=b.length;k<x;k++)if(b[k]===v)return k;return-1}return L.prototype.read=function(b){o("read",b),b=parseInt(b,10);var v=this._readableState,k=b;if(b!==0&&(v.emittedReadable=!1),b===0&&v.needReadable&&((v.highWaterMark!==0?v.length>=v.highWaterMark:v.length>0)||v.ended))return o("read: emitReadable",v.length,v.ended),v.length===0&&v.ended?E(this):N(this),null;if((b=B(b,v))===0&&v.ended)return v.length===0&&E(this),null;var x,R=v.needReadable;return o("need readable",R),(v.length===0||v.length-b<v.highWaterMark)&&o("length less than watermark",R=!0),v.ended||v.reading?o("reading or ended",R=!1):R&&(o("do read"),v.reading=!0,v.sync=!0,v.length===0&&(v.needReadable=!0),this._read(v.highWaterMark),v.sync=!1,v.reading||(b=B(k,v))),(x=b>0?y(b,v):null)===null?(v.needReadable=v.length<=v.highWaterMark,b=0):(v.length-=b,v.awaitDrain=0),v.length===0&&(v.ended||(v.needReadable=!0),k!==b&&v.ended&&E(this)),x!==null&&this.emit("data",x),x},L.prototype._read=function(b){C(this,new w("_read()"))},L.prototype.pipe=function(b,v){var k=this,x=this._readableState;switch(x.pipesCount){case 0:x.pipes=b;break;case 1:x.pipes=[x.pipes,b];break;default:x.pipes.push(b)}x.pipesCount+=1,o("pipe count=%d opts=%j",x.pipesCount,v);var R=(!v||v.end!==!1)&&b!==Ee.stdout&&b!==Ee.stderr?K:ue;function D(re,ie){o("onunpipe"),re===k&&ie&&ie.hasUnpiped===!1&&(ie.hasUnpiped=!0,o("cleanup"),b.removeListener("close",ne),b.removeListener("finish",oe),b.removeListener("drain",z),b.removeListener("error",Q),b.removeListener("unpipe",D),k.removeListener("end",K),k.removeListener("end",ue),k.removeListener("data",Z),V=!0,!x.awaitDrain||b._writableState&&!b._writableState.needDrain||z())}function K(){o("onend"),b.end()}x.endEmitted?Ee.nextTick(R):k.once("end",R),b.on("unpipe",D);var z=(function(re){return function(){var ie=re._readableState;o("pipeOnDrain",ie.awaitDrain),ie.awaitDrain&&ie.awaitDrain--,ie.awaitDrain===0&&e(re,"data")&&(ie.flowing=!0,j(re))}})(k);b.on("drain",z);var V=!1;function Z(re){o("ondata");var ie=b.write(re);o("dest.write",ie),ie===!1&&((x.pipesCount===1&&x.pipes===b||x.pipesCount>1&&T(x.pipes,b)!==-1)&&!V&&(o("false write response, pause",x.awaitDrain),x.awaitDrain++),k.pause())}function Q(re){o("onerror",re),ue(),b.removeListener("error",Q),e(b,"error")===0&&C(b,re)}function ne(){b.removeListener("finish",oe),ue()}function oe(){o("onfinish"),b.removeListener("close",ne),ue()}function ue(){o("unpipe"),k.unpipe(b)}return k.on("data",Z),(function(re,ie,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",oe),b.emit("pipe",k),x.flowing||(o("pipe resume"),k.resume()),b},L.prototype.unpipe=function(b){var v=this._readableState,k={hasUnpiped:!1};if(v.pipesCount===0)return this;if(v.pipesCount===1)return b&&b!==v.pipes||(b||(b=v.pipes),v.pipes=null,v.pipesCount=0,v.flowing=!1,b&&b.emit("unpipe",this,k)),this;if(!b){var x=v.pipes,R=v.pipesCount;v.pipes=null,v.pipesCount=0,v.flowing=!1;for(var D=0;D<R;D++)x[D].emit("unpipe",this,{hasUnpiped:!1});return this}var K=T(v.pipes,b);return K===-1||(v.pipes.splice(K,1),v.pipesCount-=1,v.pipesCount===1&&(v.pipes=v.pipes[0]),b.emit("unpipe",this,k)),this},L.prototype.on=function(b,v){var k=n.prototype.on.call(this,b,v),x=this._readableState;return b==="data"?(x.readableListening=this.listenerCount("readable")>0,x.flowing!==!1&&this.resume()):b==="readable"&&(x.endEmitted||x.readableListening||(x.readableListening=x.needReadable=!0,x.flowing=!1,x.emittedReadable=!1,o("on readable",x.length,x.reading),x.length?N(this):x.reading||Ee.nextTick(S,this))),k},L.prototype.addListener=L.prototype.on,L.prototype.removeListener=function(b,v){var k=n.prototype.removeListener.call(this,b,v);return b==="readable"&&Ee.nextTick(M,this),k},L.prototype.removeAllListeners=function(b){var v=n.prototype.removeAllListeners.apply(this,arguments);return b!=="readable"&&b!==void 0||Ee.nextTick(M,this),v},L.prototype.resume=function(){var b=this._readableState;return b.flowing||(o("resume"),b.flowing=!b.readableListening,(function(v,k){k.resumeScheduled||(k.resumeScheduled=!0,Ee.nextTick(I,v,k))})(this,b)),b.paused=!1,this},L.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(o("pause"),this._readableState.flowing=!1,this.emit
27("pause")),this._readableState.paused=!0,this},L.prototype.wrap=function(b){var v=this,k=this._readableState,x=!1;for(var R in b.on("end",(function(){if(o("wrapped end"),k.decoder&&!k.ended){var K=k.decoder.end();K&&K.length&&v.push(K)}v.push(null)})),b.on("data",(function(K){o("wrapped data"),k.decoder&&(K=k.decoder.write(K)),k.objectMode&&K==null||(k.objectMode||K&&K.length)&&(v.push(K)||(x=!0,b.pause()))})),b)this[R]===void 0&&typeof b[R]=="function"&&(this[R]=(function(K){return function(){return b[K].apply(b,arguments)}})(R));for(var D=0;D<_.length;D++)b.on(_[D],this.emit.bind(this,_[D]));return this._read=function(K){o("wrapped _read",K),x&&(x=!1,b.resume())},this},typeof Symbol=="function"&&(L.prototype[Symbol.asyncIterator]=function(){return a===void 0&&(a=yg()),a(this)}),Object.defineProperty(L.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(L.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(L.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(b){this._readableState&&(this._readableState.flowing=b)}}),L._fromList=y,Object.defineProperty(L.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),typeof Symbol=="function"&&(L.from=function(b,v){return l===void 0&&(l=ql?Fl:(ql=1,Fl=function(){throw new Error("Readable.from is not available in the browser")})),l(L,b,v)}),Ss}var sf=Wt,Ro=jn.codes,vg=Ro.ERR_METHOD_NOT_IMPLEMENTED,bg=Ro.ERR_MULTIPLE_CALLBACK,wg=Ro.ERR_TRANSFORM_ALREADY_TRANSFORMING,Eg=Ro.ERR_TRANSFORM_WITH_LENGTH_0,zi=cr();function _g(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(r===null)return this.emit("error",new bg);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:_g.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",Sg)}function Sg(){var t=this;typeof this._flush!="function"||this._readableState.destroyed?Vl(this,null,null):this._flush((function(e,n){Vl(t,e,n)}
27))}function Vl(t,e,n){if(e)return t.emit("error",e);if(n!=null&&t.push(n),t._writableState.length)throw new Eg;if(t._transformState.transforming)throw new wg;return t.push(null)}Xr(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 vg("_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 Cs,Cg=Hr,af=sf;function Hr(t){if(!(this instanceof Hr))return new Hr(t);af.call(this,t)}Xr(Hr,af),Hr.prototype._transform=function(t,e,n){n(null,t)};var cf=jn.codes,kg=cf.ERR_MISSING_ARGS,Ag=cf.ERR_STREAM_DESTROYED;function Wl(t){if(t)throw t}function Gl(t){t()}function xg(t,e){return t.pipe(e)}var Tg=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r,i=(function(c){return c.length?typeof c[c.length-1]!="function"?Wl:c.pop():Wl})(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new kg("streams");var o=e.map((function(c,s){var a=s<e.length-1;return(function(l,u,d,h){h=(function(g){var w=!1;return function(){w||(w=!0,g.apply(void 0,arguments))}})(h);var f=!1;l.on("close",(function(){f=!0})),Cs===void 0&&(Cs=Fa),Cs(l,{readable:u,writable:d},(function(g){if(g)return h(g);f=!0,h()}));var m=!1;return function(g){if(!f&&!m)return m=!0,(function(w){return w.setHeader&&typeof w.abort=="function"})(l)?l.abort():typeof l.destroy=="function"?l.destroy():void h(g||new Ag("pipe"))}})(c,a,s>0,(function(l){r||(r=l),l&&o.forEach(Gl),a||(o.forEach(Gl),i(r))}))}));return e.reduce(xg)};(function(t,e){(e=ra.exports=of()).Stream=e,e.Readable=e,e.Writable=rf(),e.Duplex=cr(),e.Transform=sf,e.PassThrough=Cg,e.finished=Fa,e.pipeline=Tg})(0,ra.exports);var lr=ra.exports;function Mg(t={}){const e={},n=new lr.Duplex({objectMode:!0,read:()=>{},write:function(o,c,s){let a=null;try{o.id?(function(l){const{id:u}=l;if(u===null)return;const d=e[u];if(!d)return void console.warn(`StreamMiddleware - Unknown response id "${u}"`);delete e[u],Object.assign(d.res,l),setTimeout(d.end)})(o):(function(l){t?.retryOnMessage&&l.method===t.retryOnMessage&&Object.values(e).forEach((({req:u,retryCount:d=0})=>{if(!u.id)return;if(d>=3)throw new Error(`StreamMiddleware - Retry limit exceeded for request id "${u.id}"`);const h=e[u.id];h&&(h.retryCount=d+1),i(u)})),r.emit("notification",l)})(o)}catch(l){a=l}s(a)}}),r=new Dh;return{events:r,middleware:(o,c,s,a)=>{e[o.id]={req:o,res:c,next:s,end:a},i(o)},stream:n};function i(o){n.push(o)}}var po={},oa={exports:{}},Rg=function t(e,n){if(e&&n)return t(e)(n);if(typeof e!="function")throw new TypeError("need wrapper function");return Object.keys(e).forEach((function(i){r[i]=e[i]})),r;function r(){for(var i=new Array(arguments.length),o=0;o<i.length;o++)i[o]=arguments[o];var c=e.apply(this,i),s=i[i.length-1];return typeof c=="function"&&c!==s&&Object.keys(s).forEach((function(a){c[a]=s[a]})),c}},Yl=Rg;function Si(t){var e=function(){return e.called?e.value:(e.called=!0,e.value=t.apply(this,arguments))};return e.called=!1,e}function Zl(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}oa.exports=Yl(Si),oa.exports.strict=Yl(Zl),Si.proto=Si((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return Si(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return Zl(this)},configurable:!0})}));var Og=oa.exports,mo={};Object.defineProperty(mo,"__esModule",{value:!0}),mo.Substream=void 0;const Pg=lr;class Ig extends Pg.Duplex{constructor({parent:e,name:n}
27){super({objectMode:!0}),this._parent=e,this._name=n}_read(){}_write(e,n,r){this._parent.push({name:this._name,data:e}),r()}}mo.Substream=Ig;var Lg=bt&&bt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(po,"__esModule",{value:!0}),po.ObjectMultiplex=void 0;const ks=lr,Ng=Lg(Og),Dg=mo,Jl=Symbol("IGNORE_SUBSTREAM");let Bg=class extends ks.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 Dg.Substream({parent:this,name:t});return this._substreams[t]=e,(function(n,r){const i=(0,Ng.default)(r);(0,ks.finished)(n,{readable:!1},i),(0,ks.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]=Jl}_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!==Jl&&o.push(i),n()):(console.warn(`ObjectMultiplex - orphaned data for stream "${r}"`),n())}};po.ObjectMultiplex=Bg;var $g=ko(po.ObjectMultiplex);const Tt=t=>t!==null&&typeof t=="object"&&typeof t.pipe=="function";Tt.writable=t=>Tt(t)&&t.writable!==!1&&typeof t._write=="function"&&typeof t._writableState=="object",Tt.readable=t=>Tt(t)&&t.readable!==!1&&typeof t._read=="function"&&typeof t._readableState=="object",Tt.duplex=t=>Tt.writable(t)&&Tt.readable(t),Tt.transform=t=>Tt.duplex(t)&&typeof t._transform=="function";var Mt,Kg=Tt,jg=class extends tg{constructor(t,{jsonRpcStreamName:e,logger:n=console,maxEventListeners:r=100,rpcMiddleware:i=[]}){if(super({logger:n,maxEventListeners:r,rpcMiddleware:i}),!Kg.duplex(t))throw new Error(Me.errors.invalidDuplexStream());this._handleStreamDisconnect=this._handleStreamDisconnect.bind(this);const o=new $g;lr.pipeline(t,o,t,this._handleStreamDisconnect.bind(this,"MetaMask")),this._jsonRpcConnection=Mg({retryOnMessage:"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",(c=>{const{method:s,params:a}=c;s==="metamask_accountsChanged"?this._handleAccountsChanged(a):s==="metamask_unlockStateChanged"?this._handleUnlockStateChanged(a):s==="metamask_chainChanged"?this._handleChainChanged(a):Bh.includes(s)?this.emit("message",{type:s,data:a}):s==="METAMASK_STREAM_FAILURE"&&t.destroy(new Error(Me.errors.permanentlyDisconnected()))}))}async _initializeStateAsync(){let t;try{t=await this.request({method:"metamask_getProviderState"})}catch(e){this._log.error("MetaMask: Failed to get initial state. Please report this bug.",e)}this._initializeState(t)}_handleStreamDisconnect(t,e){let n=`MetaMask: Lost connection to "${t}".`;e?.stack&&(n+=`
28${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}={}){$h(t)&&(n=>!!n&&typeof n=="string")(e)?e==="loading"?this._handleDisconnect(!0):super._handleChainChanged({chainId:t}):this._log.error(Me.errors.invalidNetworkParams(),{chainId:t,networkVersion:e})}},Ug=class extends jg{constructor(t,{jsonRpcStreamName:e="metamask-provider",logger:n=console,maxEventListeners:r=100,shouldSendMetadata:i}={}){if(super(t,{jsonRpcStreamName:e,logger:n,maxEventListeners:r,rpcMiddleware:Wm(n)}),this._sentWarnings={chainId:!1,networkVersion:!1,selectedAddress:!1,enable:!1,experimentalMethods:!1,send:!1,events:{close:!1,data:!1,networkChanged:!1,notification:!1}},na(this,Mt,void 0),this._initializeStateAsync(),Vt(this,Mt,null),this.isMetaMask=!0,this._sendSync=this._sendSync.bind(this),this.enable=this.enable.bind(this),this.send=this.send.bind(this),this.sendAsync=this.sendAsync.bind(this),this._warnOfDeprecation=this._warnOfDeprecation.bind(this),this._metamask=this._getExperimentalApi(),this._jsonRpcConnection.events.on("notification",(o=>{const{method:c}=o;
28Bh.includes(c)&&(this.emit("data",o),this.emit("notification",o.params.result))})),i)if(document.readyState==="complete")Il(this._rpcEngine,this._log);else{const o=()=>{Il(this._rpcEngine,this._log),window.removeEventListener("DOMContentLoaded",o)};window.addEventListener("DOMContentLoaded",o)}}get chainId(){return this._sentWarnings.chainId||(this._log.warn(Me.warnings.chainIdDeprecation),this._sentWarnings.chainId=!0),super.chainId}get networkVersion(){return this._sentWarnings.networkVersion||(this._log.warn(Me.warnings.networkVersionDeprecation),this._sentWarnings.networkVersion=!0),It(this,Mt)}get selectedAddress(){return this._sentWarnings.selectedAddress||(this._log.warn(Me.warnings.selectedAddressDeprecation),this._sentWarnings.selectedAddress=!0),super.selectedAddress}sendAsync(t,e){this._rpcRequest(t,e)}addListener(t,e){return this._warnOfDeprecation(t),super.addListener(t,e)}on(t,e){return this._warnOfDeprecation(t),super.on(t,e)}once(t,e){return this._warnOfDeprecation(t),super.once(t,e)}prependListener(t,e){return this._warnOfDeprecation(t),super.prependListener(t,e)}prependOnceListener(t,e){return this._warnOfDeprecation(t),super.prependOnceListener(t,e)}_handleDisconnect(t,e){super._handleDisconnect(t,e),It(this,Mt)&&!t&&Vt(this,Mt,null)}_warnOfDeprecation(t){this._sentWarnings?.events[t]===!1&&(this._log.warn(Me.warnings.events[t]),this._sentWarnings.events[t]=!0)}async enable(){return this._sentWarnings.enable||(this._log.warn(Me.warnings.enableDeprecation),this._sentWarnings.enable=!0),new Promise(((t,e)=>{try{this._rpcRequest({method:"eth_requestAccounts",params:[]},Hi(t,e))}catch(n){e(n)}}))}send(t,e){return this._sentWarnings.send||(this._log.warn(Me.warnings.sendDeprecation),this._sentWarnings.send=!0),typeof t!="string"||e&&!Array.isArray(e)?t&&typeof t=="object"&&typeof e=="function"?this._rpcRequest(t,e):this._sendSync(t):new Promise(((n,r)=>{try{this._rpcRequest({method:t,params:e},Hi(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,Kh),e=!0;break;case"net_version":e=It(this,Mt)??null;break;default:throw new Error(Me.errors.unsupportedSync(t.method))}return{id:t.id,jsonrpc:t.jsonrpc,result:e}}_getExperimentalApi(){return new Proxy({isUnlocked:async()=>(this._state.initialized||await new Promise((t=>{this.on("_initialized",(()=>t()))})),this._state.isUnlocked),requestBatch:async t=>{if(!Array.isArray(t))throw xr({message:"Batch requests must be made with an array of request objects.",data:t});return new Promise(((e,n)=>{this._rpcRequest(t,Hi(e,n))}))}},{get:(t,e,...n)=>(this._sentWarnings.experimentalMethods||(this._log.warn(Me.warnings.experimentalMethods),this._sentWarnings.experimentalMethods=!0),Reflect.get(t,e,...n))})}_handleChainChanged({chainId:t,networkVersion:e}={}){super._handleChainChanged({chainId:t,networkVersion:e}),this._state.isConnected&&e!==It(this,Mt)&&(Vt(this,Mt,e),this._state.initialized&&this.emit("networkChanged",It(this,Mt)))}};Mt=new WeakMap;const G=Je("MM_SDK");let Xl;G.color="#FFAC1C";var lf={},_n={};Object.defineProperty(_n,"__esModule",{value:!0}),_n.EthereumProviderError=_n.EthereumRpcError=void 0;const Hg=Rh;class uf 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 Hg.default(this.serialize(),Fg,2)}}_n.EthereumRpcError=uf;function Fg(t,e){if(e!=="[Circular]")return e}_n.EthereumProviderError=class extends uf{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 qa={},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."}}
28,(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:c(r)};function c(d,h=i){if(Number.isInteger(d)){const f=d.toString();if(u(e.errorValues,f))return e.errorValues[f].message;if(a(d))return t.JSON_RPC_SERVER_ERROR_MESSAGE}return h}function s(d){if(!Number.isInteger(d))return!1;const h=d.toString();return!!e.errorValues[h]||!!a(d)}function a(d){return d>=-32099&&d<=-32e3}function l(d){return d&&typeof d=="object"&&!Array.isArray(d)?Object.assign({},d):d}function u(d,h){return Object.prototype.hasOwnProperty.call(d,h)}t.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.",t.getMessageFromCode=c,t.isValidCode=s,t.serializeError=function(d,{fallbackError:h=o,shouldIncludeStack:f=!1}={}){var m,g;if(!h||!Number.isInteger(h.code)||typeof h.message!="string")throw new Error("Must provide fallback error with integer number code and string message.");if(d instanceof n.EthereumRpcError)return d.serialize();const w={};if(d&&typeof d=="object"&&!Array.isArray(d)&&u(d,"code")&&s(d.code)){const C=d;w.code=C.code,C.message&&typeof C.message=="string"?(w.message=C.message,u(C,"data")&&(w.data=C.data)):(w.message=c(w.code),w.data={originalError:l(d)})}else{w.code=h.code;const C=(m=d)===null||m===void 0?void 0:m.message;w.message=C&&typeof C=="string"?C:h.message,w.data={originalError:l(d)}}const p=(g=d)===null||g===void 0?void 0:g.stack;return f&&d&&p&&typeof p=="string"&&(w.stack=p),w}})(qa);var go={};Object.defineProperty(go,"__esModule",{value:!0}),go.ethErrors=void 0;const za=_n,df=qa,He=mn;function ht(t,e){const[n,r]=hf(e);
28return new za.EthereumRpcError(t,n||df.getMessageFromCode(t),r)}function br(t,e){const[n,r]=hf(e);return new za.EthereumProviderError(t,n||df.getMessageFromCode(t),r)}function hf(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:n}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,n]}}return[]}go.ethErrors={rpc:{parse:t=>ht(He.errorCodes.rpc.parse,t),invalidRequest:t=>ht(He.errorCodes.rpc.invalidRequest,t),invalidParams:t=>ht(He.errorCodes.rpc.invalidParams,t),methodNotFound:t=>ht(He.errorCodes.rpc.methodNotFound,t),internal:t=>ht(He.errorCodes.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return ht(e,t)},invalidInput:t=>ht(He.errorCodes.rpc.invalidInput,t),resourceNotFound:t=>ht(He.errorCodes.rpc.resourceNotFound,t),resourceUnavailable:t=>ht(He.errorCodes.rpc.resourceUnavailable,t),transactionRejected:t=>ht(He.errorCodes.rpc.transactionRejected,t),methodNotSupported:t=>ht(He.errorCodes.rpc.methodNotSupported,t),limitExceeded:t=>ht(He.errorCodes.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>br(He.errorCodes.provider.userRejectedRequest,t),unauthorized:t=>br(He.errorCodes.provider.unauthorized,t),unsupportedMethod:t=>br(He.errorCodes.provider.unsupportedMethod,t),disconnected:t=>br(He.errorCodes.provider.disconnected,t),chainDisconnected:t=>br(He.errorCodes.provider.chainDisconnected,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:n,data:r}=t;if(!n||typeof n!="string")throw new Error('"message" must be a nonempty string');return new za.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=qa;Object.defineProperty(t,"serializeError",{enumerable:!0,get:function(){return n.serializeError}}),Object.defineProperty(t,"getMessageFromCode",{enumerable:!0,get:function(){return n.getMessageFromCode}});const r=go;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}})})(lf);var ff={exports:{}};ff.exports=(function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(r,i,o){n.o(r,i)||Object.defineProperty(r,i,{enumerable:!0,get:o})},n.r=function(r){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},n.t=function(r,i){if(1&i&&(r=n(r)),8&i||4&i&&typeof r=="object"&&r&&r.__esModule)return r;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:r}),2&i&&typeof r!="string")for(var c in r)n.d(o,c,(function(s){return r[s]}).bind(null,c));return o},n.n=function(r){var i=r&&r.__esModule?function(){return r.default}:function(){return r};return n.d(i,"a",i),i},n.o=function(r,i){return Object.prototype.hasOwnProperty.call(r,i)},n.p="",n(n.s=90)})({17:function(t,e,n){e.__esModule=!0,e.default=void 0;var r=n(18),i=(function(){function o(){}return o.getFirstMatch=function(c,s){var a=s.match(c);return a&&a.length>0&&a[1]||""},o.getSecondMatch=function(c,s){var a=s.match(c);return a&&a.length>1&&a[2]||""},o.matchAndReturnConst=function(c,s,a){if(c.test(s))return a},o.getWindowsVersionName=function(c){switch(c){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},o.getMacOSVersionName=function(c){var s=c.split(".").splice(0,2).map((function(a){return parseInt(a,10)||0}));if(s.push(0),s[0]===10)switch(s[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";
28case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},o.getAndroidVersionName=function(c){var s=c.split(".").splice(0,2).map((function(a){return parseInt(a,10)||0}));if(s.push(0),!(s[0]===1&&s[1]<5))return s[0]===1&&s[1]<6?"Cupcake":s[0]===1&&s[1]>=6?"Donut":s[0]===2&&s[1]<2?"Eclair":s[0]===2&&s[1]===2?"Froyo":s[0]===2&&s[1]>2?"Gingerbread":s[0]===3?"Honeycomb":s[0]===4&&s[1]<1?"Ice Cream Sandwich":s[0]===4&&s[1]<4?"Jelly Bean":s[0]===4&&s[1]>=4?"KitKat":s[0]===5?"Lollipop":s[0]===6?"Marshmallow":s[0]===7?"Nougat":s[0]===8?"Oreo":s[0]===9?"Pie":void 0},o.getVersionPrecision=function(c){return c.split(".").length},o.compareVersions=function(c,s,a){a===void 0&&(a=!1);var l=o.getVersionPrecision(c),u=o.getVersionPrecision(s),d=Math.max(l,u),h=0,f=o.map([c,s],(function(m){var g=d-o.getVersionPrecision(m),w=m+new Array(g+1).join(".0");return o.map(w.split("."),(function(p){return new Array(20-p.length).join("0")+p})).reverse()}));for(a&&(h=d-Math.min(l,u)),d-=1;d>=h;){if(f[0][d]>f[1][d])return 1;if(f[0][d]===f[1][d]){if(d===h)return 0;d-=1}else if(f[0][d]<f[1][d])return-1}},o.map=function(c,s){var a,l=[];if(Array.prototype.map)return Array.prototype.map.call(c,s);for(a=0;a<c.length;a+=1)l.push(s(c[a]));return l},o.find=function(c,s){var a,l;if(Array.prototype.find)return Array.prototype.find.call(c,s);for(a=0,l=c.length;a<l;a+=1){var u=c[a];if(s(u,a))return u}},o.assign=function(c){for(var s,a,l=c,u=arguments.length,d=new Array(u>1?u-1:0),h=1;h<u;h++)d[h-1]=arguments[h];if(Object.assign)return Object.assign.apply(Object,[c].concat(d));var f=function(){var m=d[s];typeof m=="object"&&m!==null&&Object.keys(m).forEach((function(g){l[g]=m[g]}))};for(s=0,a=d.length;s<a;s+=1)f();return c},o.getBrowserAlias=function(c){return r.BROWSER_ALIASES_MAP[c]},o.getBrowserTypeByAlias=function(c){return r.BROWSER_MAP[c]||""},o})();e.default=i,t.exports=e.default},18:function(t,e,n){e.__esModule=!0,e.ENGINE_MAP=e.OS_MAP=e.PLATFORMS_MAP=e.BROWSER_MAP=e.BROWSER_ALIASES_MAP=void 0,e.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},e.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},e.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},e.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},e.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}}
28,90:function(t,e,n){e.__esModule=!0,e.default=void 0;var r,i=(r=n(91))&&r.__esModule?r:{default:r},o=n(18);function c(a,l){for(var u=0;u<l.length;u++){var d=l[u];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}var s=(function(){function a(){}var l,u,d;return a.getParser=function(h,f){if(f===void 0&&(f=!1),typeof h!="string")throw new Error("UserAgent should be a string");return new i.default(h,f)},a.parse=function(h){return new i.default(h).getResult()},l=a,d=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}],(u=null)&&c(l.prototype,u),d&&c(l,d),a})();e.default=s,t.exports=e.default},91:function(t,e,n){e.__esModule=!0,e.default=void 0;var r=a(n(92)),i=a(n(93)),o=a(n(94)),c=a(n(95)),s=a(n(17));function a(u){return u&&u.__esModule?u:{default:u}}var l=(function(){function u(h,f){if(f===void 0&&(f=!1),h==null||h==="")throw new Error("UserAgent parameter can't be empty");this._ua=h,this.parsedResult={},f!==!0&&this.parse()}var d=u.prototype;return d.getUA=function(){return this._ua},d.test=function(h){return h.test(this._ua)},d.parseBrowser=function(){var h=this;this.parsedResult.browser={};var f=s.default.find(r.default,(function(m){if(typeof m.test=="function")return m.test(h);if(m.test instanceof Array)return m.test.some((function(g){return h.test(g)}));throw new Error("Browser's test function is not valid")}));return f&&(this.parsedResult.browser=f.describe(this.getUA())),this.parsedResult.browser},d.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},d.getBrowserName=function(h){return h?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},d.getBrowserVersion=function(){return this.getBrowser().version},d.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},d.parseOS=function(){var h=this;this.parsedResult.os={};var f=s.default.find(i.default,(function(m){if(typeof m.test=="function")return m.test(h);if(m.test instanceof Array)return m.test.some((function(g){return h.test(g)}));throw new Error("Browser's test function is not valid")}));return f&&(this.parsedResult.os=f.describe(this.getUA())),this.parsedResult.os},d.getOSName=function(h){var f=this.getOS().name;return h?String(f).toLowerCase()||"":f||""},d.getOSVersion=function(){return this.getOS().version},d.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},d.getPlatformType=function(h){h===void 0&&(h=!1);var f=this.getPlatform().type;return h?String(f).toLowerCase()||"":f||""},d.parsePlatform=function(){var h=this;this.parsedResult.platform={};var f=s.default.find(o.default,(function(m){if(typeof m.test=="function")return m.test(h);if(m.test instanceof Array)return m.test.some((function(g){return h.test(g)}));throw new Error("Browser's test function is not valid")}));return f&&(this.parsedResult.platform=f.describe(this.getUA())),this.parsedResult.platform},d.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},d.getEngineName=function(h){return h?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},d.parseEngine=function(){var h=this;this.parsedResult.engine={};var f=s.default.find(c.default,(function(m){if(typeof m.test=="function")return m.test(h);if(m.test instanceof Array)return m.test.some((function(g){return h.test(g)}));throw new Error("Browser's test function is not valid")}));return f&&(this.parsedResult.engine=f.describe(this.getUA())),this.parsedResult.engine},d.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},d.getResult=function(){return s.default.assign({},this.parsedResult)},d.satisfies=function(h){var f=this,m={},g=0,w={},p=0;if(Object.keys(h).forEach((function(B){var N=h[B];typeof N=="string"?(w[B]=N,p+=1):typeof N=="object"&&(m[B]=N,g+=1)})),g>0){var C=Object.keys(m),_=s.default.find(C,(function(B){return f.isOS(B)}));if(_){var O=this.satisfies(m[_]);if(O!==void 0)return O}var L=s.default.find(C,(function(B){return f.isPlatform(B)}));if(L){var U=this.satisfies(m[L]);if(U!==void 0)return U}}if(p>0){var q=Object.keys(w),F=s.default.find(q,(function(B){return f.isBrowser(B,!0)}));if(F!==void 0)return this.compareVersion(w[F])}},d.isBrowser=function(h,f){f===void 0&&(f=!1);var m=this.getBrowserName().toLowerCase(),g=h.toLowerCase(),w=s.default.getBrowserTypeByAlias(g);return f&&w&&(g=w.toLowerCase()),g===m},d.compareVersion=function(h){var f=[0],m=h,g=!1,w=this.getBrowserVersion();if(typeof w=="string")return h[0]===">"||h[0]==="<"?(m=h.substr(1),h[1]==="="?(g=!0,m=h.substr(2)):f=[],h[0]===">"?f.push(1):f.push(-1)):h[0]==="="?m=h.substr(1):h[0]==="~"&&(g=!0,m=h.substr(1)),f.indexOf(s.default.compareVersions(w,m,g))>-1},d.isOS=function(h){return this.getOSName(!0)===String(h).toLowerCase()},d.isPlatform=function(h){return this.getPlatformType(!0)===String(h).toLowerCase()},d.isEngine=function(h){return this.getEngineName(!0)===String(h).toLowerCase()},d.is=function(h,f){return f===void 0&&(f=!1),this.isBrowser(h,f)||this.isOS(h)||this.isPlatform(h)},d.some=function(h){var f=this;return h===void 0&&(h=[]),h.some((function(m){return f.is(m)}))},u})();e.default=l,t.exports=e.default}
vendor: 13,045 bytes, line 28
28,92:function(t,e,n){e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=/version\/(\d+(\.?_?\d+)+)/i,c=[{test:[/googlebot/i],describe:function(s){var a={name:"Googlebot"},l=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/opera/i],describe:function(s){var a={name:"Opera"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/opr\/|opios/i],describe:function(s){var a={name:"Opera"},l=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/SamsungBrowser/i],describe:function(s){var a={name:"Samsung Internet for Android"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/Whale/i],describe:function(s){var a={name:"NAVER Whale Browser"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/MZBrowser/i],describe:function(s){var a={name:"MZ Browser"},l=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/focus/i],describe:function(s){var a={name:"Focus"},l=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/swing/i],describe:function(s){var a={name:"Swing"},l=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/coast/i],describe:function(s){var a={name:"Opera Coast"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(s){var a={name:"Opera Touch"},l=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/yabrowser/i],describe:function(s){var a={name:"Yandex Browser"},l=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/ucbrowser/i],describe:function(s){var a={name:"UC Browser"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/Maxthon|mxios/i],describe:function(s){var a={name:"Maxthon"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/epiphany/i],describe:function(s){var a={name:"Epiphany"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/puffin/i],describe:function(s){var a={name:"Puffin"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/sleipnir/i],describe:function(s){var a={name:"Sleipnir"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/k-meleon/i],describe:function(s){var a={name:"K-Meleon"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/micromessenger/i],describe:function(s){var a={name:"WeChat"},l=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/qqbrowser/i],describe:function(s){var a={name:/qqbrowserlite/i.test(s)?"QQ Browser Lite":"QQ Browser"},l=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/msie|trident/i],describe:function(s){var a={name:"Internet Explorer"},l=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/\sedg\//i],describe:function(s){var a={name:"Microsoft Edge"},l=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/edg([ea]|ios)/i],describe:function(s){var a={name:"Microsoft Edge"},l=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/vivaldi/i],describe:function(s){var a={name:"Vivaldi"},l=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/seamonkey/i],describe:function(s){var a={name:"SeaMonkey"},l=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/sailfish/i],describe:function(s){var a={name:"Sailfish"},l=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,s);return l&&(a.version=l),a}},{test:[/silk/i],describe:function(s){var a={name:"Amazon Silk"},l=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/phantom/i],describe:function(s){var a={name:"PhantomJS"},l=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/slimerjs/i],describe:function(s){var a={name:"SlimerJS"},l=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(s){var a={name:"BlackBerry"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/(web|hpw)[o0]s/i],describe:function(s){var a={name:"WebOS Browser"},l=i.default.getFirstMatch(o,s)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/bada/i],describe:function(s){var a={name:"Bada"},l=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/tizen/i],describe:function(s){var a={name:"Tizen"},l=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/qupzilla/i],describe:function(s){var a={name:"QupZilla"},l=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/firefox|iceweasel|fxios/i],describe:function(s){var a={name:"Firefox"},l=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/electron/i],describe:function(s){var a={name:"Electron"},l=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/MiuiBrowser/i],describe:function(s){var a={name:"Miui"},l=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/chromium/i],describe:function(s){var a={name:"Chromium"},l=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,s)||i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/chrome|crios|crmo/i],describe:function(s){var a={name:"Chrome"},l=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/GSA/i],describe:function(s){var a={name:"Google Search"},l=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:function(s){var a=!s.test(/like android/i),l=s.test(/android/i);return a&&l},describe:function(s){var a={name:"Android Browser"},l=i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/playstation 4/i],describe:function(s){var a={name:"PlayStation 4"},l=i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/safari|applewebkit/i],describe:function(s){var a={name:"Safari"},l=i.default.getFirstMatch(o,s);return l&&(a.version=l),a}},{test:[/.*/i],describe:function(s){var a=s.search("\\(")!==-1?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(a,s),version:i.default.getSecondMatch(a,s)}}}];e.default=c,t.exports=e.default},93:function(t,e,n){e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),c=[{test:[/Roku\/DVP/],describe:function(s){var a=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,s);return{name:o.OS_MAP.Roku,version:a}}},{test:[/windows phone/i],describe:function(s){var a=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,s);return{name:o.OS_MAP.WindowsPhone,version:a}}},{test:[/windows /i],describe:function(s){var a=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,s),l=i.default.getWindowsVersionName(a);return{name:o.OS_MAP.Windows,version:a,versionName:l}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(s){var a={name:o.OS_MAP.iOS},l=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,s);return l&&(a.version=l),a}},{test:[/macintosh/i],describe:function(s){var a=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,s).replace(/[_\s]/g,"."),l=i.default.getMacOSVersionName(a),u={name:o.OS_MAP.MacOS,version:a};return l&&(u.versionName=l),u}},{test:[/(ipod|iphone|ipad)/i],describe:function(s){var a=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,s).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:a}}},{test:function(s){var a=!s.test(/like android/i),l=s.test(/android/i);return a&&l},describe:function(s){var a=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,s),l=i.default.getAndroidVersionName(a),u={name:o.OS_MAP.Android,version:a};return l&&(u.versionName=l),u}},{test:[/(web|hpw)[o0]s/i],describe:function(s){var a=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,s),l={name:o.OS_MAP.WebOS};return a&&a.length&&(l.version=a),l}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(s){var a=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,s)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,s)||i.default.getFirstMatch(/\bbb(\d+)/i,s);return{name:o.OS_MAP.BlackBerry,version:a}}},{test:[/bada/i],describe:function(s){var a=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,s);return{name:o.OS_MAP.Bada,version:a}}},{test:[/tizen/i],describe:function(s){var a=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,s);return{name:o.OS_MAP.Tizen,version:a}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(s){var a=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,s);return{name:o.OS_MAP.PlayStation4,version:a}}}];e.default=c,t.exports=e.default},94:function(t,e,n){e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),c=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(s){var a=i.default.getFirstMatch(/(can-l01)/i,s)&&"Nova",l={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return a&&(l.model=a),l}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(s){var a=s.test(/ipod|iphone/i),l=s.test(/like (ipod|iphone)/i);return a&&!l},describe:function(s){var a=i.default.getFirstMatch(/(ipod|iphone)/i,s);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:a}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getBrowserName(!0)==="blackberry"},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(s){return s.getBrowserName(!0)==="bada"},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getBrowserName()==="windows phone"},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(s){var a=Number(String(s.getOSVersion()).split(".")[0]);return s.getOSName(!0)==="android"&&a>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(s){return s.getOSName(!0)==="android"},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getOSName(!0)==="macos"},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(s){return s.getOSName(!0)==="windows"},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(s){return s.getOSName(!0)==="linux"},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(s){return s.getOSName(!0)==="playstation 4"},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(s){return s.getOSName(!0)==="roku"},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];e.default=c,t.exports=e.default}
28,95:function(t,e,n){e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),c=[{test:function(s){return s.getBrowserName(!0)==="microsoft edge"},describe:function(s){if(/\sedg\//i.test(s))return{name:o.ENGINE_MAP.Blink};var a=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,s);return{name:o.ENGINE_MAP.EdgeHTML,version:a}}},{test:[/trident/i],describe:function(s){var a={name:o.ENGINE_MAP.Trident},l=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:function(s){return s.test(/presto/i)},describe:function(s){var a={name:o.ENGINE_MAP.Presto},l=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:function(s){var a=s.test(/gecko/i),l=s.test(/like gecko/i);return a&&!l},describe:function(s){var a={name:o.ENGINE_MAP.Gecko},l=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(s){var a={name:o.ENGINE_MAP.WebKit},l=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,s);return l&&(a.version=l),a}}];e.default=c,t.exports=e.default}});var pf=ko(ff.exports);const nt={Initialized:"initialized",DisplayURI:"display_uri",ProviderUpdate:"provider_update",ConnectWithResponse:"connectWithResponse",ConnectionStatus:"connection_status",ServiceStatus:"service_status"};class kt{constructor({shouldSetOnWindow:e,connectionStream:n,shouldSendMetadata:r=!1,shouldShimWeb3:i,sdkInstance:o}){const c=new qg({connectionStream:n,shouldSendMetadata:r,shouldSetOnWindow:e,shouldShimWeb3:i,autoRequestAccounts:!1}),s=new Proxy(c,{deleteProperty:()=>!0});if(this.provider=s,this.sdkInstance=o,e&&typeof window<"u")try{a=c,window.ethereum=a,window.dispatchEvent(new Event("ethereum#initialized"))}catch(l){G("[Ethereum] Unable to set global provider - window.ethereum may be read-only",l)}var a;if(i&&typeof window<"u")try{(function(l,u=console){let d=!1,h=!1;if(!window.web3){const f="__isMetaMaskShim__";let m={currentProvider:l};Object.defineProperty(m,f,{value:!0,enumerable:!0,configurable:!1,writable:!1}),m=new Proxy(m,{get:(g,w,...p)=>(w!=="currentProvider"||d?w==="currentProvider"||w===f||h||(h=!0,u.error("MetaMask no longer injects web3. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3"),l.request({method:"metamask_logWeb3ShimUsage"}).catch((C=>{u.debug("MetaMask: Failed to log web3 shim usage.",C)}))):(d=!0,u.warn("You are accessing the MetaMask window.web3.currentProvider shim. This property is deprecated; use window.ethereum instead. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3")),Reflect.get(g,w,...p)),set:(...g)=>(u.warn("You are accessing the MetaMask window.web3 shim. This object is deprecated; use window.ethereum instead. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3"),Reflect.set(...g))}),Object.defineProperty(window,"web3",{value:m,enumerable:!1,configurable:!0,writable:!0})}})(this.provider)}catch(l){G("[Ethereum] Unable to shim web3 - window.web3 may be read-only",l)}this.provider.on("display_uri",(l=>{this.sdkInstance.emit(nt.DisplayURI,l)})),this.provider.on("_initialized",(()=>{const l={chainId:this.provider.getChainId(),isConnected:this.provider.isConnected(),isMetaMask:this.provider.isMetaMask,selectedAddress:this.provider.getSelectedAddress(),networkVersion:this.provider.getNetworkVersion()};this.sdkInstance.emit(nt.Initialized,l),G("[Ethereum: constructor()] provider initialized",l)}))}static init(e){var n;return G("[Ethereum: init()] Initializing Ethereum service"),this.instance=new kt(e),(n=this.instance)===null||n===void 0?void 0:n.provider}static destroy(){}static getInstance(){var e;if(!(!((e=this.instance)===null||e===void 0)&&e.provider))throw new Error("Ethereum instance not intiialized - call Ethereum.factory first.");return this.instance}static getProvider(){var e;if(!(!((e=this.instance)===null||e===void 0)&&e.provider))throw new Error("Ethereum instance not intiialized - call Ethereum.factory first.");return this.instance.provider}}class 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,c,s){const{state:a}=i;G(`[PlatfformManager: openDeeplink()] universalLink --> ${o}`),G(`[PlatfformManager: openDeeplink()] deepLink --> ${c}`);try{if(a.preferredOpenLink)return void a.preferredOpenLink(a.useDeeplink?c:o,s);if(G(`[PlatfformManager: openDeeplink()] open link now useDeepLink=${a.useDeeplink} link=${a.useDeeplink?c:o}`),a.useDeeplink)typeof window<"u"&&(window.location.href=c);else if(typeof document<"u"){const l=document.createElement("a");l.href=o,l.target="_self",l.rel="noreferrer noopener",l.click()}}catch(l){console.log("[PlatfformManager: openDeeplink()] can't open link",l)}})(this,e,n,r)}isReactNative(){var e;return this.isNotBrowser()&&typeof window<"u"&&window?.navigator&&((e=window.navigator)===null||e===void 0?void 0:e.product)==="ReactNative"}isMetaMaskInstalled(){return(function(){const e=kt.getProvider()||window?.ethereum;return G(`[PlatfformManager: isMetaMaskInstalled()] isMetaMask=${e?.isMetaMask} isConnected=${e?.isConnected()}`),e?.isMetaMask&&e?.isConnected()})()}isDesktopWeb(){return this.isBrowser()&&!this.isMobileWeb()}isMobile(){var e,n;const r=pf.parse(window.navigator.userAgent);return((e=r?.platform)===null||e===void 0?void 0:e.type)==="mobile"||((n=r?.platform)===null||n===void 0?void 0:n.type)==="tablet"}isSecure(){return this.isReactNative()||this.isMobileWeb()}isMetaMaskMobileWebView(){return typeof window<"u"&&!!window.ReactNativeWebView&&!!navigator.userAgent.endsWith("MetaMaskMobile")}isMobileWeb(){return this.state.platformType===Ve.MobileWeb}static isNotBrowser(){var e;return typeof window>"u"||!window?.navigator||Xe!==void 0&&((e=Xe?.navigator)===null||e===void 0?void 0:e.product)==="ReactNative"||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()?Ve.ReactNative:e.isNotBrowser()?Ve.NonBrowser:e.isMetaMaskMobileWebView()?Ve.MetaMaskMobileWebview:e.isMobile()?Ve.MobileWeb:Ve.DesktopWeb})(this)}}const mf=t=>J(void 0,void 0,void 0,(function*(){if(Fr.isBrowser()){const{StorageManagerWeb:n}=yield Promise.resolve().then((function(){return vy}));return new n(t)}const e={persistChannelConfig:()=>J(void 0,void 0,void 0,(function*(){})),getPersistedChannelConfig:()=>J(void 0,void 0,void 0,(function*(){})),persistAccounts:()=>J(void 0,void 0,void 0,(function*(){})),getCachedAccounts:()=>J(void 0,void 0,void 0,(function*(){return[]}
28)),persistChainId:()=>J(void 0,void 0,void 0,(function*(){})),getCachedChainId:()=>J(void 0,void 0,void 0,(function*(){})),terminate:()=>J(void 0,void 0,void 0,(function*(){}))};return Promise.resolve(e)}));class qg extends Ug{constructor({connectionStream:e,shouldSendMetadata:n,autoRequestAccounts:r=!1}){super(e,{logger:console,maxEventListeners:100,shouldSendMetadata:n}),this.state={accounts:null,autoRequestAccounts:!1,providerStateRequested:!1,chainId:"",networkVersion:""},G(`[SDKProvider: constructor()] autoRequestAccounts=${r}`),this.state.autoRequestAccounts=r}forceInitializeState(){return J(this,void 0,void 0,(function*(){return G(`[SDKProvider: forceInitializeState()] autoRequestAccounts=${this.state.autoRequestAccounts}`),this._initializeStateAsync()}))}_setConnected(){G("[SDKProvider: _setConnected()] Setting connected state"),this._state.isConnected=!0}getState(){return this._state}getSDKProviderState(){return this.state}getSelectedAddress(){var e;const{accounts:n}=this._state;return n&&n.length!==0?((e=n[0])===null||e===void 0?void 0:e.toLowerCase())||"":(G("[SDKProvider: getSelectedAddress] No accounts found"),null)}getChainId(){return this.state.chainId}getNetworkVersion(){return this.state.networkVersion}setSDKProviderState(e){this.state=Object.assign(Object.assign({},this.state),e)}handleAccountsChanged(e,n){return this._handleAccountsChanged(e,n)}handleDisconnect({terminate:e=!1}){(function({terminate:n=!1,instance:r}){const{state:i}=r;G(`[SDKProvider: handleDisconnect()] cleaning up provider state terminate=${n}`,r),n&&(r._state.accounts=null,r._state.isUnlocked=!1,r._state.isPermanentlyDisconnected=!0,r._state.initialized=!1),r._handleAccountsChanged([]),r._state.isConnected=!1,r.emit("disconnect",lf.ethErrors.provider.disconnected()),i.providerStateRequested=!1})({terminate:e,instance:this})}_initializeStateAsync(){return J(this,void 0,void 0,(function*(){return(function(e){var n,r;return J(this,void 0,void 0,(function*(){e.state===void 0&&(e.state={accounts:null,autoRequestAccounts:!1,providerStateRequested:!1,chainId:""});const{state:i}=e;let o;if(i.providerStateRequested)G("[SDKProvider: initializeStateAsync()] initialization already in progress");else{let c;i.providerStateRequested=!0;let s=null,a=!1,l=!1;const u=yield mf({enabled:!0});if(u){const d=yield u.getPersistedChannelConfig({});a=(n=d?.relayPersistence)!==null&&n!==void 0&&n,c=yield u.getCachedChainId();const h=yield u.getCachedAccounts();h.length>0&&(s=h[0])}if(G(`[SDKProvider: initializeStateAsync()] relayPersistence=${a}`,{relayPersistence:a,cachedChainId:c,cachedSelectedAddress:s}),a)if(c&&s)o={accounts:[s],chainId:c,isUnlocked:!1},l=!0;else try{o=yield e.request({method:"metamask_getProviderState"})}catch(d){return e._log.error("MetaMask: Failed to get initial state. Please report this bug.",d),void(i.providerStateRequested=!1)}if(((r=o?.accounts)===null||r===void 0?void 0:r.length)===0)if(e.getSelectedAddress())o.accounts=[e.getSelectedAddress()];else{G("[SDKProvider: initializeStateAsync()] Fetch accounts remotely.");const d=yield e.request({method:"eth_requestAccounts",params:[]});o.accounts=d}e._initializeState(o),i.providerStateRequested=!1,l&&(e._state.isConnected=!0,e.emit("connect",{chainId:o?.chainId}))}}))})(this)}))}_initializeState(e){return G("[SDKProvider: _initializeState()]",e),(function(n,r,i){return G("[SDKProvider: initializeState()] set state._initialized to false"),n._state.initialized=!1,r(i)})(this,super._initializeState.bind(this),e)}_handleChainChanged({chainId:e,networkVersion:n}={}){this.state.chainId=e,this.state.networkVersion=n,(function({instance:r,chainId:i,networkVersion:o,superHandleChainChanged:c}){G(`[SDKProvider: handleChainChanged()] chainId=${i} networkVersion=${o}`);let s=o;o||(G("[SDKProvider: handleChainChanged()] forced network version to prevent provider error"),s="1"),i!==Xl&&(Re.analytics.track("sdk_used_chain",{caip_chain_id:`eip155:${parseInt(i??"0x1",16)}`}),Xl=i),r._state.isConnected=!0,r.emit("connect",{chainId:i}),c({chainId:i,networkVersion:s})})({instance:this,chainId:e,networkVersion:n,superHandleChainChanged:super._handleChainChanged.bind(this)})}}var qr,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-
28prettier":"^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"})(qr||(qr={}));const Ql="direct",zr="https://metamask.app.link/connect",Vr="metamask://connect",eu={NAME:"MetaMask",RDNS:["io.metamask","io.metamask.flask"]},zg=/(?:^[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,de={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={[de.ETH_REQUESTACCOUNTS]:!0,[de.ETH_SENDTRANSACTION]:!0,[de.ETH_SIGNTRANSACTION]:!0,[de.ETH_SIGN]:!0,[de.PERSONAL_SIGN]:!0,[de.ETH_ACCOUNTS]:!1,[de.ETH_CHAINID]:!1,[de.PERSONAL_SIGN]:!0,[de.ETH_SIGNTYPEDDATA]:!0,[de.ETH_SIGNTYPEDDATA_V3]:!0,[de.ETH_SIGNTYPEDDATA_V4]:!0,[de.WALLET_REQUESTPERMISSIONS]:!0,[de.WALLET_GETPERMISSIONS]:!0,[de.WALLET_WATCHASSET]:!0,[de.WALLET_ADDETHEREUMCHAIN]:!0,[de.WALLET_SWITCHETHETHEREUMCHAIN]:!0,[de.METAMASK_CONNECTSIGN]:!0,[de.METAMASK_CONNECTWITH]:!0,[de.PERSONAL_EC_RECOVER]:!0,[de.METAMASK_BATCH]:!0,[de.METAMASK_OPEN]:!0},Vg=Object.keys(Wr).filter((t=>Wr[t]===!0)).map((t=>t.toLowerCase())),gf=["eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sign"].map((t=>t.toLowerCase())),As=".sdk-comm",yo="providerType",sa=".MMSDK_cached_address",aa=".MMSDK_cached_chainId",xt={CHAIN_CHANGED:"chainChanged",ACCOUNTS_CHANGED:"accountsChanged",DISCONNECT:"disconnect",CONNECT:"connect",CONNECTED:"connected"},Wg=1e6;var Kt;(function(t){t.TERMINATE="terminate",t.EXTENSION="extension",t.INITIALIZED="initialized"})(Kt||(Kt={}));const Gg=typeof window<"u"&&window.localStorage;function Yg({instance:t,msg:e}){return J(this,void 0,void 0,(function*(){if(t._initialized||(G("[MetaMaskSDK: connectAndSign()] provider not ready -- wait for init()"),yield t.init()),G(`[MetaMaskSDK: connectAndSign()] activeProvider=${t.activeProvider}`),!t.activeProvider)throw new Error("SDK state invalid -- undefined provider");const n=/^0x([0-9A-Fa-f]{2})*$/u.test(e)?e:(function(r){let i;if(X!==void 0)i=X.from(r,"utf8").toString("hex");else if(typeof TextEncoder<"u"){const o=new TextEncoder().encode(r);i=Array.from(o).map((c=>c.toString(16).padStart(2,"0"))).join("")}else{if(typeof Xe!="object"||!("Buffer"in Xe))throw new Error("Unable to convert string to hex: No available method.");i=Xe.Buffer.from(r,"utf8").toString("hex")}return`0x${i}`})(e);return t.activeProvider.request({method:de.METAMASK_CONNECTWITH,params:[{method:de.PERSONAL_SIGN,params:[n]}]})}))}function tu(t){var e,n;return J(this,void 0,void 0,(function*(){G("[MetaMaskSDK: connectWithExtensionProvider()] ",t),t.sdkProvider=t.activeProvider,t.activeProvider=window.extension,window.ethereum=window.extension;try{const r=yield(e=window.extension)===null||e===void 0?void 0:e.request({method:"eth_requestAccounts"});G(`[MetaMaskSDK: connectWithExtensionProvider()] accounts=${r}`)}catch(r){return void console.warn("[MetaMaskSDK: connectWithExtensionProvider()] can't request accounts error",r)}localStorage.setItem(yo,"extension"),t.extensionActive=!0,t.emit(nt.ProviderUpd
28ate,Kt.EXTENSION),t.options.enableAnalytics&&((n=t.analytics)===null||n===void 0||n.send({event:Oe.SDK_USE_EXTENSION}))}))}function vo(t){let e;if(X!==void 0)e=X.from(t,"utf8").toString("base64");else if(typeof btoa=="function")e=btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/gu,((n,r)=>String.fromCharCode(parseInt(r,16)))));else{if(typeof Xe!="object"||!("Buffer"in Xe))throw new Error("Unable to base64 encode: No available method.");e=Xe.Buffer.from(t,"utf8").toString("base64")}return e}function Zg(t,e,n,r){var i,o,c,s,a,l,u,d,h,f,m,g,w,p,C,_,O,L,U,q;return J(this,void 0,void 0,(function*(){const F=(i=t.state.remote)===null||i===void 0?void 0:i.isReady(),B=(o=t.state.remote)===null||o===void 0?void 0:o.isConnected(),N=(c=t.state.remote)===null||c===void 0?void 0:c.isPaused(),H=kt.getProvider(),$=(s=t.state.remote)===null||s===void 0?void 0:s.getChannelId(),P=(a=t.state.remote)===null||a===void 0?void 0:a.isAuthorized(),{deeplinkProtocol:M}=t.state,{method:S,data:I,triggeredInstaller:j}=(T=>{var b,v,k,x;let R;X.isBuffer(T)?(R=T.toJSON(),R._isBuffer=!0):R=T;const D=(b=R?.data)===null||b===void 0?void 0:b.method;let K=!1;return typeof((v=R?.data)===null||v===void 0?void 0:v.params)=="object"&&((x=(k=R?.data)===null||k===void 0?void 0:k.params)===null||x===void 0?void 0:x.__triggeredInstaller)===!0&&(K=!0,R.data.params=R.data.params.wrappedParams),{method:D,data:R,triggeredInstaller:K}})(e);if(G(`[RCPMS: write()] method='${S}' isRemoteReady=${F} channelId=${$} isSocketConnected=${B} isRemotePaused=${N} providerConnected=${H.isConnected()}`,e),!$)return S!==de.METAMASK_GETPROVIDERSTATE&&G(`[RCPMS: write()] ${S} --> channelId is undefined`),r(new Error("disconnected"));G(`[RCPMS: write()] remote.isPaused()=${(l=t.state.remote)===null||l===void 0?void 0:l.isPaused()} authorized=${P} ready=${F} socketConnected=${B}`,e);const y=(u=t.state.platformManager)===null||u===void 0?void 0:u.isSecure(),E=(h=(d=t.state.platformManager)===null||d===void 0?void 0:d.isMobileWeb())!==null&&h!==void 0&&h,A=(m=(f=t.state.remote)===null||f===void 0?void 0:f.hasDeeplinkProtocol())!==null&&m!==void 0&&m&&E&&P;try{if(!j){const v=JSON.stringify(I?.data);if(v.length>Wg)return r(new Error(`Message size ${v.length} exceeds maximum allowed size of 1000000 bytes`));(g=t.state.remote)===null||g===void 0||g.sendMessage(I?.data).then((()=>{G(`[RCPMS: _write()] ${S} sent successfully`)})).catch((k=>{G("[RCPMS: _write()] error sending message",k)}))}if(!y)return G(`[RCPMS: _write()] unsecure platform for method ${S} -- return callback`),r();if(j)return G("[RCPMS: _write()] prevent deeplink -- installation completed separately."),r();const T=(C=(p=(w=t.state.remote)===null||w===void 0?void 0:w.getKeyInfo())===null||p===void 0?void 0:p.ecies.public)!==null&&C!==void 0?C:"";let b=encodeURI(`channelId=${$}&pubkey=${T}&comm=socket&t=d&v=2`);if(A){const v=JSON.stringify(I?.data),k=(_=t.state.remote)===null||_===void 0?void 0:_.encrypt(v);if(!k)return G("[RCPMS: _write()] error encrypting message"),r(new Error("RemoteCommunicationPostMessageStream - disconnected"));b+=`&scheme=${M}&rpc=${vo(k)}`}if(!(!((O=t.state.platformManager)===null||O===void 0)&&O.isMetaMaskInstalled()))return G("[RCPMS: _write()] prevent deeplink until installation is completed."),r();Wr[S]?(G(`[RCPMS: _write()] redirect link for '${S}' socketConnected=${B} connect?${b}`),(L=t.state.platformManager)===null||L===void 0||L.openDeeplink(`${zr}?${b}`,`${Vr}?${b}`,"_self")):!((U=t.state.remote)===null||U===void 0)&&U.isPaused()?(G(`[RCPMS: _write()] MM is PAUSED! deeplink with connect! targetMethod=${S}`),(q=t.state.platformManager)===null||q===void 0||q.openDeeplink(`${zr}?redirect=true&${b}`,`${Vr}?redirect=true&${b}`,"_self")):G(`[RCPMS: _write()] method ${S} doesn't need redirect.`)}catch(T){return G("[RCPMS: _write()] error sending message",T),r(new Error("RemoteCommunicationPostMessageStream - disconnected"))}return r()}))}class Jg 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 J(this,void 0,void 0,(function*(){return Zg(this,e,0,r)}))}_read(){}_onMessage(e){return(function(n,r){try{if(G("[RCPMS: onMessage()] message",r),!r||typeof r!="object"||typeof r?.data!="object")return;if(!r?.name)return void G("[RCPMS: onMessage()] ignore message without name",r);if(r?.name!==qr.PROVIDER)return void G(`[RCPMS: onMessage()] ignore message with wrong name message=${r}`);if(X.isBuffer(r)){const i=X.from(r);n.push(i)}else n.push(r)}catch(i){G(`[RCPMS: onMessage()] ignore message error err=${i}`)}})(this,e)}start(){}}let nu=1;const yf=t=>new Promise((e=>{setTimeout((()=>{e(!0)}),t)}
28)),Xg=({checkInstallationOnAllCalls:t=!1,communicationLayerPreference:e,injectProvider:n,shouldShimWeb3:r,platformManager:i,installer:o,sdk:c,remoteConnection:s,debug:a})=>J(void 0,void 0,void 0,(function*(){var l,u;const d=(({name:N,remoteConnection:H})=>{if(!H||!H?.getConnector())throw new Error("Missing remote connection parameter");return new Jg({name:N,remote:H?.getConnector(),deeplinkProtocol:H?.state.deeplinkProtocol,platformManager:H?.getPlatformManager()})})({name:qr.INPAGE,target:qr.CONTENT_SCRIPT,remoteConnection:s}),h=i.getPlatformType(),f=c.options.dappMetadata,m=`Sdk/Javascript SdkVersion/${Un.version} Platform/${h} dApp/${(l=f.url)!==null&&l!==void 0?l:f.name} dAppTitle/${f.name}`;let g=null,w=null;const p=(u=c.options.storage)===null||u===void 0?void 0:u.storageManager;if(p){try{const N=yield p.getCachedAccounts();N.length>0&&(g=N[0])}catch(N){console.error(`[initializeMobileProvider] failed to get cached addresses: ${N}`)}try{const N=yield p.getCachedChainId();N&&(w=N)}catch(N){console.error(`[initializeMobileProvider] failed to parse cached chainId: ${N}`)}}G(`[initializeMobileProvider] cachedAccountAddress: ${g}, cachedChainId: ${w}`);const C=!(!n||h===Ve.NonBrowser||h===Ve.ReactNative),_=kt.init({shouldSetOnWindow:C,connectionStream:d,shouldShimWeb3:r,sdkInstance:c});let O=!1;const L=N=>{O=N},U=()=>O,q=(N,H,$,P)=>J(void 0,void 0,void 0,(function*(){var M,S,I,j,y,E,A,T,b;const v=kt.getProvider();if(O){v.emit("display_uri",s?.state.qrcodeLink||""),s?.showActiveModal();let Q=U();for(;Q;){const ne=U(),oe=s?.isAuthorized();Q=ne&&!oe,G(`[initializeMobileProvider: sendRequest()] waiting for initialization to complete - initializing: ${ne} authorized: ${oe}`),yield yf(1e3)}return G("[initializeMobileProvider: sendRequest()] initial method completed -- prevent installation and call provider"),$(...H)}const k=i.isMetaMaskInstalled(),x=s?.isConnected();let R=null,D=null,K=null;if(R=(M=v.getSelectedAddress())!==null&&M!==void 0?M:g,K=v.getChainId()||w,R&&p&&R!==g&&p.persistAccounts([R]).catch((Q=>{console.error(`[initializeMobileProvider] failed to persist account: ${Q}`)})),K&&(w=K,p&&p.persistChainId(K).catch((Q=>{console.error(`[initializeMobileProvider] failed to persist chainId: ${Q}`)}))),G("[initializeMobileProvider: sendRequest()]",{selectedAddress:R,chainId:K}),P&&G(`[initializeMobileProvider: sendRequest()] method=${N} ongoing=${O} selectedAddress=${R} isInstalled=${k} checkInstallationOnAllCalls=${t} socketConnected=${x}`),R&&N.toLowerCase()===de.ETH_ACCOUNTS.toLowerCase())return[R];if(K&&N.toLowerCase()===de.ETH_CHAINID.toLowerCase())return K;const z=[de.ETH_REQUESTACCOUNTS,de.WALLET_REQUESTPERMISSIONS,de.METAMASK_CONNECTSIGN,de.METAMASK_CONNECTWITH],V=!Wr[N],Z=(S=c.options.readonlyRPCMap)===null||S===void 0?void 0:S[K];if(Z&&V)try{const Q=(I=H?.[0])===null||I===void 0?void 0:I.params,ne=yield(({rpcEndpoint:oe,method:ue,sdkInfo:re,params:ie})=>J(void 0,void 0,void 0,(function*(){const ce=JSON.stringify({jsonrpc:"2.0",method:ue,params:ie,id:(nu+=1,nu)}),se={Accept:"application/json","Content-Type":"application/json"};let he;oe.includes("infura")&&(se["Metamask-Sdk-Info"]=re);try{he=yield Ou(oe,{method:"POST",headers:se,body:ce})}catch(ge){throw ge instanceof Error?new Error(`Failed to fetch from RPC: ${ge.message}`):new Error(`Failed to fetch from RPC: ${ge}`)}if(!he.ok)throw new Error(`Server responded with a status of ${he.status}`);return(yield he.json()).result})))({rpcEndpoint:Z,sdkInfo:m,method:N,params:Q||[]});return P&&G(`initializeProvider::ReadOnlyRPCResponse ${ne}`),ne}catch(Q){console.warn(`[initializeMobileProvider: sendRequest()] method=${N} readOnlyRPCRequest failed:`,Q)}if((!k||k&&!x)&&N!==de.METAMASK_GETPROVIDERSTATE){const Q=((j=H?.[0])===null||j===void 0?void 0:j.params)||[];if(z.indexOf(N)!==-1||t){L(!0);const ne=N===de.METAMASK_CONNECTWITH,oe=`${Date.now()}`;try{yield o.start({wait:!1,connectWith:ne?{method:N,id:oe,params:Q}:void 0}),yield new Promise(((ue,re)=>{s?.isAuthorized()&&(G("[initializeMobileProvider: sendRequest()] already authorized"),ue(!0)),s?.getConnector().once(te.AUTHORIZED,(()=>{ue(!0)})),c.once(te.PROVIDER_UPDATE,(ie=>{G(`[initializeMobileProvider: sendRequest()] PROVIDER_UPDATE --- remote provider request interupted type=${ie}`),ie===Kt.EXTENSION?re(te.PROVIDER_UPDATE):re(new Error("Connection Terminated"))}))}))}catch(ue){if(Kt.EXTENSION===ue){if(G(`[initializeMobileProvider: sendRequest()] extension provider detect: re-create ${N} on the active provider`),N.toLowerCase()===de.METAMASK_CONNECTSIGN.toLowerCase()){const re=yield(y=c.getProvider())===null||y===void 0?void 0:y.request({method:de.ETH_REQUESTACCOUNTS,params:[]});if(!re.length)throw new Error("SDK state invalid -- undefined accounts");const ie=yield(E=c.getProvider())===null||E===void 0?void 0:E.request({method:de.PERSONAL_SIGN,params:[Q[0],re[0]]});return c.emit(nt.ConnectWithResponse,ie),ie}if(N.toLowerCase()===de.METAMASK_CONNECTWITH.toLowerCase()){const[re]=Q,ie=yield(({method:ce,sdk:se,params:he})=>J(void 0,void 0,void 0,(function*(){var ge,le,fe,me;if(!se.isExtensionActive())throw new Error("SDK state invalid -- extension is not active");G("[MetaMaskProvider: extensionConnectWithOverwrite()] Overwriting request method",ce,he);const Ae=yield(ge=se.getProvider())===null||ge===void 0?void 0:ge.request({method:de.ETH_REQUESTACCOUNTS,params:[]});if(!Ae.length)throw new Error("SDK state invalid -- undefined accounts");if(ce?.toLowerCase()===de.PERSONAL_SIGN.toLowerCase()){const Ie={method:ce,params:[he[0],Ae[0]]};return yield(le=se.getProvider())===null||le===void 0?void 0:le.request(Ie)}if(ce?.toLowerCase()===de.ETH_SENDTRANSACTION.toLowerCase()){const Ie={method:ce,params:[Object.assign(Object.assign({},he[0]),{from:Ae[0]})]};return yield(fe=se.getProvider())===null||fe===void 0?void 0:fe.request(Ie)}return gf.includes(ce.toLowerCase())?(console.warn(`MetaMaskSDK connectWith method=${ce} -- not handled by the extension -- call separately`),Ae):yield(me=se.getProvider())===null||me===void 0?void 0:me.request({method:ce,params:he})})))({method:re.method,sdk:c,params:re.params});return c.emit(nt.ConnectWithResponse,ie),ie}return G(`[initializeMobileProvider: sendRequest()] sending '${N}' on active provider`,Q),yield(A=c.getProvider())===null||A===void 0?void 0:A.request({method:N,params:Q})}throw ue===te.REJECTED?(s?.closeModal(),(T=c.getProvider())===null||T===void 0||T.handleDisconnect({terminate:!1}),Object.assign(new Error("User rejected connection"),{code:4001})):(G(`[initializeMobileProvider: sendRequest()] failed to start installer: ${ue}`),ue)}finally{L(!1)}
28if(N===de.ETH_REQUESTACCOUNTS)return D=yield new Promise((ue=>{const re=setInterval((()=>{const{accounts:ie}=v.getState();ie&&(clearInterval(re),ue(ie))}),100)})),G(`[initializeMobileProvider: sendRequest()] selectedAddress: ${R} --- SKIP rpc call`),D;if(N===de.METAMASK_CONNECTWITH)try{let ue=0;const re=5,ie=({resolve:ge,reject:le})=>{ue+=1;const fe=s?.getConnector().getRPCMethodTracker(),me=fe?.[oe];return G(`TRACKER: update method ${oe}`,me),me?.result?(G("[initializeMobileProvider: sendRequest()] found result",me.result),c.emit(nt.ConnectWithResponse,me.result),void ge(me.result)):me?.error?(G("[initializeMobileProvider: sendRequest()] found error",me.error),void le(me.error)):ue>=re?(G("[initializeMobileProvider: sendRequest()] max message count reached without result"),void le(new Error("Max message count reached without result"))):void G("[initializeMobileProvider: sendRequest()] not found yet, need to wait for next update")};let ce,se;const he=yield new Promise(((ge,le)=>{const fe=s?.getConnector().getRPCMethodTracker();G(`TRACKER: method ${oe}`,fe),fe?.[oe].result?(G("[initializeMobileProvider: sendRequest()] found result",fe?.[oe].result),ge(fe?.[oe].result)):fe?.[oe].error&&(G("[initializeMobileProvider: sendRequest()] found error",fe?.[oe].error),le(fe?.[oe].error)),se=()=>ie({resolve:ge,reject:le}),ce=s?.getConnector().on(te.RPC_UPDATE,se)}));return se&&ce?.off(te.RPC_UPDATE,se),G("TRACKER: result",he),he}catch(ue){throw G("[initializeMobileProvider: sendRequest()] error:",ue),ue}return H[0]&&typeof H[0]=="object"&&(H[0].params={__triggeredInstaller:!0,wrappedParams:H[0].params}),$(...H)}if(i.isSecure()&&Wr[N])return $(...H);if(c.isExtensionActive())return G(`[initializeMobileProvider: sendRequest()] EXTENSION active - redirect request '${N}' to it`,H,Q),yield(b=c.getProvider())===null||b===void 0?void 0:b.request({method:N,params:Q});throw G(`[initializeMobileProvider: sendRequest()] method=${N} --- skip --- not connected/installed`),new Error("MetaMask is not connected/installed, please call eth_requestAccounts to connect first.")}try{const Q=yield $(...H);if(G(`[initializeMobileProvider: sendRequest()] method=${N} rpcResponse`,Q),N===de.WALLET_REQUESTPERMISSIONS){const ne=Q.reduce(((oe,ue)=>{var re;if(ue.parentCapability==="eth_accounts"){const ie=(re=ue.caveats.find((ce=>ce.type==="restrictReturnedAccounts")))===null||re===void 0?void 0:re.value;ie&&oe.push(...ie)}return oe}),[]);G("[initializeMobileProvider: sendRequest()] accountsToPersist:",ne),ne.length>0&&(v.handleAccountsChanged(ne,!1),p?.persistAccounts(ne))}return Q}catch(Q){throw console.error("[initializeMobileProvider: sendRequest()] error:",Q),Q}})),{request:F}=_;_.request=(...N)=>J(void 0,void 0,void 0,(function*(){return q(N?.[0].method,N,F,a)}));const{send:B}=_;return _.send=(...N)=>J(void 0,void 0,void 0,(function*(){return q(N?.[0],N,B,a)})),G("[initializeMobileProvider: sendRequest()] metamaskStream.start()"),d.start(),_}));function Qg(t){var e,n,r,i;return J(this,void 0,void 0,(function*(){const{options:o}=t,c={communicationLayerPreference:(e=o.communicationLayerPreference)!==null&&e!==void 0?e: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 Xg(c);t.activeProvider=s,(function(a){var l,u,d,h;(u=(l=a.remoteConnection)===null||l===void 0?void 0:l.getConnector())===null||u===void 0||u.on(nt.ConnectionStatus,(f=>{a.emit(nt.ConnectionStatus,f)})),(h=(d=a.remoteConnection)===null||d===void 0?void 0:d.getConnector())===null||h===void 0||h.on(nt.ServiceStatus,(f=>{a.emit(nt.ServiceStatus,f)}))})(t)}))}const ey="sdk";class ty{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:ey,event:e,sdkVersion:Un.version},this.originatorInfo),{params:n});G(`[Analytics: send()] event: ${e}`,r),Qt(r,this.serverURL).catch((i=>{G(`[Analytics: send()] error: ${i}`)}))}}const ny=()=>
28{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},ry=163400;function ru(t){var e,n,r;const{dappMetadata:i}=t,o=(function({url:u,name:d}){var h;const f=u+d,m=vo(f);if(!localStorage)return"";let g=(h=localStorage.getItem(m))!==null&&h!==void 0?h:"";if(!g){g=gn();try{localStorage.setItem(m,g)}catch{return""}}return g})({url:(e=i?.url)!==null&&e!==void 0?e:"no_url",name:(n=i?.name)!==null&&n!==void 0?n:"no_name"}),c=(r=t.platformManager)===null||r===void 0?void 0:r.getPlatformType(),s=c===Ve.DesktopWeb,a=c===Ve.MetaMaskMobileWebview;let l="N/A";return s?l="extension":a&&(l="mobile"),{id:o,from:l}}const Ci=(t,e,n)=>{if(Zr(t))if(n||e&&typeof e=="object"&&e!==null&&"error"in e){const r=n||e?.error;r&&r.code===4001?Re.analytics.track("sdk_action_rejected",{action:t}):Re.analytics.track("sdk_action_failed",{action:t})}else Re.analytics.track("sdk_action_succeeded",{action:t})},vf=({provider:t,sdkInstance:e})=>{if("state"in t)throw new Error("INVALID EXTENSION PROVIDER");return new Proxy(t,{get:(n,r)=>r==="request"?function(i){var o,c;return J(this,void 0,void 0,(function*(){G("[wrapExtensionProvider()] Overwriting request method",i);const{method:s,params:a}=i,l=Vg.includes(s.toLowerCase()),{id:u,from:d}=ru(e);if(l&&((o=e.analytics)===null||o===void 0||o.send({event:Oe.SDK_RPC_REQUEST,params:{method:s,from:d,id:u}})),Zr(s)&&Re.analytics.track("sdk_action_requested",{action:s}),s===de.METAMASK_BATCH&&Array.isArray(a))return(({target:m,args:g,trackEvent:w,sdkInstance:p})=>J(void 0,void 0,void 0,(function*(){var C,_;if(g.method!=="metamask_batch")throw new Error("Invalid usage");const O=[],L=(C=g?.params)!==null&&C!==void 0?C:[];for(const F of L){const B=yield m?.request({method:F.method,params:F.params});O.push(B)}const{id:U,from:q}=ru(p);w&&((_=p.analytics)===null||_===void 0||_.send({event:Oe.SDK_RPC_REQUEST_DONE,params:{method:g.method,from:q,id:U}}));for(const F of O)Ci(g.method,F,null);return O})))({target:n,args:i,trackEvent:l,sdkInstance:e});if(s.toLowerCase()===de.METAMASK_CONNECTSIGN.toLowerCase()&&Array.isArray(a))return(({target:m,params:g})=>J(void 0,void 0,void 0,(function*(){let w,p=null;try{const C=yield m.request({method:de.ETH_REQUESTACCOUNTS,params:[]});if(!C.length)throw new Error("SDK state invalid -- undefined accounts");return w=yield m.request({method:de.PERSONAL_SIGN,params:[g[0],C[0]]}),w}catch(C){throw p=C,C}finally{Ci(de.PERSONAL_SIGN,w,p)}})))({target:n,params:a});if(s.toLowerCase()===de.METAMASK_CONNECTWITH.toLowerCase()&&Array.isArray(a))return(({target:m,params:g})=>J(void 0,void 0,void 0,(function*(){const[w]=g,p=w.method,C=w.params;let _,O=null;try{const L=yield m.request({method:de.ETH_REQUESTACCOUNTS,params:[]});if(!Array.isArray(L)||!L.length)throw new Error("SDK state invalid -- undefined accounts");return p?.toLowerCase()===de.PERSONAL_SIGN.toLowerCase()?(_=yield m.request({method:p,params:[C[0],L[0]]}),_):p?.toLowerCase()===de.ETH_SENDTRANSACTION.toLowerCase()?(_=yield m.request({method:p,params:[Object.assign(Object.assign({},C[0]),{from:L[0]})]}),_):gf.includes(p.toLowerCase())?(console.warn(`MetaMaskSDK connectWith method=${p} -- not handled by the extension -- call separately`),_=L,_):(_=yield m.request({method:p,params:C}),_)}catch(L){throw O=L,L}finally{Ci(p,_,O)}})))({target:n,params:a});let h,f=null;try{return h=yield n.request(i),h}catch(m){throw f=m,m}finally{l&&((c=e.analytics)===null||c===void 0||c.send({event:Oe.SDK_RPC_REQUEST_DONE,params:{method:s,from:d,id:u}})),Ci(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 bo;function iy({mustBeMetaMask:t,sdkInstance:e}){return J(this,void 0,void 0,(function*(){if(typeof window>"u")throw new Error("window not available");try{const n=yield new Promise(((r,i)=>{const o=setTimeout((()=>{i(new Error("eip6963RequestProvider timed out"))}),500);window.addEventListener(bo.Announce,(c=>{const s=c,{detail:{info:a,provider:l}={}}=s,{name:u,rdns:d,uuid:h}=a??{};zg.test(h)&&u.startsWith(eu.NAME)&&eu.RDNS.includes(d)&&(clearTimeout(o),r(l))})),window.dispatchEvent(new Event(bo.Request))}));return vf({provider:n,sdkInstance:e})}catch{throw new Error("Provider not found")}}))}(function(t){t.Announce="eip6963:announceProvider",t.Request="eip6963:requestProvider"})(bo||(bo={}));const oy=t=>J(void 0,void 0,void 0,(function*(){const{options:e}=t,{infuraAPIKey:n}=e;if(!n)return;const r={"0x1":`https://mainnet.infura.io/v3/${n}`,"0x5":`https://goerli.infura.io/v3/${n}`,"0xaa36a7":`https://sepolia.infura.io/v3/${n}`,"0xe708":`https://linea-mainnet.infura.io/v3/${n}`,"0xe704":`https://linea-goerli.infura.io/v3/${n}`,"0x89":`https://polygon-mainnet.infura.io/v3/${n}`,"0x13881":`https://polygon-mumbai.infura.io/v3/${n}`,"0x45":`https://optimism-mainnet.infura.io/v3/${n}`,"0x1a4":`https://optimism-goerli.infura.io/v3/${n}`,"0xa4b1":`https://arbitrum-mainnet.infura.io/v3/${n}`,"0x66eed":`https://arbitrum-goerli.infura.io/v3/${n}`,"0x2a15c308d":`https://palm-mainnet.infura.io/v3/${n}`,"0x2a15c3083":`https://palm-testnet.infura.io/v3/${n}`,"0xa86a":`https://avalanche-mainnet.infura.io/v3/${n}`,"0xa869":`https://avalanche-fuji.infura.io/v3/${n}`,"0x4e454152":`https://aurora-mainnet.infura.io/v3/${n}`,"0x4e454153":`https://aurora-testnet.infura.io/v3/${n}`,"0x534e5f4d41494e":`https://starknet-mainnet.infura.io/v3/${n}`,"0x534e5f474f45524c49":`https://starknet-goerli.infura.io/v3/${n}`,"0x534e5f474f45524c4932":`https://starknet-goerli2.infura.io/v3/${n}`,"0xa4ec":`https://celo-mainnet.infura.io/v3/${n}`,"0xaef3":`https://celo-alfajores.infura.io/v3/${n}`};t.options.readonlyRPCMap?t.options.readonlyRPCMap=Object.assign(Object.assign({},t.options.readonlyRPCMap),r):t.options.readonlyRPCMap=r})),sy=t=>J(void 0,void 0,void 0,(function*(){const{options:e}=t,{readonlyRPCMap:n}=e;if(n)try{G("[MetaMaskSDK: setupReadOnlyRPCProviders()] Setting up Readonly RPC Providers",n),t.setReadOnlyRPCCalls(!0)}catch{throw new Error("Invalid Infura Settings")}}));
28function ay(t,e,n,r){return new(n||(n=Promise))((function(i,o){function c(l){try{a(r.next(l))}catch(u){o(u)}}function s(l){try{a(r.throw(l))}catch(u){o(u)}}function a(l){var u;l.done?i(l.value):(u=l.value,u instanceof n?u:new n((function(d){d(u)}))).then(c,s)}a((r=r.apply(t,[])).next())}))}function cy(t,e){var n,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(a){return function(l){return(function(u){if(n)throw new TypeError("Generator is already executing.");for(;c;)try{if(n=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(i=c.trys,!((i=i.length>0&&i[i.length-1])||u[0]!==6&&u[0]!==2)){c=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(u[0]===6&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=e.call(t,c)}catch(d){u=[6,d],r=0}finally{n=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}})([a,l])}}}var iu="INSTALLED",ou="NOT_INSTALLED",su="REGISTERED",au="REGISTERING",cu="RELOADING",lu={CHROME:"https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",FIREFOX:"https://addons.mozilla.org/firefox/addon/ether-metamask/",DEFAULT:"https://metamask.io"},ki="REGISTRATION_IN_PROGRESS",uu="FORWARDER_ID",ly=(function(){function t(e){var n=e===void 0?{}:e,r=n.forwarderOrigin,i=r===void 0?"https://fwd.metamask.io":r,o=n.forwarderMode,c=o===void 0?t.FORWARDER_MODE.INJECT:o;this.forwarderOrigin=i,this.forwarderMode=c,this.state=t.isMetaMaskInstalled()?iu:ou;var s=t._detectBrowser();this.downloadUrl=s?lu[s]:lu.DEFAULT,this._onMessage=this._onMessage.bind(this),this._onMessageFromForwarder=this._onMessageFromForwarder.bind(this),this._openForwarder=this._openForwarder.bind(this),this._openDownloadPage=this._openDownloadPage.bind(this),this.startOnboarding=this.startOnboarding.bind(this),this.stopOnboarding=this.stopOnboarding.bind(this),window.addEventListener("message",this._onMessage),c===t.FORWARDER_MODE.INJECT&&sessionStorage.getItem(ki)==="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 ay(this,0,void 0,(function(){return cy(this,(function(n){switch(n.label){case 0:switch(this.state){case cu:return[3,1];case ou:return[3,2];case iu:return[3,3];case au:return[3,5];case su: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=cu,location.reload(),[3,8];case 3:return console.debug("Registering with MetaMask"),this.state=au,[4,t._register()];case 4:return n.sent(),this.state=su,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]}}
28))}))},t.prototype.startOnboarding=function(){sessionStorage.setItem(ki,"true"),this._openDownloadPage(),this._openForwarder()},t.prototype.stopOnboarding=function(){sessionStorage.getItem(ki)==="true"&&(this.forwarderMode===t.FORWARDER_MODE.INJECT&&(console.debug("Removing forwarder"),t._removeForwarder()),sessionStorage.setItem(ki,"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",uu),n.insertBefore(r,n.children[0])},t._removeForwarder=function(){var e;(e=document.getElementById(uu))===null||e===void 0||e.remove()},t._detectBrowser=function(){var e=pf.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 uy(t,{wait:e=!1}){return J(this,void 0,void 0,(function*(){return G(`[MetamaskInstaller: startInstaller()] wait=${e}`),e&&(yield yf(1e3)),yield t.checkInstallation()}))}class dy{constructor({remote:e,preferDesktop:n,platformManager:r,debug:i=!1}){this.state={isInstalling:!1,hasInstalled:!1,resendRequest:null,preferDesktop:!1,platformManager:null,remote:null,debug:!1,connectWith:void 0},this.state.remote=e,this.state.preferDesktop=n,this.state.platformManager=r,this.state.debug=i}startDesktopOnboarding(){return(function(){return J(this,void 0,void 0,(function*(){G("[MetamaskInstaller: startDesktopOnboarding() starting desktop onboarding"),window.ethereum&&(window.ethereum=void 0),new ly().startOnboarding()}))})()}redirectToProperInstall(){return J(this,void 0,void 0,(function*(){return(function(e){var n,r;return J(this,void 0,void 0,(function*(){const{state:i}=e,o=(n=i.platformManager)===null||n===void 0?void 0:n.getPlatformType();if(G(`[MetamaskInstaller: redirectToProperInstall()] platform=${o}`),o===Ve.MetaMaskMobileWebview)return!1;i.isInstalling=!0;try{yield(r=i.remote)===null||r===void 0?void 0:r.startConnection({connectWith:i.connectWith}),i.isInstalling=!1,i.hasInstalled=!0}catch(c){throw i.isInstalling=!1,c}return!0}))})(this)}))}checkInstallation(){return J(this,void 0,void 0,(function*(){return(function(e){var n;return J(this,void 0,void 0,(function*(){const{state:r}=e,i=(n=r.platformManager)===null||n===void 0?void 0:n.isMetaMaskInstalled();return G(`[MetamaskInstaller: checkInstallation()] isInstalled=${i}`),!!i||(yield e.redirectToProperInstall())}))})(this)}))}start({wait:e=!1,connectWith:n}){return J(this,void 0,void 0,(function*(){this.state.connectWith=n,G(`[MetaMaskInstaller: start()] wait=${e}`,n),yield uy(this,{wait:e})}))}}class bf{constructor({debug:e,sdkVersion:n}){this.containers={install:void 0,pending:void 0,select:void 0},this.defined={install:!1,pending:!1,select:!1},this.debug=e!=null&&e,this.sdkVersion=n}loadComponent(e){return J(this,void 0,void 0,(function*(){if(!this.defined[e]){this.defined[e]=!0;try{const n=yield Promise.resolve().then((function(){return qy}));console.log("loader",n),n.defineCustomElements()}catch(n){console.error(`Failed to load ${e} modal:`,n)}}}))}renderInstallModal(e){var n;return J(this,void 0,void 0,(function*(){this.debug&&console.debug("ModalLoader: renderInstallModal",e),this.containers.install=e.parentElement,yield this.loadComponent("install");const r=document.createElement("mm-install-modal");r.link=e.link,r.preferDesktop=e.preferDesktop,r.sdkVersion=(n=e.sdkVersion)!==null&&n!==void 0?n:this.sdkVersion,r.addEventListener("close",(({detail:{shouldTerminate:i}})=>e.onClose(i))),r.addEventListener("startDesktopOnboarding",e.metaMaskInstaller.startDesktopOnboarding),r.addEventListener("trackAnalytics",(i=>{var o;return(o=e.onAnalyticsEvent)===null||o===void 0?void 0:o.call(e,i.detail)})),e.parentElement.appendChild(r)}))}renderSelectModal(e){var n;return J(this,void 0,void 0,(function*(){this.containers.select=e.parentElement,yield this.loadComponent("select");const r=document.createElement("mm-select-modal");r.link=e.link,r.sdkVersion=(n=e.sdkVersion)!==null&&n!==void 0?n:this.sdkVersion,r.preferDesktop=e.preferDesktop,r.addEventListener("close",(({detail:{shouldTerminate:i}})=>e.onClose(i))),r.addEventListener("connectWithExtension",e.connectWithExtension),e.parentElement.appendChild(r),setTimeout((()=>this.updateQRCode(e.link)),100)}))}renderPendingModal(e){var n;return J(this,void 0,void 0,(function*(){this.containers.pending=e.parentElement,yield this.loadComponent("pending");const r=document.createElement("mm-pending-modal");r.sdkVersion=(n=e.sdkVersion)!==null&&n!==void 0?n:this.sdkVersion,r.displayOTP=e.dis
28playOTP,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?.parentNode)===null||r===void 0||r.removeChild(n),this.containers[e]=void 0}))}}const hy=({link:t,debug:e,installer:n,terminate:r,connectWithExtension:i,preferDesktop:o,onAnalyticsEvent:c})=>{let s=null,a=null;G("[UI: InstallModal-web: sdkWebInstallModal()] ################## Installing Modal #################"),G(`[UI: InstallModal-web: sdkWebInstallModal()] link=${t}`),G(`[UI: InstallModal-web: sdkWebInstallModal()] npx uri-scheme open "${t}" --ios`),G(`[UI: InstallModal-web: sdkWebInstallModal()] npx uri-scheme open "${t}" --android`),G(`[UI: InstallModal-web: sdkWebInstallModal()] adb shell am start -a android.intent.action.VIEW -d "${t}"`);const l=u=>{var d;G("[UI: InstallModal-web: sdkWebInstallModal()] installModal-web unmounting install modal -- shouldTerminate:",u,a),a?.parentNode&&((d=a.parentNode)===null||d===void 0||d.removeChild(a)),a=null,s=null,u===!0&&r?.()};return{mount:u=>{if(G("[UI: InstallModal-web: sdkWebInstallModal()] installModal-web mounting install modal",a),a)return a.style.display="block",void(s==null||s.updateQRCode(u));s=new bf({debug:e,sdkVersion:Un.version}),a=document.createElement("div"),document.body.appendChild(a),window.extension?s.renderSelectModal({parentElement:a,connectWithExtension:()=>{l(),i?.()},onClose:l,link:t,preferDesktop:o!=null&&o}).catch((d=>{console.error(d)})):s.renderInstallModal({parentElement:a,preferDesktop:o!=null&&o,link:t,metaMaskInstaller:n,onClose:l,onAnalyticsEvent:c}).catch((d=>{console.error("[UI: InstallModal-web: sdkWebInstallModal()]",d)}))},unmount:l}},fy=({onDisconnect:t,debug:e})=>{let n=null,r=null;const i=()=>{G("[UI: pendingModal-web: sdkWebPendingModal()] pendingModal-web unmount",n),n?.parentNode&&n.parentNode.removeChild(n),n=null,r=null},o=s=>{G("[UI: pendingModal-web: sdkWebPendingModal()] pendingModal-web updateOTPValue",s),r&&r.updateOTPValue(s)},c=({displayOTP:s}={displayOTP:!0})=>{G("[UI: pendingModal-web: sdkWebPendingModal()] pendingModal-web mount",n),n?n.style.display="block":(r=new bf({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((a=>{console.error("[UI: pendingModal-web: sdkWebPendingModal()]",a)})))};return c(),{mount:c,unmount:i,updateOTPValue:o}};function wf(t,e){var n,r,i,o;t.connector||(G("[RemoteConnection: initializeConnector()] initialize connector"),t.connector=new mm({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&&(G("[RemoteConnection: initializeConnector()] reset background timer",e.timer),(r=(n=e.timer)===null||n===void 0?void 0:n.stopBackgroundTimer)===null||r===void 0||r.call(n),(o=(i=e.timer)===null||i===void 0?void 0:i.runBackgroundTimer)===null||o===void 0||o.call(i,(()=>!1),1e4)))}function ca(t){t.listeners.forEach((({event:e,handler:n})=>{var r;(r=t.connector)===null||r===void 0||r.off(e,n)})),t.listeners=[]}function py(t,e,n){return J(this,void 0,void 0,(function*(){const r=setTimeout((()=>{Re.analytics.track("sdk_connection_failed",{transport_type:"websocket"})}),6e4);return new Promise(((i,o)=>
28{if(!t.connector)return void o(new Error("No connector available"));G("[RemoteConnection: connectWithModalInstaller()]",{state:t,options:e,linkParams:n});const c=`${t.useDeeplink?Vr:zr}?${n}`;(function(s,a,l){var u,d,h,f;s.installModal=(d=(u=a.modals).install)===null||d===void 0?void 0:d.call(u,{link:l,preferDesktop:s.preferDesktop,installer:a.getMetaMaskInstaller(),terminate:()=>{G("[RemoteConnection: showInstallModal() => terminate()] terminate connection"),a.sdk.terminate().catch((m=>{console.warn("[MMSDK] failed to terminate connection",m)}))},debug:s.developerMode,connectWithExtension:()=>{var m;return(m=a.connectWithExtensionProvider)===null||m===void 0||m.call(a),!1},onAnalyticsEvent:({event:m,params:g})=>{var w,p,C;const _=Object.assign(Object.assign({},g),{sdkVersion:a.sdk.getVersion(),dappId:(w=a.dappMetadata)===null||w===void 0?void 0:w.name,source:a._source,url:(p=a.dappMetadata)===null||p===void 0?void 0:p.url});(C=s.analytics)===null||C===void 0||C.send({event:m,params:_})}}),(f=(h=s.installModal)===null||h===void 0?void 0:h.mount)===null||f===void 0||f.call(h,l)})(t,e,c),e.sdk.once(te.PROVIDER_UPDATE,(s=>J(this,void 0,void 0,(function*(){if(G("[RemoteConnection: connectWithModalInstaller()] once provider_update -- resolving startConnection promise"),s===Kt.TERMINATE){const a={code:4001,message:"User rejected the request."};return clearTimeout(r),void o(a)}o(s)})))),t.connector.once(te.AUTHORIZED,(()=>{clearTimeout(r),i()})),t.connector.once(te.REJECTED,(()=>{clearTimeout(r),o(te.REJECTED)})),t.connector.once(te.CLIENTS_READY,(()=>J(this,void 0,void 0,(function*(){G("[RemoteConnection: connectWithModalInstaller()] once clients_ready -- resolving startConnection promise"),clearTimeout(r),i()}))))}))}))}function Ef(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&&(ca(t),n(te.WALLET_INIT,(({accounts:r,chainId:i})=>J(this,void 0,void 0,(function*(){G(`[RemoteConnection: setupListeners() => EventType.WALLET_INIT] 'wallet_init' accounts=${r} chainId=${i}`);const o=kt.getProvider();o._setConnected();const c={accounts:r,chainId:i,isUnlocked:!1};o._initializeState(c),o.emit("chainChanged",i),o.emit("accountsChanged",r)})))),n(te.AUTHORIZED,(()=>J(this,void 0,void 0,(function*(){var r,i,o,c;try{G("[RemoteConnection: setupListeners() => EventType.AUTHORIZED] 'authorized' closing modals",t.pendingModal,t.installModal);const s=kt.getProvider();s._setConnected(),(i=(r=t.pendingModal)===null||r===void 0?void 0:r.unmount)===null||i===void 0||i.call(r),(c=(o=t.installModal)===null||o===void 0?void 0:o.unmount)===null||c===void 0||c.call(o,!1),t.otpAnswer=void 0,t.authorized=!0,G("[RemoteConnection: setupListeners() => EventType.AUTHORIZED] 'authorized' provider.state",s.getState()),yield s.forceInitializeState()}catch{}})))),n(te.TERMINATE,(()=>{var r,i,o,c,s;(i=(r=t.pendingModal)===null||r===void 0?void 0:r.unmount)===null||i===void 0||i.call(r),(c=(o=t.installModal)===null||o===void 0?void 0:o.unmount)===null||c===void 0||c.call(o,!0),t.pendingModal=void 0,t.installModal=void 0,t.otpAnswer=void 0,(s=t.connector)===null||s===void 0||s.disconnect({terminate:!0}),t.authorized=!1,kt.getProvider().handleDisconnect({terminate:!0}),ca(t),G("[RemoteConnection: setupListeners()] All listeners cleaned up")})))}function my(t,e,{initialCheck:n,connectWith:r}={}){var i,o,c,s,a,l,u,d,h,f,m,g,w,p,C,_,O,L,U;return J(this,void 0,void 0,(function*(){try{if(wf(t,e),!t.connector)throw new Error("no connector defined");Ef(t);const q=kt.getProvider();t.authorized=!1,q.emit("connecting");const F=yield(i=t.connector)===null||i===void 0?void 0:i.originatorSessionConnect();G(`[RemoteConnection: startConnection()] after originatorSessionConnect initialCheck=${n}`,F);let B=(o=F?.channelId)!==null&&o!==void 0?o:"",N=(s=(c=t.connector.getKeyInfo())===null||c===void 0?void 0:c.ecies.public)!==null&&s!==void 0?s:"",H=(l=(a=t.connector.getKeyInfo())===null||a===void 0?void 0:a.ecies.private)!==null&&l!==void 0?l:"";if(n&&!F)return Promise.resolve();if(!F&&!n){const x=yield t.connector.generateChannelIdConnect();B=(u=x.channelId)!==null&&u!==void 0?u:"",N=(d=x.pubKey)!==null&&d!==void 0?d:"",H=(h=x.privKey)!==null&&h!==void 0?h:"";const R=Date.now();(f=t.connector.state.storageManager)===null||f===void 0||f.persistChannelConfig({channelId:B,localKey:H,lastActive:R,validUntil:R+ar})}if(n&&F?.channelId)return!((m=t.connector)===null||m===void 0)&&m.isConnected()||(G(`[RemoteConnection: startConnection()] reconnecting to channel initialCheck=${n}`,F),yield(g=t.connector)===null||g===void 0?void 0:g.connectToChannel
28({channelId:B})),Promise.resolve();F&&!(!((w=t.connector)===null||w===void 0)&&w.isConnected())&&(G("[RemoteConnection: startConnection()] reconnecting to channel",F),yield(p=t.connector)===null||p===void 0?void 0:p.connectToChannel({channelId:B}));const $=!((C=t.platformManager)===null||C===void 0)&&C.isSecure()?"":"&t=q",P=Un.version,{iconUrl:M,name:S,url:I,scheme:j}=e.dappMetadata||{},y=(_=t.platformManager)===null||_===void 0?void 0:_.getPlatformType();let E="N/A";typeof window<"u"&&window.location&&window.location.hostname?E=window.location.hostname:S!==void 0?E=S:I!==void 0&&(E=I);const A={url:I??"",title:S??"",icon:M,scheme:j??"",apiVersion:P,dappId:E||I||"N/A",anonId:e.anonId,platform:y??"",source:(O=e._source)!==null&&O!==void 0?O:""},T=vo(JSON.stringify(A));let b=`channelId=${B}&v=2&comm=${(L=t.communicationLayerPreference)!==null&&L!==void 0?L:""}&pubkey=${N}${$}&originatorInfo=${T}`;if(r){b+=`&rpc=${vo(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:zr}?${b}`;if(t.qrcodeLink=k,t.developerMode&&G(`[RemoteConnection: startConnection()] qrcodeLink=${v}`),q.emit("display_uri",k),Re.analytics.track("sdk_connection_initiated",{transport_type:"websocket"}),(U=t.platformManager)===null||U===void 0?void 0:U.isSecure()){const x=setTimeout((()=>{Re.analytics.track("sdk_connection_failed",{transport_type:"websocket"})}),6e4);return yield(function(R,D){var K,z;return J(this,void 0,void 0,(function*(){const V=`${zr}?${D}`,Z=`${Vr}?${D}`;(z=(K=R.platformManager)===null||K===void 0?void 0:K.openDeeplink)===null||z===void 0||z.call(K,V,Z,"_self")}))})(t,v),new Promise(((R,D)=>{var K,z,V;if(!((K=t.connector)===null||K===void 0)&&K.isAuthorized())return clearTimeout(x),void R();(z=t.connector)===null||z===void 0||z.once(te.AUTHORIZED,(()=>{clearTimeout(x),R()})),(V=t.connector)===null||V===void 0||V.once(te.REJECTED,(()=>{clearTimeout(x),D(te.REJECTED)}))}))}return py(t,e,v)}catch(q){throw console.error("[startConnection] error",q),q}}))}class gy{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=hy),e.modals.otp||(e.modals.otp=fy)}startConnection(e){return J(this,void 0,void 0,(function*(){return my(this.state,this.options,e)}))}initRemoteCommunication({sdkInstance:e}){var n,r,i;return J(this,void 0,void 0,(function*(){const o=yield(r=(n=e.options.storage)===null||n===void 0?void 0:n.storageManager)===null||r===void 0?void 0:r.getPersistedChannelConfig();if(!this.options.ecies){const c={privateKey:o?.localKey};this.options.ecies=c}wf(this.state,this.options),yield(i=this.getConnector())===null||i===void 0?void 0:i.initFromDappStorage(),Ef(this.state,this.options)}))}showActiveModal(){return(function(e){var n,r,i,o;e.authorized?G("[RemoteConnection: showActiveModal()] already authorized"):e.pendingModal?(r=(n=e.pendingModal).mount)===null||r===void 0||r.call(n):e.installModal&&((o=(i=e.installModal).mount)===null||o===void 0||o.call(i,e.qrcodeLink||""))})(this.state)}closeModal(){var e,n,r,i;(n=(e=this.state.pendingModal)===null||e===void 0?void 0:e.unmount)===null||n===void 0||n.call(e),(i=(r=this.state.installModal)===null||r===void 0?void 0:r.unmount)===null||i===void 0||i.call(r,!1)}getUniversalLink(){if(!this.state.qrcodeLink)throw new Error("connection not started. run startConnection() first.");return this.state.qrcodeLink}getChannelConfig(){var e;return(e=this.state.connector)===null||e===void 0?void 0:e.getChannelConfig()}
28getKeyInfo(){var e;return(e=this.state.connector)===null||e===void 0?void 0:e.getKeyInfo()}getConnector(){if(!this.state.connector)throw new Error("invalid remote connector");return this.state.connector}getPlatformManager(){if(!this.state.platformManager)throw new Error("PlatformManager not available");return this.state.platformManager}isConnected(){var e;return((e=this.state.connector)===null||e===void 0?void 0:e.isReady())||!1}isAuthorized(){var e;return((e=this.state.connector)===null||e===void 0?void 0:e.isAuthorized())||!1}isPaused(){var e;return(e=this.state.connector)===null||e===void 0?void 0:e.isPaused()}disconnect(e){var n,r,i;G("[RemoteConnection: disconnect()]",e),e?.terminate&&(kt.getProvider().handleDisconnect({terminate:!0}),(r=(n=this.state.pendingModal)===null||n===void 0?void 0:n.unmount)===null||r===void 0||r.call(n),this.state.otpAnswer=void 0),(i=this.state.connector)===null||i===void 0||i.disconnect(e),(function(o){G("[RemoteConnection: cleanupConnector()] cleaning up connector"),o.connector&&(ca(o),o.connector.disconnect({terminate:!0}).catch((c=>{G("[RemoteConnection: cleanupConnector()] error disconnecting connector",c)})))})(this.state)}}function yy(t){var e,n,r,i,o,c,s,a,l,u,d;return J(this,void 0,void 0,(function*(){const{options:h}=t;if(h.logging=(e=h.logging)!==null&&e!==void 0?e:{},h.communicationLayerPreference=(n=h.communicationLayerPreference)!==null&&n!==void 0?n:Dn.SOCKET,h.enableDebug!==void 0&&(Je.enable("MM_SDK"),console.warn("enableDebug is removed. Please use enableAnalytics instead.")),h.enableAnalytics=(r=h.enableAnalytics)===null||r===void 0||r,h.injectProvider=(i=h.injectProvider)===null||i===void 0||i,h.shouldShimWeb3=(o=h.shouldShimWeb3)===null||o===void 0||o,h.extensionOnly=(c=h.extensionOnly)===null||c===void 0||c,h.useDeeplink=(s=h.useDeeplink)===null||s===void 0||s,h.storage=(a=h.storage)!==null&&a!==void 0?a:{enabled:!0},h.headless){Je("[MetaMaskSDK: performSDKInitialization()] headless mode enabled");const C=()=>{},_={install:()=>({mount:C,unmount:C})},O={installer:C};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,G("[MetaMaskSDK: performSDKInitialization()] options",t.options);const m=Object.assign({},h.logging);f&&(m.sdk=!0,m.eciesLayer=!0,m.keyExchangeLayer=!0,m.remoteLayer=!0,m.serviceLayer=!0,m.plaintext=!0),yield(function(C){var _;return J(this,void 0,void 0,(function*(){const{options:O}=C;C.platformManager=new Fr({useDeepLink:(_=O.useDeeplink)!==null&&_!==void 0&&_,preferredOpenLink:O.openDeeplink,debug:C.debug})}))})(t),yield(function(C){var _,O,L,U,q;return J(this,void 0,void 0,(function*(){const{options:F}=C,B=(_=C.platformManager)===null||_===void 0?void 0:_.getPlatformType();C.analytics=new ty({serverUrl:(O=F.communicationServerUrl)!==null&&O!==void 0?O:sr,enabled:F.enableAnalytics,originatorInfo:{url:(L=F.dappMetadata.url)!==null&&L!==void 0?L:"",title:(U=F.dappMetadata.name)!==null&&U!==void 0?U:"",dappId:C.getDappId(),platform:B??"",source:(q=F._source)!==null&&q!==void 0?q:"",anonId:""}})}))})(t),yield(function(C){var _,O,L;return J(this,void 0,void 0,(function*(){if(!C.options.enableAnalytics||!(!((_=C.platformManager)===null||_===void 0)&&_.isBrowser())&&!(!((O=C.platformManager)===null||O===void 0)&&O.isReactNative()))return;const U=C.getVersion(),q=C.getDappId(),F=yield C.getAnonId(),B=(L=C.platformManager)===null||L===void 0?void 0:L.getPlatformType(),N=C.options._source;Re.analytics.setGlobalProperty("sdk_version",U),Re.analytics.setGlobalProperty("dapp_id",q),Re.analytics.setGlobalProperty("anon_id",F),Re.analytics.setGlobalProperty("platform",B),Re.analytics.setGlobalProperty("integration_type",N),Re.analytics.enable(),Re.analytics.track("sdk_initialized",{})}))})(t),yield(function(C){var _;return J(this,void 0,void 0,(function*(){const{options:O}=C;((_=O.storage)===null||_===void 0?void 0:_.enabled)!==!0||O.storage.storageManager||(O.storage.storageManager=yield mf(O.storage))}))})(t),yield(function(C){return J(this,void 0,void 0,(function*(){const{options:_}=C,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>ry&&(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 L=ny();if(L&&!_.dappMetadata.iconUrl&&!_.dappMetadata.base64Icon){const U=`${window.location.protocol}//${window.location.host}${L}`;_.dappMetadata.iconUrl=U}}C.dappMetadata=_.dappMetadata}))})(t),yield oy(t),yield sy(t);const{metamaskBrowserExtension:g,preferExtension:w,shouldReturn:p}=yield(function(C){var _,O,L,U;return J(this,void 0,void 0,(function*(){const{options:q}=C;let F,B=!1,N=!1;if(typeof window<"u"&&window.ethereum&&!(!((_=C.platformManager)===null||_===void 0)&&_.isMetaMaskMobileWebView())){B=localStorage.getItem(yo)==="extension";try{F=yield iy({mustBeMetaMask:!0,sdkInstance:C}),window.extension=F,F.on(xt.CHAIN_CHANGED,(H=>{G(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE chainChanged chainId=${H}`),C.sdkProvider&&C.getMobileProvider().emit(xt.CHAIN_CHANGED,H)})),F.on(xt.ACCOUNTS_CHANGED,(H=>J(this,void 0,void 0,(function*(){var $;G(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE accountsChanged accounts=${H}`);const P=!!C.sdkProvider,M=!!C.extensionActive;if(P&&C.getMobileProvider().emit(xt.ACCOUNTS_CHANGED,H),M&&H?.length===0&&(yield($=C.getProvider())===null||$===void 0?void 0:$.request({method:de.WALLET_GETPE
28RMISSIONS,params:[]})).length===0)try{yield C.terminate()}catch(S){G("[MetaMaskSDK: setupExtensionPreferences()] error terminating on permissions revoked",S)}})))),F.on(xt.DISCONNECT,(H=>{G(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE disconnect error=${H}`),C.sdkProvider&&C.getMobileProvider().emit(xt.DISCONNECT,H)})),F.on(xt.CONNECT,(H=>{G(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE connect args=${H}`),C.sdkProvider&&C.getMobileProvider().emit(xt.CONNECT,H)})),F.on(xt.CONNECTED,(H=>{G("[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE connected",H),C.sdkProvider&&C.getMobileProvider().emit(xt.CONNECTED,H)}))}catch{window.extension=void 0}}else!((O=C.platformManager)===null||O===void 0)&&O.isMetaMaskMobileWebView()&&((L=C.analytics)===null||L===void 0||L.send({event:Oe.SDK_USE_INAPP_BROWSER}),C.activeProvider=vf({provider:window.ethereum,sdkInstance:C}),C._initialized=!0,N=!0);return F&&q.extensionOnly&&(G("[MetaMaskSDK: setupExtensionPreferences()] EXTENSION ONLY --- prevent sdk initialization"),(U=C.analytics)===null||U===void 0||U.send({event:Oe.SDK_USE_EXTENSION}),C.activeProvider=F,C.extensionActive=!0,C.extension=F,C._initialized=!0,N=!0),{preferExtension:B,shouldReturn:N,metamaskBrowserExtension:F}}))})(t);if(p)G("[MetaMaskSDK: performSDKInitialization()] shouldReturn=true --- prevent sdk initialization");else{yield(function(C,_){var O,L,U,q,F;return J(this,void 0,void 0,(function*(){const{options:B}=C,N=Object.assign({},B.logging);C.remoteConnection=new gy({anonId:yield C.getAnonId(),preferDesktop:(O=B.preferDesktop)!==null&&O!==void 0&&O,communicationLayerPreference:(L=B.communicationLayerPreference)!==null&&L!==void 0?L:Dn.SOCKET,analytics:C.analytics,dappMetadata:B.dappMetadata,_source:B._source,enableAnalytics:(U=B.enableAnalytics)===null||U===void 0||U,timer:B.timer,sdk:C,platformManager:C.platformManager,transports:B.transports,communicationServerUrl:B.communicationServerUrl,storage:(q=B.storage)!==null&&q!==void 0?q:{enabled:!0},getMetaMaskInstaller:()=>{if(!C.installer)throw new Error("Invalid SDK status -- installer not initialized");return C.installer},logging:N,connectWithExtensionProvider:_===void 0?void 0:()=>tu(C),modals:Object.assign(Object.assign({},B.modals),{onPendingModalDisconnect:C.terminate.bind(C)})}),yield C.remoteConnection.initRemoteCommunication({sdkInstance:C}),C.installer=new dy({remote:C.remoteConnection,preferDesktop:(F=B.preferDesktop)!==null&&F!==void 0&&F,platformManager:C.platformManager,debug:C.debug})}))})(t,g),yield Qg(t),yield(function(C,_){var O,L;return J(this,void 0,void 0,(function*(){const{options:U}=C;_?(G("[MetaMaskSDK: handleAutoAndExtensionConnections()] preferExtension is detected -- connect with it."),(O=C.analytics)===null||O===void 0||O.send({event:Oe.SDK_EXTENSION_UTILIZED}),tu(C).catch((q=>{console.warn("Can't connect with MetaMask extension...",q),localStorage.removeItem(yo)}))):U.checkInstallationImmediately&&(!((L=C.platformManager)===null||L===void 0)&&L.isDesktopWeb()?(G("[MetaMaskSDK: handleAutoAndExtensionConnections()] checkInstallationImmediately"),C.connect().catch((q=>{G(`[MetaMaskSDK: handleAutoAndExtensionConnections()] checkInstallationImmediately --- IGNORED --- error on autoconnect _err=${q}`)}))):console.warn("[handleAutoAndExtensionConnections()] checkInstallationImmediately --- IGNORED --- only for web desktop")),C._initialized=!0}))})(t,w);try{yield(d=t.remoteConnection)===null||d===void 0?void 0:d.startConnection({initialCheck:!0})}catch(C){console.error("[MetaMaskSDK: setupRemoteConnectionAndInstaller()] Error while checking installation",C)}t.emit(nt.ProviderUpdate,Kt.INITIALIZED)}}))}class sv extends np{constructor(e={storage:{enabled:!0},injectProvider:!0,forceInjectProvider:!1,enableAnalytics:!0,shouldShimWeb3:!0,useDeeplink:!0,extensionOnly:!0,headless:!1,dappMetadata:{name:"",url:"",iconUrl:""},_source:Ql,i18nOptions:{enabled:!1}}){var n,r,i;super(),this.extensionActive=!1,this._initialized=!1,this.sdkInitPromise=void 0,this.debug=!1,this.readonlyRPCCalls=!1,this.availableLanguages=["en"],this.ANON_ID_STORAGE_KEY="mm-sdk-anon-id",Je.disable();const o=((n=e.logging)===null||n===void 0?void 0:n.developerMode)===!0;if((!((r=e.logging)===null||r===void 0)&&r.sdk||o)&&Je.enable("MM_SDK"),G("[MetaMaskSDK: constructor()]: begin."),this.setMaxListeners(50),!(!((i=e.dappMetadata)===null||i===void 0)&&i.url)){if(typeof window>"u"||typeof document>"u")throw new Error("You must provide dAppMetadata url");e.dappMetadata=Object.assign(Object.assign({},e.dappMetadata),{url:`${window.location.protocol}//${window.location.host}`})}this.options=e,this.options._source||(e._source=Ql),this.init().then((()=>{G("[MetaMaskSDK: constructor()]: initialized successfully."),typeof window<"u"&&(window.mmsdk=this)})).catch((c=>{console.error("[MetaMaskSDK: constructor()] error during initialization",c)}))}init(){return J(this,void 0,void 0,(function*(){return(function(e){var n;return J(this,void 0,void 0,(function*(){if(typeof window<"u"&&(!((n=window.mmsdk)===null||n===void 0)&&n.isInitialized()))return G("[MetaMaskSDK: initializeMetaMaskSDK()] already initialized"),Promise.resolve(window.mmsdk);if(e._initialized)return G("[MetaMaskSDK: initializeMetaMaskSDK()] already initialized"),e.sdkInitPromise;if(e.sdkInitPromise)return G("[MetaMaskSDK: initializeMetaMaskSDK()] already initializing"),e.sdkInitPromise;try{e.sdkInitPromise=yy(e),yield e.sdkInitPromise}catch(r){throw console.error(r),r}return e.sdkInitPromise}))})(this)}))}isExtensionActive(){return this.extensionActive}checkExtensionAvailability(){var e;return typeof window<"u"&&!!(!((e=window.ethereum)===null||e===void 0)&&e.isMetaMask)}connect(){return J(this,void 0,void 0,(function*(){return(function(e){return J(this,void 0,void 0,(function*(){if(e._initialized||(G("[MetaMaskSDK: connect()] provider not ready -- wait for init()"),yield e.init()),G(`[MetaMaskSDK: connect()] isExtensionActive=${e.isExtensionActive()} activeProvider`,e.activeProvider),!e.activeProvider)throw new Error("SDK state invalid -- undefined provider");const n=e.activeProvider.getSelectedAddress();return n?[n]:e.activeProvider.request({method:de.ETH_REQUESTACCOUNTS,params:[]})}))})(this)}))}connectAndSign({msg:e}){return J(this,void 0,void 0,(function*(){return Yg({instance:this,msg:e})}))}connectWith(e){return J(this,void 0,void 0,(function*(){return(function({instance:n,rpc:r}){return J(this,void 0,void 0,(function*(){if(n._initialized||(G("[MetaMaskSDK: connectWith()] provider not ready -- wait for init()"),yield n.init()),G(`[MetaMaskSDK: connectWith()] method: ${r.method} rpc=${r}`),!n.activeProvider)throw new Error("SDK state invalid -- undefined provider");return n.activeProvider.request({method:de.METAMASK_CONNECTWITH,params:[r]})}))})({instance:this,rpc:e})}))}resume(){return(function(e){var n,r,i;return J(this,void 0,void 0,(function*(){if(!(!((r=(n=e.remoteConnection)===null||n===void 0?void 0:n.getConnector())===null||r===void 0)&&r.isReady()))return G("[MetaMaskSDK: resume()] channel is not ready -- starting connection"),void((i=e.remoteConnection)===null||i===void 0||i.startConnection());G("[MetaMaskSDK: resume()] channel is ready")}))})(this)}disconnect(){return console.warn("MetaMaskSDK.disconnect() is deprecated, use terminate()"),this.terminate()}isAuthorized(){var e;(e=this.remoteConnection)===null||e===void 0||e.isAuthorized()}terminate(){return(function(e){var n,r,i;return J(this,void 0,void 0,(function*(){if(!(!((n=e.platformManager)===null||n===void 0)&&n.isMetaMaskMobileWebView())){if(Gg&&(window.localStorage.removeItem(yo),window.localStorage.removeItem(aa),window.localStorage.removeItem(sa)),e.extensionActive){try{yield(r=e.activeProvider)===null||r===void 0?void 0:r.request({method:de.WALLET_REVOKEPERMISSIONS,params:[{eth_accounts:{}}]})}catch(o){G("[MetaMaskSDK: terminate()] error revoking permissions",o)}
28return e.options.extensionOnly?(e.emit(nt.ProviderUpdate,Kt.TERMINATE),void G("[MetaMaskSDK: terminate()] extensionOnly --- prevent switching providers")):(e.activeProvider=e.sdkProvider,window.ethereum=e.activeProvider,e.extensionActive=!1,void e.emit(nt.ProviderUpdate,Kt.TERMINATE))}e.emit(nt.ProviderUpdate,Kt.TERMINATE),G(`[MetaMaskSDK: terminate()] remoteConnection=${e.remoteConnection}`),(i=e.remoteConnection)===null||i===void 0||i.disconnect({terminate:!0,sendMessage:!0})}}))})(this)}isInitialized(){return this._initialized}setReadOnlyRPCCalls(e){this.readonlyRPCCalls=e}hasReadOnlyRPCCalls(){return this.readonlyRPCCalls}getProvider(){if(this.activeProvider)return this.activeProvider;console.warn("MetaMaskSDK: No active provider found")}getMobileProvider(){if(!this.sdkProvider)throw new Error("SDK state invalid -- undefined mobile provider");return this.sdkProvider}getUniversalLink(){var e;const n=(e=this.remoteConnection)===null||e===void 0?void 0:e.getUniversalLink();if(!n)throw new Error("No Universal Link available, please call eth_requestAccounts first.");return n}getChannelId(){var e,n;return(n=(e=this.remoteConnection)===null||e===void 0?void 0:e.getChannelConfig())===null||n===void 0?void 0:n.channelId}getRPCHistory(){var e,n;return(n=(e=this.remoteConnection)===null||e===void 0?void 0:e.getConnector())===null||n===void 0?void 0:n.getRPCMethodTracker()}getVersion(){return 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 J(this,void 0,void 0,(function*(){if(this._anonId)return this._anonId;let r;return r=!((e=this.platformManager)===null||e===void 0)&&e.isBrowser()?this.getBrowserAnonId():!((n=this.platformManager)===null||n===void 0)&&n.isReactNative()?yield this.getReactNativeAnonId():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 J(this,void 0,void 0,(function*(){const e=this.ANON_ID_STORAGE_KEY;try{const n=require("@react-native-async-storage/async-storage").default,r=yield n.getItem(e);if(r)return r;const i=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 vy=Object.freeze({__proto__:null,StorageManagerWeb:class{constructor({enabled:t}={enabled:!1}){this.enabled=!1,this.enabled=t}persistChannelConfig(t){return J(this,void 0,void 0,(function*(){const e=JSON.stringify(t);G(`[StorageManagerWeb: persistChannelConfig()] enabled=${this.enabled}`,t),localStorage.setItem(As,e)}))}getPersistedChannelConfig(){return J(this,void 0,void 0,(function*(){let t;try{if(G(`[StorageManagerWeb: getPersistedChannelConfig()] enabled=${this.enabled}`),t=localStorage.getItem(As),G("[StorageManagerWeb: getPersistedChannelConfig()]",t),!t)return;const e=JSON.parse(t);return G("[StorageManagerWeb: getPersistedChannelConfig()] channelConfig",e),e}catch(e){return void console.error("[StorageManagerWeb: getPersistedChannelConfig()] Can't find existing channel config",e)}}))}persistAccounts(t){return J(this,void 0,void 0,(function*(){G(`[StorageManagerWeb: persistAccounts()] enabled=${this.enabled}`,t);const e=JSON.stringify(t);localStorage.setItem(sa,e)}))}getCachedAccounts(){return J(this,void 0,void 0,(function*(){try{const t=localStorage.getItem(sa);return t?JSON.parse(t):[]}catch(t){throw console.error("[StorageManagerWeb: getCachedAccounts()] Error reading cached accounts",t),t}}))}persistChainId(t){return J(this,void 0,void 0,(function*(){G(`[StorageManagerWeb: persistChainId()] enabled=${this.enabled}`,t),localStorage.setItem(aa,t)}
28))}getCachedChainId(){return J(this,void 0,void 0,(function*(){try{const t=localStorage.getItem(aa);return t??void 0}catch(t){throw console.error("[StorageManagerWeb: getCachedChainId()] Error reading cached chainId",t),t}}))}terminate(){return J(this,void 0,void 0,(function*(){G(`[StorageManagerWeb: terminate()] enabled=${this.enabled}`),localStorage.removeItem(As)}))}}});const by="hydrated",wy=!1,Ey=!0;var _y=Object.defineProperty,Va=new WeakMap,wn=t=>Va.get(t),Wa=(t,e)=>Va.set(e.$lazyInstance$=t,e),du=(t,e)=>e in t,Nn=(t,e)=>(0,console.error)(t,e),xs=new Map,Vi=new Map,_f="slot-fb{display:contents}slot-fb[hidden]{display:none}",Oo=typeof window<"u"?window:{},Dt=Oo.document||{head:{}},je={$flags$:0,$resourcesUrl$:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,n,r)=>t.addEventListener(e,n,r),rel:(t,e,n,r)=>t.removeEventListener(e,n,r),ce:(t,e)=>new CustomEvent(t,e)},Sf=(()=>{try{return new CSSStyleSheet,typeof new CSSStyleSheet().replaceSync=="function"}catch{}return!1})(),la=!1,hu=[],Cf=[],Sy=(t,e)=>n=>{t.push(n),la||(la=!0,4&je.$flags$?Ga(ua):je.raf(ua))},fu=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(n){Nn(n)}t.length=0},ua=()=>{fu(hu),fu(Cf),(la=hu.length>0)&&je.raf(ua)},Ga=t=>(e=>Promise.resolve(e))().then(t),Cy=Sy(Cf),pu={},Ya=t=>(t=typeof t)=="object"||t==="function";function kf(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)_y(t,n,{get:e[n],enumerable:!0})})({},{err:()=>Af,map:()=>ky,ok:()=>da,unwrap:()=>Ay,unwrapErr:()=>xy});var da=t=>({isOk:!0,isErr:!1,value:t}),Af=t=>({isOk:!1,isErr:!0,value:t});function ky(t,e){if(t.isOk){const n=e(t.value);return n instanceof Promise?n.then((r=>da(r))):da(n)}if(t.isErr){const n=t.value;return Af(n)}throw"should never get here"}var Za,Ay=t=>{if(t.isOk)return t.value;throw t.value},xy=t=>{if(t.isErr)return t.value;throw t.value},Y=(t,e,...n)=>{let r=null,i=!1,o=!1;const c=[],s=l=>{for(let u=0;u<l.length;u++)r=l[u],Array.isArray(r)?s(r):r!=null&&typeof r!="boolean"&&((i=typeof t!="function"&&!Ya(r))&&(r=String(r)),i&&o?c[c.length-1].$text$+=r:c.push(i?wo(null,r):r),o=i)};if(s(n),e){const l=e.className||e.class;l&&(e.class=typeof l!="object"?l:Object.keys(l).filter((u=>l[u])).join(" "))}if(typeof t=="function")return t(e===null?{}:e,c,My);const a=wo(t,null);return a.$attrs$=e,c.length>0&&(a.$children$=c),a},wo=(t,e)=>({$flags$:0,$tag$:t,$text$:e,$elm$:null,$children$:null,$attrs$:null}),Ty={},My={forEach:(t,e)=>t.map(mu).forEach(e),map:(t,e)=>t.map(mu).map(e).map(Ry)},mu=t=>({vattrs:t.$attrs$,vchildren:t.$children$,vkey:t.$key$,vname:t.$name$,vtag:t.$tag$,vtext:t.$text$}),Ry=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=wo(t.vtag,t.vtext);return e.$attrs$=t.vattrs,e.$children$=t.vchildren,e.$key$=t.vkey,e.$name$=t.vname,e},Po=t=>wn(t).$hostElement$,Sn=(t,e,n)=>{const r=Po(t);return{emit:i=>xf(r,e,{bubbles:!0,composed:!0,cancelable:!0,detail:i})}},xf=(t,e,n)=>{const r=je.ce(e,n);return t.dispatchEvent(r),r},gu=new WeakMap,Oy=t=>{const e=t.$cmpMeta$,n=t.$hostElement$,r=e.$flags$;e.$tagName$;const i=((o,c,s)=>{var a;const l=Tf(c),u=Vi.get(l);if(o=o.nodeType===11?o:Dt,u)if(typeof u=="string"){o=o.head||o;let d,h=gu.get(o);if(h||gu.set(o,h=new Set),!h.has(l)){{d=Dt.createElement("style"),d.innerHTML=u;const f=(a=je.$nonce$)!=null?a:kf(Dt);if(f!=null&&d.setAttribute("nonce",f),!(1&c.$flags$))if(o.nodeName==="HEAD"){const m=o.querySelectorAll("link[rel=preconnect]"),g=m.length>0?m[m.length-1].nextSibling:o.querySelector("style");o.insertBefore(d,g)}else if("host"in o)if(Sf){const m=new CSSStyleSheet;m.replaceSync(u),o.adoptedStyleSheets=[m,...o.adoptedStyleSheets]}else{const m=o.querySelector("style");m?m.innerHTML=u+m.innerHTML:o.prepend(d)}else o.append(d);1&c.$flags$&&o.nodeName!=="HEAD"&&o.insertBefore(d,null)}4&c.$flags$&&(d.innerHTML+=_f),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"))},Tf=(t,e)=>"sc-"+t.$tagName$,yu=(t,e,n,r,i,o)=>
28{if(n!==r){let c=du(t,e),s=e.toLowerCase();if(e==="class"){const a=t.classList,l=vu(n),u=vu(r);a.remove(...l.filter((d=>d&&!u.includes(d)))),a.add(...u.filter((d=>d&&!l.includes(d))))}else if(e==="style"){for(const a in n)r&&r[a]!=null||(a.includes("-")?t.style.removeProperty(a):t.style[a]="");for(const a in r)n&&r[a]===n[a]||(a.includes("-")?t.style.setProperty(a,r[a]):t.style[a]=r[a])}else if(c||e[0]!=="o"||e[1]!=="n"){const a=Ya(r);if((c||a&&r!==null)&&!i)try{if(t.tagName.includes("-"))t[e]=r;else{const l=r??"";e==="list"?c=!1:n!=null&&t[e]==l||(typeof t.__lookupSetter__(e)=="function"?t[e]=l:t.setAttribute(e,l))}}catch{}r==null||r===!1?r===!1&&t.getAttribute(e)!==""||t.removeAttribute(e):(!c||4&o||i)&&!a&&(r=r===!0?"":r,t.setAttribute(e,r))}else if(e=e[2]==="-"?e.slice(3):du(Oo,s)?s.slice(2):s[2]+e.slice(3),n||r){const a=e.endsWith(Mf);e=e.replace(Iy,""),n&&je.rel(t,e,n,a),r&&je.ael(t,e,r,a)}}},Py=/\s/,vu=t=>t?t.split(Py):[],Mf="Capture",Iy=new RegExp(Mf+"$"),Rf=(t,e,n)=>{const r=e.$elm$.nodeType===11&&e.$elm$.host?e.$elm$.host:e.$elm$,i=t&&t.$attrs$||pu,o=e.$attrs$||pu;for(const c of bu(Object.keys(i)))c in o||yu(r,c,i[c],void 0,n,e.$flags$);for(const c of bu(Object.keys(o)))yu(r,c,i[c],o[c],n,e.$flags$)};function bu(t){return t.includes("ref")?[...t.filter((e=>e!=="ref")),"ref"]:t}var yt=!1,Ja=(t,e,n,r)=>{const i=e.$children$[n];let o,c,s=0;if(i.$text$!==null)o=i.$elm$=Dt.createTextNode(i.$text$);else{if(yt||(yt=i.$tag$==="svg"),o=i.$elm$=Dt.createElementNS(yt?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",i.$tag$),yt&&i.$tag$==="foreignObject"&&(yt=!1),Rf(null,i,yt),o.getRootNode().querySelector("body"),i.$children$)for(s=0;s<i.$children$.length;++s)c=Ja(t,i,s),c&&o.appendChild(c);i.$tag$==="svg"?yt=!1:o.tagName==="foreignObject"&&(yt=!0)}return o["s-hn"]=Za,o},wu=(t,e,n,r,i,o)=>{let c,s=t;for(s.shadowRoot&&s.tagName===Za&&(s=s.shadowRoot);i<=o;++i)r[i]&&(c=Ja(null,n,i),c&&(r[i].$elm$=c,Wi(s,c,e)))},Eu=(t,e,n)=>{for(let r=e;r<=n;++r){const i=t[r];if(i){const o=i.$elm$;o&&o.remove()}}},Ai=(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$,c=e.$tag$,s=e.$text$;s===null?(Rf(t,e,yt=c==="svg"||c!=="foreignObject"&&yt),i!==null&&o!==null?((a,l,u,d,h=!1)=>{let f,m=0,g=0,w=l.length-1,p=l[0],C=l[w],_=d.length-1,O=d[0],L=d[_];for(;m<=w&&g<=_;)p==null?p=l[++m]:C==null?C=l[--w]:O==null?O=d[++g]:L==null?L=d[--_]:Ai(p,O,h)?(Cr(p,O,h),p=l[++m],O=d[++g]):Ai(C,L,h)?(Cr(C,L,h),C=l[--w],L=d[--_]):Ai(p,L,h)?(Cr(p,L,h),Wi(a,p.$elm$,C.$elm$.nextSibling),p=l[++m],L=d[--_]):Ai(C,O,h)?(Cr(C,O,h),Wi(a,C.$elm$,p.$elm$),C=l[--w],O=d[++g]):(f=Ja(l&&l[g],u,g),O=d[++g],f&&Wi(p.$elm$.parentNode,f,p.$elm$));m>w?wu(a,d[_+1]==null?null:d[_+1].$elm$,u,d,g,_):g>_&&Eu(l,m,w)})(r,i,e,o,n):o!==null?(t.$text$!==null&&(r.textContent=""),wu(r,null,e,o,0,o.length-1)):!n&&Ey&&i!==null&&Eu(i,0,i.length-1),yt&&c==="svg"&&(yt=!1)):t.$text$!==s&&(r.data=s)},Wi=(t,e,n)=>t?.insertBefore(e,n),Ly=(t,e,n=!1)=>{const r=t.$hostElement$,i=t.$cmpMeta$,o=t.$vnode$||wo(null,null),c=(s=e)&&s.$tag$===Ty?e:Y(null,null,e);var s;if(Za=r.tagName,n&&c.$attrs$)for(const a of Object.keys(c.$attrs$))r.hasAttribute(a)&&!["key","ref","style","class"].includes(a)&&(c.$attrs$[a]=r[a]);c.$tag$=null,c.$flags$|=4,t.$vnode$=c,c.$elm$=o.$elm$=r.shadowRoot||r,r["s-sc"],1&i.$flags$,Cr(o,c,n)},Of=(t,e)=>{e&&!t.$onRenderResolve$&&e["s-p"]&&e["s-p"].push(new Promise((n=>t.$onRenderResolve$=n)))},Xa=(t,e)=>(t.$flags$|=16,4&t.$flags$?void(t.$flags$|=512):(Of(t,t.$ancestorComponent$),Cy((()=>Ny(t,e))))),Ny=(t,e)=>{const n=t.$hostElement$;t.$cmpMeta$.$tagName$;const r=t.$lazyInstance$;if(!r)throw new Error(`Can't render component <${n.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);return Dy(void 0,(()=>$y(t,r,e)))},Dy=(t,e)=>By(t)?t.then(e).catch((n=>{console.error(n),e()})):e(),By=t=>t instanceof Promise||t&&t.then&&typeof t.then=="function",$y=async(t,e,n)=>{var r;const i=t.$hostElement$;t.$cmpMeta$.$tagName$;const o=i["s-rc"];n&&Oy(t),t.$cmpMeta$.$tagName$,Ky(t,e,i,n),o&&(o.map((c=>c())),i["s-rc"]=void 0);{const c=(r=i["s-p"])!=null?r:[],s=()=>jy(t);c.length===0?s():(Promise.all(c).then(s),t.$flags$|=4,c.length=0)}},Ky=(t,e,n,r)=>{try{e=e.render(),t.$flags$&=-17,t.$flags$|=2,Ly(t,e,r)}catch(i){Nn(i,t.$hostElement$)}return null},jy=t=>{t.$cmpMeta$.$tagName$;const e=t.$hostElement$,n=()=>{},r=t.$lazyInstance$,i=t.$ancestorComponent$;64&t.$flags$?n():(t.$flags$|=64,If(e),Qa(r,"componentDidLoad"),t.$onReadyResolve$(e),i||Pf()),t.$onRenderResolve$&&(t.$onRenderResolve$(),t.$onRenderResolve$=void 0),512&t.$flags$&&Ga((()=>Xa(t,!1))),t.$flags$&=-517},Pf=t=>{If(Dt.documentElement),Ga((()=>xf(Oo,"appload",{detail:{namespace:"sdk-install-modal-web"}})))},Qa=(t,e,n)=>{if(t&&t[e])try{return t[e](n)}catch(r){Nn(r)}},If=t=>{var e;return t.classList.add((e=by)!=null?e:"hydrated")},Uy=(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$,c=i.$instanceValues$.get(e),s=i.$flags$,a=i.$lazyInstance$;var l,u;l=n,u=r.$members$[e][0],n=l==null||Ya(l)?l:4&u?l!=="false"&&(l===""||!!l):1&u?String(l):l;const d=Number.isNaN(c)&&Number.isNaN(n);if((!(8&s)||c===void 0)&&n!==c&&!d&&(i.$instanceValues$.set(e,n),a)){if(r.$watchers$&&128&s){const h=r.$watchers$[e];h&&h.map((f=>{try{a[f](n,c,e)}catch(m){Nn(m,o)}}))}(18&s)==2&&Xa(i,!1)}},Lf=(t,e,n)=>{var r,i;const o=t.prototype;
28if(e.$members$||e.$watchers$||t.watchers){t.watchers&&!e.$watchers$&&(e.$watchers$=t.watchers);const c=Object.entries((r=e.$members$)!=null?r:{});if(c.map((([s,[a]])=>{(31&a||2&n&&32&a)&&Object.defineProperty(o,s,{get(){return l=s,wn(this).$instanceValues$.get(l);var l},set(l){Uy(this,s,l,e)},configurable:!0,enumerable:!0})})),1&n){const s=new Map;o.attributeChangedCallback=function(a,l,u){je.jmp((()=>{var d;const h=s.get(a);if(this.hasOwnProperty(h))u=this[h],delete this[h];else{if(o.hasOwnProperty(h)&&typeof this[h]=="number"&&this[h]==u)return;if(h==null){const f=wn(this),m=f?.$flags$;if(m&&!(8&m)&&128&m&&u!==l){const g=f.$lazyInstance$,w=(d=e.$watchers$)==null?void 0:d[a];w?.forEach((p=>{g[p]!=null&&g[p].call(g,u,l,a)}))}return}}this[h]=(u!==null||typeof this[h]!="boolean")&&u}))},t.observedAttributes=Array.from(new Set([...Object.keys((i=e.$watchers$)!=null?i:{}),...c.filter((([a,l])=>15&l[0])).map((([a,l])=>{const u=l[1]||a;return s.set(u,a),u}))]))}}return t},Hy=async(t,e,n,r)=>{let i;if((32&e.$flags$)==0){if(e.$flags$|=32,n.$lazyBundleId$){const s=((a,l,u)=>{const d=a.$tagName$.replace(/-/g,"_"),h=a.$lazyBundleId$;if(!h)return;const f=xs.get(h);if(f)return f[d];{const m=g=>(xs.set(h,g),g[d]);if(h==="mm-install-modal_3")return Promise.resolve().then((function(){return rv})).then(m,Nn)}return Vf(()=>import(`./${h}.entry.js`),[]).then((m=>(xs.set(h,m),m[d])),Nn)})(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,Lf(i,n,2),i.isProxied=!0),n.$tagName$,e.$flags$|=8;try{new i(e)}catch(a){Nn(a)}e.$flags$&=-9,e.$flags$|=128,ha(e.$lazyInstance$)}else{i=t.constructor;const s=t.localName;customElements.whenDefined(s).then((()=>e.$flags$|=128))}if(i&&i.style){let s;typeof i.style=="string"&&(s=i.style);const a=Tf(n);Vi.has(a)||(n.$tagName$,((l,u,d)=>{let h=Vi.get(l);Sf&&d?(h=h||new CSSStyleSheet,typeof h=="string"?h=u:h.replaceSync(u)):h=u,Vi.set(l,h)})(a,s,!!(1&n.$flags$)))}}const o=e.$ancestorComponent$,c=()=>Xa(e,!0);o&&o["s-rc"]?o["s-rc"].push(c):c()},ha=t=>{Qa(t,"connectedCallback")},_u=t=>{Qa(t,"disconnectedCallback")},Fy=(t,e={})=>{var n;const r=[],i=e.exclude||[],o=Oo.customElements,c=Dt.head,s=c.querySelector("meta[charset]"),a=Dt.createElement("style"),l=[];let u,d=!0;Object.assign(je,e),je.$resourcesUrl$=new URL(e.resourcesUrl||"./",Dt.baseURI).href;let h=!1;if(t.map((f=>{f[1].map((m=>{var g;const w={$flags$:m[0],$tagName$:m[1],$members$:m[2],$listeners$:m[3]};4&w.$flags$&&(h=!0),w.$members$=m[2],w.$watchers$=(g=m[4])!=null?g:{};const p=w.$tagName$,C=class extends HTMLElement{constructor(_){if(super(_),this.hasRegisteredEventListeners=!1,((O,L)=>{const U={$flags$:0,$hostElement$:O,$cmpMeta$:L,$instanceValues$:new Map};U.$onReadyPromise$=new Promise((q=>U.$onReadyResolve$=q)),O["s-p"]=[],O["s-rc"]=[],Va.set(O,U)})(_=this,w),1&w.$flags$)if(_.shadowRoot){if(_.shadowRoot.mode!=="open")throw new Error(`Unable to re-use existing shadow root for ${w.$tagName$}! Mode is set to ${_.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else _.attachShadow({mode:"open"})}connectedCallback(){wn(this),this.hasRegisteredEventListeners||(this.hasRegisteredEventListeners=!0),u&&(clearTimeout(u),u=null),d?l.push(this):je.jmp((()=>(_=>{if((1&je.$flags$)==0){const O=wn(_),L=O.$cmpMeta$;if(L.$tagName$,1&O.$flags$)O?.$lazyInstance$?ha(O.$lazyInstance$):O?.$onReadyPromise$&&O.$onReadyPromise$.then((()=>ha(O.$lazyInstance$)));else{O.$flags$|=1;{let U=_;for(;U=U.parentNode||U.host;)if(U["s-p"]){Of(O,O.$ancestorComponent$=U);break}}L.$members$&&Object.entries(L.$members$).map((([U,[q]])=>{if(31&q&&_.hasOwnProperty(U)){const F=_[U];delete _[U],_[U]=F}})),Hy(_,O,L)}}})(this)))}disconnectedCallback(){je.jmp((()=>(async _=>{if((1&je.$flags$)==0){const O=wn(_);O?.$lazyInstance$?_u(O.$lazyInstance$):O?.$onReadyPromise$&&O.$onReadyPromise$.then((()=>_u(O.$lazyInstance$)))}})(this)))}componentOnReady(){return wn(this).$onReadyPromise$}};w.$lazyBundleId$=f[0],i.includes(p)||o.get(p)||(r.push(p),o.define(p,Lf(C,w,1)))}))})),r.length>0&&(h&&(a.textContent+=_f),a.textContent+=r.sort()+"{visibility:hidden}.hydrated{visibility:inherit}",a.innerHTML.length)){a.setAttribute("data-styles","");const f=(n=je.$nonce$)!=null?n:kf(Dt);f!=null&&a.setAttribute("nonce",f),c.insertBefore(a,s?s.nextSibling:c.firstChild)}d=!1,l.length?l.map((f=>f.connectedCallback())):je.jmp((()=>u=setTimeout(Pf,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 qy=Object.freeze({__proto__:null,defineCustomElements:async(t,e)=>{if(typeof window<"u")return await void 0,Fy([["mm-install-modal_3",[[1,"mm-install-modal",{link:[1],sdkVersion:[1,"sdk-version"],preferDesktop:[4,"prefer-desktop"],tab:[32],isDefaultTab:[32],translationsLoaded:[32]},null,{preferDesktop:["updatePreferDesktop"]}],[1,"mm-pending-modal",{displayOTP:[4,"display-o-t-p"],sdkVersion:[1,"sdk-version"],otpCode:[1,"otp-code"],translationsLoaded:[32]}],[1,"mm-select-modal",{link:[1],sdkVersion:[1,"sdk-version"],preferDesktop:[4,"prefer-desktop"],tab:[32],isDefaultTab:[32],translationsLoaded:[32]},null,{preferDesktop:["updatePreferDesktop"]}]]]],e)},setNonce:t=>je.$nonce$=t});const zy={fontFamily:"Roboto, sans-serif"},ec=({className:t},e)=>Y("div",{style:zy,class:t},e),Ts=({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))),Vy=()=>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
28C15.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"})),Wy=()=>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"})),Gy=()=>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"})),Yy=()=>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 tc({version:t}){return Y("div",{style:{textAlign:"center",color:"#BBC0C5",fontSize:"12"}},"SDK Version ",t?`v${t}`:"unknown")}const nc=()=>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"})),rc=()=>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
28-.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 Su(t,e){const n=t%e;return n>=0?n:e+n}function lt(t,e){return new Array(t).fill(e)}function Cu(...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 ku(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 Au(t){return{has:e=>t.includes(e),decode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="string")throw new Error("alphabet.decode input should be array of strings");return e.map((n=>{if(typeof n!="string")throw new Error(`alphabet.decode: not string element=${n}`);const r=t.indexOf(n);if(r===-1)throw new Error(`Unknown letter: "${n}". Allowed: ${t}`);return r}))},encode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return e.map((n=>{if((function(r){if(!Number.isSafeInteger(r))throw new Error(`Wrong integer: ${r}`)})(n),n<0||n>=t.length)throw new Error(`Digit index outside alphabet: ${n} (alphabet: ${t.length})`);return t[n]}))}}}class at{static size(e,n){if(typeof e=="number"&&(e={height:e,width:e}),!Number.isSafeInteger(e.height)&&e.height!==1/0)throw new Error(`Bitmap: wrong height=${e.height} (${typeof e.height})`);if(!Number.isSafeInteger(e.width)&&e.width!==1/0)throw new Error(`Bitmap: wrong width=${e.width} (${typeof e.width})`);return n!==void 0&&(e={width:Math.min(e.width,n.width),height:Math.min(e.height,n.height)}),e}static fromString(e){const n=(e=e.replace(/^\n+/g,"").replace(/\n+$/g,"")).split(`
29`),r=n.length,i=new Array(r);let o;for(const c of n){const s=c.split("").map((a=>{if(a==="X")return!0;if(a===" ")return!1;if(a!=="?")throw new Error(`Bitmap.fromString: unknown symbol=${a}`)}));if(o&&s.length!==o)throw new Error(`Bitmap.fromString different row sizes: width=${o} cur=${s.length}`);o=s.length,i.push(s)}return o||(o=0),new at({height:r,width:o},i)}constructor(e,n){const{height:r,width:i}=at.size(e);this.data=n||Array.from({length:r},(()=>lt(i,void 0))),this.height=r,this.width=i}point(e){return this.data[e.y][e.x]}isInside(e){return 0<=e.x&&e.x<this.width&&0<=e.y&&e.y<this.height}size(e){if(!e)return{height:this.height,width:this.width};const{x:n,y:r}=this.xy(e);return{height:this.height-r,width:this.width-n}}xy(e){if(typeof e=="number"&&(e={x:e,y:e}),!Number.isSafeInteger(e.x))throw new Error(`Bitmap: wrong x=${e.x}`);if(!Number.isSafeInteger(e.y))throw new Error(`Bitmap: wrong y=${e.y}`);return e.x=Su(e.x,this.width),e.y=Su(e.y,this.height),e}rect(e,n,r){const{x:i,y:o}=this.xy(e),{height:c,width:s}=at.size(n,this.size({x:i,y:o}));for(let a=0;a<c;a++)for(let l=0;l<s;l++)this.data[o+a][i+l]=typeof r=="function"?r({x:l,y:a},this.data[o+a][i+l]):r;return this}rectRead(e,n,r){return this.rect(e,n,((i,o)=>(r(i,o),o)))}hLine(e,n,r){return this.rect(e,{width:n,height:1},r)}vLine(e,n,r){return this.rect(e,{width:1,height:n},r)}border(e=2,n){const r=this.height+2*e,i=this.width+2*e,o=lt(e,n),c=Array.from({length:e},(()=>lt(i,n)));return new at({height:r,width:i},[...c,...this.data.map((s=>[...o,...s,...o])),...c])}embed(e,n){return this.rect(e,n.size(),(({x:r,y:i})=>n.data[i][r]))}rectSlice(e,n=this.size()){const r=new at(at.size(n,this.size(this.xy(e))));return this.rect(e,n,(({x:i,y:o},c)=>r.data[o][i]=c)),r}inverse(){const{height:e,width:n}=this;return new at({height:n,width:e}).rect({x:0,y:0},1/0,(({x:r,y:i})=>this.data[r][i]))}scale(e){if(!Number.isSafeInteger(e)||e>1024)throw new Error(`Wrong scale factor: ${e}`);const{height:n,width:r}=this;return new at({height:e*n,width:e*r}).rect({x:0,y:0},1/0,(({x:i,y:o})=>this.data[Math.floor(o/e)][Math.floor(i/e)]))}clone(){return new at(this.size()).rect({x:0,y:0},this.size(),(({x:e,y:n})=>this.data[n][e]))}
29assertDrawn(){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(`
30`)}toASCII(){const{height:e,width:n,data:r}=this;let i="";for(let o=0;o<e;o+=2){for(let c=0;c<n;c++){const s=r[o][c],a=o+1>=e||r[o+1][c];s||a?!s&&a?i+="▀":s&&!a?i+="▄":s&&a&&(i+=" "):i+="█"}i+=`
31`}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(`
32`)}toSVG(){let e=`<svg xmlns:svg="http://www.w3.org/2000/svg" viewBox="0 0 ${this.width} ${this.height}" version="1.1" xmlns="http://www.w3.org/2000/svg">`;return this.rectRead(0,1/0,(({x:n,y:r},i)=>{i&&(e+=`<rect x="${n}" y="${r}" width="1" height="1" />`)})),e+="</svg>",e}toGIF(){const e=s=>[255&s,s>>>8&255],n=[...e(this.width),...e(this.height)],r=[];this.rectRead(0,1/0,((s,a)=>r.push(+(a===!0))));const i=126,o=[71,73,70,56,55,97,...n,246,0,0,255,255,255,...lt(381,0),44,0,0,0,0,...n,0,7],c=Math.floor(r.length/i);for(let s=0;s<c;s++)o.push(127,128,...r.slice(i*s,i*(s+1)).map((a=>+a)));return o.push(r.length%i+1,128,...r.slice(c*i).map((s=>+s))),o.push(1,129,0,59),new Uint8Array(o)}toImage(e=!1){const{height:n,width:r}=this.size(),i=new Uint8Array(n*r*(e?3:4));let o=0;for(let c=0;c<n;c++)for(let s=0;s<r;s++){const a=this.data[c][s]?0:255;i[o++]=a,i[o++]=a,i[o++]=a,e||(i[o++]=255)}return{height:n,width:r,data:i}}}const xu=["low","medium","quartile","high"],Tu=["numeric","alphanumeric","byte","kanji","eci"],Zy=[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],Jy={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]},Xy={low:[1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],medium:[1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],quartile:[1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],high:[1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]},We={size:{encode:t=>21+4*(t-1),decode:t=>(t-17)/4},sizeType:t=>Math.floor((t+7)/17),alignmentPatterns(t){if(t===1)return[];const e=We.size.encode(t)-6-1,n=e-6,r=Math.ceil(n/28);let i=Math.floor(n/r);i%2?i+=1:n%r*2>=r&&(i+=2);const o=[6];for(let c=1;c<r;c++)o.push(e-(r-c)*i);return o.push(e),o},ECCode:{low:1,medium:0,quartile:3,high:2},formatMask:21522,formatBits(t,e){const n=We.ECCode[t]<<3|e;let r=n;for(let i=0;i<10;i++)r=r<<1^1335*(r>>9);return(n<<10|r)^We.formatMask},versionBits(t){let e=t;for(let n=0;n<12;n++)e=e<<1^7973*(e>>11);return t<<12|e},alphabet:{numeric:Au("0123456789"),alphanumerc:Au("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:")},lengthBits:(t,e)=>({numeric:[10,12,14],alphanumeric:[9,11,13],byte:[8,16,16],kanji:[8,10,12],eci:[0,0,0]})[e][We.sizeType(t)],modeBits:{numeric:"0001",alphanumeric:"0010",byte:"0100",kanji:"1000",eci:"0111"},capacity(t,e){const n=Zy[t-1],r=Jy[e][t-1],i=Xy[e][t-1],o=Math.floor(n/i)-r,c=i-n%i;return{words:r,numBlocks:i,shortBlocks:c,blockLen:o,capacity:8*(n-r*i),total:(r+o)*i+i-c}}},fa=[(t,e)=>(t+e)%2==0,(t,e)=>e%2==0,(t,e)=>t%3==0,(t,e)=>(t+e)%3==0,(t,e)=>(Math.floor(e/2)+Math.floor(t/3))%2==0,(t,e)=>t*e%2+t*e%3==0,(t,e)=>(t*e%2+t*e%3)%2==0,(t,e)=>((t+e)%2+t*e%3)%2==0],ae={tables:(t=>{const e=lt(256,0),n=lt(256,0);for(let r=0,i=1;r<256;r++)e[r]=i,n[i]=r,i<<=1,256&i&&(i^=285);return{exp:e,log:n}})(),exp:t=>ae.tables.exp[t],log(t){if(t===0)throw new Error(`GF.log: wrong arg=${t}`);return ae.tables.log[t]%255},mul:(t,e)=>t===0||e===0?0:ae.tables.exp[(ae.tables.log[t]+ae.tables.log[e])%255],add:(t,e)=>t^e,pow:(t,e)=>ae.tables.exp[ae.tables.log[t]*e%255],inv(t){if(t===0)throw new Error(`GF.inverse: wrong arg=${t}`);return ae.tables.exp[255-ae.tables.log[t]]},polynomial(t){if(t.length==0)throw new Error("GF.polymomial: wrong length");if(t[0]!==0)return t;let e=0;for(;e<t.length-1&&t[e]==0;e++);return t.slice(e)},monomial(t,e){if(t<0)throw new Error(`GF.monomial: wrong degree=${t}`);if(e==0)return[0];let n=lt(t+1,0);return n[0]=e,ae.polynomial(n)},degree:t=>t.length-1,coefficient:(t,e)=>t[ae.degree(t)-e],mulPoly(t,e){if(t[0]===0||e[0]===0)return[0];const n=lt(t.length+e.length-1,0);for(let r=0;r<t.length;r++)for(let i=0;i<e.length;i++)n[r+i]=ae.add(n[r+i],ae.mul(t[r],e[i]));return ae.polynomial(n)},mulPolyScalar(t,e){if(e==0)return[0];if(e==1)return t;const n=lt(t.length,0);for(let r=0;r<t.length;r++)n[r]=ae.mul(t[r],e);return ae.polynomial(n)},mulPolyMonomial(t,e,n){if(e<0)throw new Error("GF.mulPolyMonomial: wrong degree");if(n==0)return[0];const r=lt(t.length+e,0);for(let i=0;i<t.length;i++)r[i]=ae.mul(t[i],n);return ae.polynomial(r)},addPoly(t,e){if(t[0]===0)return e;if(e[0]===0)return t;let n=t,r=e;n.length>r.length&&([n,r]=[r,n]);let i=lt(r.length,0),o=r.length-n.length,c=r.slice(0,o);for(let s=0;s<c.length;s++)i[s]=c[s];for(let s=o;s<r.length;s++)i[s]=ae.add(n[s-o],r[s]);return ae.polynomial(i)},remainderPoly(t,e){const n=Array.from(t);for(let r=0;r<t.length-e.length+1;r++){const i=n[r];if(i!==0)for(let o=1;o<e.length;o++)e[o]!==0&&(n[r+o]=ae.add(n[r+o],ae.mul(e[o],i)))}return n.slice(t.length-e.length+1,n.length)},divisorPoly(t){let e=[1];for(let n=0;n<t;n++)e=ae.mulPoly(e,[1,ae.pow(2,n)]);return e},evalPoly(t,e){if(e==0)return ae.coefficient(t,0);let n=t[0];for(let r=1;r<t.length;r++)n=ae.add(ae.mul(e,n),t[r]);return n},euclidian(t,e,n){ae.degree(t)<ae.degree(e)&&([t,e]=[e,t]);let r=t,i=e,o=[0],c=[1];for(;2*ae.degree(i)>=n;){let l=r,u=o;if(r=i,o=c,r[0]===0)throw new Error("rLast[0] === 0");i=l;let d=[0];const h=ae.inv(r[0]);for(;ae.degree(i)>=ae.degree(r)&&i[0]!==0;){const f=ae.degree(i)-ae.degree(r),m=ae.mul(i[0],h);d=ae.addPoly(d,ae.monomial(f,m)),i=ae.addPoly(i,ae.mulPolyMonomial(r,f,m))}if(d=ae.mulPoly(d,o),c=ae.addPoly(d,u),ae.degree(i)>=ae.degree(r))throw new Error(`Division failed r: ${i}, rLast: ${r}`)}const s=ae.coefficient(c,0);if(s==0)throw new Error("sigmaTilde(0) was zero");const a=ae.inv(s);return[ae.mulPolyScalar(c,a),ae.mulPolyScalar(i,a)]}};function Qy(t,e){const{words:n,shortBlocks:r,numBlocks:i,blockLen:o,total:c}=We.capacity(t,e),s=(a=n,{encode(l){const u=ae.divisorPoly(a),d=Array.from(l);return d.push(...u.slice(0,-1).fill(0)),Uint8Array.from(ae.remainderPoly(d,u))},decode(l){const u=l.slice(),d=ae.polynomial(Array.from(l));let h=lt(a,0),f=!1;for(let _=0;_<a;_++){const O=ae.evalPoly(d,ae.exp(_));h[h.length-1-_]=O,O!==0&&(f=!0)}if(!f)return u;h=ae.polynomial(h);const m=ae.monomial(a,1),[g,w]=ae.euclidian(m,h,a),p=lt(ae.degree(g),0);let C=0;for(let _=1;_<256&&C<p.length;_++)ae.evalPoly(g,_)===0&&(p[C++]=ae.inv(_));if(C!==p.length)throw new Error("RS.decode: wrong errors number");for(let _=0;_<p.length;_++){const O=u.length-1-ae.log(p[_]);if(O<0)throw new Error("RS.decode: wrong error location");const L=ae.inv(p[_]);let U=1;for(let q=0;q<p.length;q++)_!==q&&(U=ae.mul(U,ae.add(1,ae.mul(p[q],L))));u[O]=ae.add(u[O],ae.mul(ae.evalPoly(w,L),ae.inv(U)))}return u}});var a;return{encode(l){const u=[],d=[];for(let g=0;g<i;g++){const w=o+(g<r?0:1);u.push(l.subarray(0,w)),d.push(s.encode(l.subarray(0,w))),l=l.subarray(w)}const h=Cu(...u),f=Cu(...d),m=new Uint8Array(h.length+f.length);return m.set(h),m.set(f,h.length),m},decode(l){if(l.length!==c)throw new Error(`interleave.decode: len(data)=${l.length}, total=${c}`);const u=[];for(let f=0;f<i;f++){const m=f<r;u.push(new Uint8Array(n+o+(m?0:1)))}let d=0;for(let f=0;f<o;f++)for(let m=0;m<i;m++)u[m][f]=l[d++];for(let f=r;f<i;f++)u[f][o]=l[d++];for(let f=o;f<o+n;f++)for(let m=0;m<i;m++){const g=m<r;u[m][f+(g?0:1)]=l[d++]}const h=[];for(const f of u)h.push(...Array.from(s.decode(f)).slice(0,-n));return Uint8Array.from(h)}}}function Mu(t,e,n,r){let i="",o=n.length;if(r==="numeric"){const d=We.alphabet.numeric.decode(n.split("")),h=d.length;for(let f=0;f<h-2;f+=3)i+=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))}
32else if(r==="alphanumeric"){const d=We.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:c}=We.capacity(t,e),s=Tn(o,We.lengthBits(t,r));let a=We.modeBits[r]+s+i;if(a.length>c)throw new Error("Capacity overflow");a+="0".repeat(Math.min(4,Math.max(0,c-a.length))),a.length%8&&(a+="0".repeat(8-a.length%8));const l="1110110000010001";for(let d=0;a.length!==c;d++)a+=l[d%16];const u=Uint8Array.from(a.match(/(.{8})/g).map((d=>+`0b${d}`)));return Qy(t,e).encode(u)}function Ru(t,e,n,r,i=!1){const o=(function(a,l,u,d=!1){const h=We.size.encode(a);let f=new at(h+2);const m=new at(3).rect(0,3,!0).border(1,!1).border(1,!0).border(1,!1);f=f.embed(0,m).embed({x:-m.width,y:0},m).embed({x:0,y:-m.height},m),f=f.rectSlice(1,h);const g=new at(1).rect(0,1,!0).border(1,!1).border(1,!0),w=We.alignmentPatterns(a);for(const p of w)for(const C of w)f.data[p][C]===void 0&&f.embed({x:C-2,y:p-2},g);f=f.hLine({x:0,y:6},1/0,(({x:p},C)=>C===void 0?p%2==0:C)).vLine({x:6,y:0},1/0,(({y:p},C)=>C===void 0?p%2==0:C));{const p=We.formatBits(l,u),C=_=>!d&&(p>>_&1)==1;for(let _=0;_<6;_++)f.data[_][8]=C(_);for(let _=6;_<8;_++)f.data[_+1][8]=C(_);for(let _=8;_<15;_++)f.data[h-15+_][8]=C(_);for(let _=0;_<8;_++)f.data[8][h-_-1]=C(_);for(let _=8;_<9;_++)f.data[8][15-_-1+1]=C(_);for(let _=9;_<15;_++)f.data[8][15-_-1]=C(_);f.data[h-8][8]=!d}if(a>=7){const p=We.versionBits(a);for(let C=0;C<18;C+=1){const _=!d&&(p>>C&1)==1,O=Math.floor(C/3),L=C%3+h-8-3;f.data[O][L]=_,f.data[L][O]=_}}return f})(t,e,r,i);let c=0;const s=8*n.length;if((function(a,l,u){const d=a.height,h=fa[l];let f=-1,m=d-1;for(let g=d-1;g>0;g-=2){for(g==6&&(g=5);;m+=f){for(let w=0;w<2;w+=1){const p=g-w;a.data[m][p]===void 0&&u(p,m,h(p,m))}if(m+f<0||m+f>=d)break}f=-f}})(o,r,((a,l,u)=>{let d=!1;c<s&&(d=(n[c>>>3]>>(7-c&7)&1)!=0,c++),o.data[l][a]=d!==u})),c!==s)throw new Error("QR: bytes left after draw");return o}function ev(t){const e=t.inverse(),n=f=>{let m=0;for(let g,w=0,p=1;w<f.length;w++)g===f[w]&&(p++,w!==f.length-1)||(p>=5&&(m+=p-5+3),g=f[w],p=1);return m};let r=0;t.data.forEach((f=>r+=n(f))),e.data.forEach((f=>r+=n(f)));let i=0,o=t.data;const c=t.width-1,s=t.height-1;for(let f=0;f<c;f++)for(let m=0;m<s;m++){const g=f+1,w=m+1;o[f][m]===o[g][m]&&o[g][m]===o[f][w]&&o[g][m]===o[g][w]&&(i+=3)}const a=f=>{const m=[!0,!1,!0,!0,!0,!1,!0],g=[!1,!1,!1,!1],w=[...m,...g],p=[...g,...m];let C=0;for(let _=0;_<f.length;_++)ku(f,w,_)&&(C+=40),ku(f,p,_)&&(C+=40);return C};let l=0;for(const f of t.data)l+=a(f);for(const f of e.data)l+=a(f);let u=0;t.rectRead(0,1/0,((f,m)=>u+=m?1:0));const d=u/(t.height*t.width)*100,h=10*Math.floor(Math.abs(d-50)/5);return r+i+l+h}function Nf(t,e="raw",n={}){const r=n.ecc!==void 0?n.ecc:"medium";(function(u){if(!xu.includes(u))throw new Error(`Invalid error correction mode=${u}. Expected: ${xu}`)})(r);const i=n.encoding!==void 0?n.encoding:(function(u){let d="numeric";for(let h of u)if(!We.alphabet.numeric.has(h)&&(d="alphanumeric",!We.alphabet.alphanumerc.has(h)))return"byte";return d})(t);(function(u){if(!Tu.includes(u))throw new Error(`Encoding: invalid mode=${u}. Expected: ${Tu}`);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)||!fa[u])throw new Error(`Invalid mask=${u}. Expected number [0..7]`)})(n.mask);let o,c=n.version,s=new Error("Unknown error");if(c!==void 0)(function(u){if(!Number.isSafeInteger(u)||u<1||u>40)throw new Error(`Invalid version=${u}. Expected number [1..40]`)})(c),o=Mu(c,r,t,i);else for(let u=1;u<=40;u++)try{o=Mu(u,r,t,i),c=u;break}catch(d){s=d}if(!c||!o)throw s;let a=(function(u,d,h,f){if(f===void 0){const m=(function(){let g,w=1/0;return{add(p,C){p>=w||(g=C,w=p)},get:()=>g,score:()=>w}})();for(let g=0;g<fa.length;g++)m.add(ev(Ru(u,d,h,g,!0)),g);f=m.get()}if(f===void 0)throw new Error("Cannot find mask");return Ru(u,d,h,f)})(c,r,o,n.mask);a.assertDrawn();const l=n.border===void 0?2:n.border;if(!Number.isSafeInteger(l))throw new Error("Wrong border type="+typeof l);if(a=a.border(l,!1),n.scale!==void 0&&(a=a.scale(n.scale)),e==="raw")return a.data;if(e==="ascii")return a.toASCII();if(e==="svg")return a.toSVG();if(e==="gif")return a.toGIF();if(e==="term")return a.toTerm();throw new Error(`Unknown output: ${e}`)}const Ms={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 ic{constructor(e){var n;this.translations=Ms,this.supportedLocales=["es","fr","he","it","pt","tr"],this.baseUrl=(n=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=Ms}else this.translations=Ms}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 Df=class{constructor(t){Wa(this,t),this.close=Sn(this,"close"),this.startDesktopOnboarding=Sn(this,"startDesktopOnboarding"),this.trackAnalytics=Sn(this,"trackA
32nalytics"),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 ic}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=Nf(this.link,"svg",{ecc:"medium",scale:2});return Y(ec,{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(nc,null)))),Y("div",{class:"logoContainer"},Y(rc,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(Ts,{Icon:Wy,text:t("INSTALL_MODAL.TRUSTED_BY_USERS")})),Y("div",{class:"item"},Y(Ts,{Icon:Vy,text:t("INSTALL_MODAL.LEADING_CRYPTO_WALLET")})),Y("div",{class:"item"},Y(Ts,{Icon:Gy,text:t("INSTALL_MODAL.CONTROL_DIGITAL_INTERACTIONS")})),Y("button",{class:"button",onClick:()=>this.onStartDesktopOnboardingHandler()},Y(Yy,null),Y("span",{class:"installExtensionText"},t("INSTALL_MODAL.INSTALL_META_MASK_EXTENSION"))))),Y(tc,{version:this.sdkVersion})))}get el(){return Po(this)}static get watchers(){return{preferDesktop:["updatePreferDesktop"]}}};Df.style=`.flexContainer {
33    display: flex;
34    justify-content: center;
35    align-items: center;
36    flex-direction: row;
37}
38
39.flexItem {
40    flex: 1;
41    justify-content: center;
42    align-items: center;
43}
44
45.flexItem11 {
46    flex: 11;
47    justify-content: center;
48    align-items: center;
49}
50
51.flexItem1 {
52    flex: 1;
53    justify-content: center;
54    align-items: center;
55}
56
57.tab {
58    padding: 8px;
59    cursor: pointer;
60    background-color: #F2F4F6;
61    font-size: 12px;
62    text-align: center;
63    color: #24292E;
64}
65
66.tabcontainer {
67    padding: 4px;
68    background-color: #F2F4F6;
69    border-radius: 8px;
70    margin-bottom: 30px;
71    margin-top: 30px;
72}
73
74.tabactive {
75    background-color: white;
76    -webkit-transition: background-color 300ms linear;
77    -ms-transition: background-color 300ms linear;
78    transition: background-color 300ms linear;
79    border-radius: 8px;
80}
81
82.item {
83    font-size: 12px;
84    margin-bottom: 16px;
85    border-radius: 8px;
86    padding: 10px;
87    border: 2px #F2F4F6 solid;
88    color: #24292E;
89}
90
91.extensionLabel {
92    font-style: normal;
93    font-weight: bold;
94    font-size: 14px;
95    text-align: cetner;
96    color: #24272A;
97}
98
99.notice {
100    font-size: 12px;
101    margin-left: 10px;
102    margin-right: 10px;
103    color: grey;
104}
105
106.button {
107    margin-top: 41.5px;
108    margin-bottom: 20px;
109    width: 100%;
110    display: flex;
111    flex-direction: row;
112    justify-content: center;
113    align-items: center;
114    padding: 12px 20px;
115    background: #037DD6;
116    border-radius: 32px;
117    color: white;
118    border: 0;
119    font-size: 14px;
120    cursor: pointer;
121}
122
123.backdrop {
124    visibility: visible;
125    position: fixed;
126    top: 0;
127    left: 0;
128    right: 0;
129    bottom: 0;
130    width: 100%;
131    z-index: 99998;
132    background: rgba(0, 0, 0, 0.87);
133    opacity: 0.3;
134}
135
136.modal {
137    visibility: visible;
138    position: fixed;
139    left: 50%;
140    transform: translate(-50%, -50%);
141    z-index: 99999;
142    background: white;
143    padding: 20px;
144    border-radius: 8px;
145    top: 50%;
146    max-width: 100%;
147    width: 460px;
148    min-width: 300px;
149    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;
150    -webkit-font-smoothing: antialiased;
151}
152
153.closeButton {
154    color: #BBC0C5;
155    cursor: pointer;
156}
157
158.logoContainer {
159    margin-left: 24px;
160    margin-right: 24px;
161    margin-top: 24px;
162    display: flex;
163    align-items: center;
164    justify-content: center;
165}
166
167.connectMobileText {
168    font-size: 14px;
169    color: black;
170    margin-top: 28px;
171    margin-bottom: 28px;
172    line-height: 2;
173}
174
175.blue {
176    color: #037DD6;
177    font-weight: 700;
178}
179
180.installExtensionText {
181    margin-left: 10px;
182}
183
184.center {
185    display: flex;
186    justify-content: center;
187    align-items: center;
188}
189
190.right {
191    display: flex;
192    align-items: center;
193    justify-content: right;
194}
195
196#sdk-mm-qrcode {
197    svg {
198        width: 50%;
199    }
200}`;const Bf=class{constructor(t){Wa(this,t),this.close=Sn(this,"close"),this.disconnect=Sn(this,"disconnect"),this.updateOTPValue=Sn(this,"updateOTPValue"),this.displayOTP=void 0,this.sdkVersion=void 0,this.otpCode=void 0,this.translationsLoaded=!1,this.i18nInstance=new ic}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(ec,{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(nc,null)))),Y("div",{class:"logoContainer"},Y(rc,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(tc,{version:n})))}get el(){return Po(this)}};Bf.style=`.flexContainer {
201    display: flex;
202    justify-content: center;
203    align-items: center;
204    flex-direction: row;
205}
206
207.flexItem {
208    flex: 1;
209    justify-content: center;
210    align-items: center;
211}
212
213.flexItem11 {
214    flex: 11;
215    justify-content: center;
216    align-items: center;
217}
218
219.flexItem1 {
220    flex: 1;
221    justify-content: center;
222    align-items: center;
223}
224
225.tab {
226    padding: 8px;
227    cursor: pointer;
228    background-color: #F2F4F6;
229    font-size: 12px;
230    text-align: center;
231    color: #24292E;
232}
233
234.tabcontainer {
235    padding: 4px;
236    background-color: #F2F4F6;
237    border-radius: 8px;
238    margin-bottom: 30px;
239    margin-top: 30px;
240}
241
242.tabactive {
243    background-color: white;
244    -webkit-transition: background-color 300ms linear;
245    -ms-transition: background-color 300ms linear;
246    transition: background-color 300ms linear;
247    border-radius: 8px;
248}
249
250.item {
251    font-size: 12px;
252    margin-bottom: 16px;
253    border-radius: 8px;
254    padding: 10px;
255    border: 2px #F2F4F6 solid;
256    color: #24292E;
257}
258
259.extensionLabel {
260    font-style: normal;
261    font-weight: bold;
262    font-size: 14px;
263    text-align: cetner;
264    color: #24272A;
265}
266
267.notice {
268    font-size: 12px;
269    margin-left: 10px;
270    margin-right: 10px;
271    color: grey;
272}
273
274.button {
275    margin-top: 41.5px;
276    margin-bottom: 20px;
277    width: 100%;
278    display: flex;
279    flex-direction: row;
280    justify-content: center;
281    align-items: center;
282    padding: 12px 20px;
283    background: #037DD6;
284    border-radius: 32px;
285    color: white;
286    border: 0;
287    font-size: 14px;
288    cursor: pointer;
289}
290
291.backdrop {
292    visibility: visible;
293    position: fixed;
294    top: 0;
295    left: 0;
296    right: 0;
297    bottom: 0;
298    width: 100%;
299    z-index: 99998;
300    background: rgba(0, 0, 0, 0.87);
301    opacity: 0.3;
302}
303
304.modal {
305    visibility: visible;
306    position: fixed;
307    left: 50%;
308    transform: translate(-50%, -50%);
309    z-index: 99999;
310    background: white;
311    padding: 20px;
312    border-radius: 8px;
313    top: 50%;
314    max-width: 100%;
315    width: 460px;
316    min-width: 300px;
317    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;
318    -webkit-font-smoothing: antialiased;
319}
320
321.closeButton {
322    color: #BBC0C5;
323    cursor: pointer;
324}
325
326.logoContainer {
327    margin-left: 24px;
328    margin-right: 24px;
329    margin-top: 24px;
330    display: flex;
331    align-items: center;
332    justify-content: center;
333}
334
335.connectMobileText {
336    font-size: 14px;
337    color: black;
338    margin-top: 28px;
339    margin-bottom: 28px;
340    line-height: 2;
341}
342
343.blue {
344    color: #037DD6;
345    font-weight: 700;
346}
347
348.installExtensionText {
349    margin-left: 10px;
350}
351
352.center {
353    display: flex;
354    justify-content: center;
355    align-items: center;
356}
357
358.right {
359    display: flex;
360    align-items: center;
361    justify-content: right;
362}
363
364#sdk-mm-qrcode {
365    svg {
366        width: 50%;
367    }
368}`;const tv=()=>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"})),nv=()=>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"})),$f=class{constructor(t){Wa(this,t),this.close=Sn(this,"close"),this.connectWithExtension=Sn(this,"connectWithExtension"),this.link=void 0,this.sdkVersion=void 0,this.preferDesktop=void 0,this.tab=1,this.isDefaultTab=!0,this.translationsLoaded=!1,this.i18nInstance=new ic,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})}
368connectWithExtensionHandler(){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=Nf(this.link,"svg",{ecc:"medium",scale:2});return Y(ec,{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(nc,null)))),Y("div",{class:"logoContainer"},Y(rc,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(nv,null)),Y("div",{class:"extensionLabel"},t("SELECT_MODAL.CRYPTO_TAKE_CONTROL_TEXT")),Y("button",{class:"button",onClick:()=>this.connectWithExtensionHandler()},Y(tv,null),Y("span",{class:"installExtensionText"},t("CONNECT_WITH_EXTENSION"))))),Y(tc,{version:e})))}get el(){return Po(this)}static get watchers(){return{preferDesktop:["updatePreferDesktop"]}}};$f.style=`.flexContainer {
369    display: flex;
370    justify-content: center;
371    align-items: center;
372    flex-direction: row;
373}
374
375.flexItem {
376    flex: 1;
377    justify-content: center;
378    align-items: center;
379}
380
381.flexItem11 {
382    flex: 11;
383    justify-content: center;
384    align-items: center;
385}
386
387.flexItem1 {
388    flex: 1;
389    justify-content: center;
390    align-items: center;
391}
392
393.tab {
394    padding: 8px;
395    cursor: pointer;
396    background-color: #F2F4F6;
397    font-size: 12px;
398    text-align: center;
399    color: #24292E;
400}
401
402.tabcontainer {
403    padding: 4px;
404    background-color: #F2F4F6;
405    border-radius: 8px;
406    margin-bottom: 30px;
407    margin-top: 30px;
408}
409
410.tabactive {
411    background-color: white;
412    -webkit-transition: background-color 300ms linear;
413    -ms-transition: background-color 300ms linear;
414    transition: background-color 300ms linear;
415    border-radius: 8px;
416}
417
418.item {
419    font-size: 12px;
420    margin-bottom: 16px;
421    border-radius: 8px;
422    padding: 10px;
423    border: 2px #F2F4F6 solid;
424    color: #24292E;
425}
426
427.extensionLabel {
428    font-style: normal;
429    font-weight: bold;
430    font-size: 14px;
431    text-align: cetner;
432    color: #24272A;
433}
434
435.notice {
436    font-size: 12px;
437    margin-left: 10px;
438    margin-right: 10px;
439    color: grey;
440}
441
442.button {
443    margin-top: 41.5px;
444    margin-bottom: 20px;
445    width: 100%;
446    display: flex;
447    flex-direction: row;
448    justify-content: center;
449    align-items: center;
450    padding: 12px 20px;
451    background: #037DD6;
452    border-radius: 32px;
453    color: white;
454    border: 0;
455    font-size: 14px;
456    cursor: pointer;
457}
458
459.backdrop {
460    visibility: visible;
461    position: fixed;
462    top: 0;
463    left: 0;
464    right: 0;
465    bottom: 0;
466    width: 100%;
467    z-index: 99998;
468    background: rgba(0, 0, 0, 0.87);
469    opacity: 0.3;
470}
471
472.modal {
473    visibility: visible;
474    position: fixed;
475    left: 50%;
476    transform: translate(-50%, -50%);
477    z-index: 99999;
478    background: white;
479    padding: 20px;
480    border-radius: 8px;
481    top: 50%;
482    max-width: 100%;
483    width: 460px;
484    min-width: 300px;
485    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;
486    -webkit-font-smoothing: antialiased;
487}
488
489.closeButton {
490    color: #BBC0C5;
491    cursor: pointer;
492}
493
494.logoContainer {
495    margin-left: 24px;
496    margin-right: 24px;
497    margin-top: 24px;
498    display: flex;
499    align-items: center;
500    justify-content: center;
501}
502
503.connectMobileText {
504    font-size: 14px;
505    color: black;
506    margin-top: 28px;
507    margin-bottom: 28px;
508    line-height: 2;
509}
510
511.blue {
512    color: #037DD6;
513    font-weight: 700;
514}
515
516.installExtensionText {
517    margin-left: 10px;
518}
519
520.center {
521    display: flex;
522    justify-content: center;
523    align-items: center;
524}
525
526.right {
527    display: flex;
528    align-items: center;
529    justify-content: right;
530}
531
532#sdk-mm-qrcode {
533    svg {
534        width: 50%;
535    }
536}`;var rv=Object.freeze({__proto__:null,mm_install_modal:Df,mm_pending_modal:Bf,mm_select_modal:$f});export{Dn as CommunicationLayerPreference,Ue as ConnectionStatus,sr as DEFAULT_SERVER_URL,te as EventType,xe as MessageType,sv as MetaMaskSDK,nt as MetaMaskSDKEvent,Kt as PROVIDER_UPDATE_TYPE,Ve as PlatformType,qg as SDKProvider,sv 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.